[web2py] 'str' object has no attribute 'year'
In a table I defined the following field: Field('birthday', writable=False, readable=False, **isemptyorisdate), isemptyorisdate has been defined like this: isemptyorisdate = dict(type='date', default='', requires=IS_EMPTY_OR(IS_DATE(format='%d-%m-%Y', error_message='No match dd-mm-')), represent=lambda v: v.strftime('%d/%m/%Y') if v else '') In web2py's admin this works, however, when I define an update function containing the following lines of code: db.vtx_person.birthday.readable = db.vtx_personbirthday.writable = True form = SQLFORM.factory(db.vtx_person, db.lct_address, Field('phonenumber', length=128, requires=IS_LENGTH(128)), Field('mobilenumber', length=128, requires=IS_LENGTH(128)), Field('email', length=128, requires=[IS_LENGTH(128), IS_EMAIL()]), Field('URL', length=128, requires=IS_EMPTY_OR(IS_URL(prepend_scheme=None I get the following error: 'str' object has no attribute 'year' When I comment out the line : db.vtx_person.birthday.readable = db.vtx_personbirthday.writable = True I do not get the error. In appadmin/update/db/vtx_person the birthday field is rendered like this: How do I solve tis ussue? Kind regards, Annet -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Graph Model (proposal to contribute)
Here's a start: https://github.com/willimoa/welcome_d3 > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: strange behavior of $@ bash parameter expansion
Thank you, Niphlod. Can you help me with the Web2py upgrade ? Because I think there are some fatal problems in Web2py code. Basically appadmin will start well, but fails after Web2py restart with corrupted scheduler. I want move from 2.14.6 to trunk. (because 2.14.6 has strange gluon/main.py ln.451 "except HTTP, http_response", which makes problems to me and it is fixed in trunk) My steps are: 1. git clone --recursive g...@github.com:web2py/web2py.git 2. I make copy of my app called codex2020 from backuped 2.14.6 into applications/ 3. python /home/mirek/mz/web2py/web2py.py -a "xxx" 4. http://localhost:8000/codex2020/appadmin# this works 5. http://localhost:8000/codex2020/appadmin# this works 6. kill web2py 7. python /home/mirek/mz/web2py/web2py.py -a "xxx" 8. http://localhost:8000/codex2020/appadmin Now appadmin fails with: column "worker_stats__tmp" is of type json but expression is of type text LINE 1: UPDATE "scheduler_worker" SET "worker_stats__tmp"="worker_st... ^ HINT: You will need to rewrite or cast the expression. Traceback (most recent call last): File "/home/mirek/mz/web2py/gluon/restricted.py", line 216, in restricted exec(ccode, environment) File "/home/mirek/mz/web2py/applications/codex2020/models/scheduler.py", line 76, in scheduler = Scheduler(db) File "/home/mirek/mz/web2py/gluon/scheduler.py", line 771, in __init__ self.define_tables(db, migrate=migrate) File "/home/mirek/mz/web2py/gluon/scheduler.py", line 866, in define_tables migrate=self.__get_migrate('scheduler_worker', migrate) File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/base.py", line 587, in define_table table = self.lazy_define_table(tablename, *fields, **args) File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/base.py", line 621, in lazy_define_table polymodel=polymodel) File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/adapters/base.py", line 778, in create_table return self.migrator.create_table(*args, **kwargs) File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/migrator.py", line 297, in create_table fake_migrate=fake_migrate File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/migrator.py", line 417, in migrate_table self.adapter.execute(sub_query) File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 67, in wrap return f(*args, **kwargs) File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/adapters/base.py", line 416, in execute rv = self.cursor.execute(command, *args[1:], **kwargs) ProgrammingError: column "worker_stats__tmp" is of type json but expression is of type text LINE 1: UPDATE "scheduler_worker" SET "worker_stats__tmp"="worker_st... -- Note: This has nothing to do with scheduler from 2.14.6. If I fix it now, removing 4 Scheduler tables in pgAdmin and 4 Scheduler metadata in databases/ then I receive same: first start good, next start corrupted. -- If I instead of (8.) do 8. http://localhost:8000/codex2020 then I receive another error, which is maybe consecutive to the corrupted scheduler, but maybe it is next standalone error: class MARKMIN(XmlComponent), In 'text' is LazyT, which (I think) is not handled in _compat.py:to_bytes Traceback (most recent call last): File "/home/mirek/mz/web2py/gluon/restricted.py", line 216, in restricted exec(ccode, environment) File "", line 113, in File "/home/mirek/mz/web2py/gluon/html.py", line 2802, in __init__ self.text = to_bytes(text) File "/home/mirek/mz/web2py/gluon/_compat.py", line 67, in to_bytes raise TypeError('Expected bytes') TypeError: Expected bytes On Monday, 7 November 2016 18:28:22 UTC+1, Mirek Zvolský wrote: > > I use Debian (testing), Postgres 9.4, > and Web2py 2.14.6 (with current trunk is problem the same) > > I use such command (assigned to an alias) for long time to start my > application > python web2py.py -K codex2020 -X $@ > > Today I received strange behaviour, errors like > web2py.scheduler TICKER: error assigning tasks > or such something (with no effect if I have deleted scheduler_* tables and > their databases/ metadata earlier) > starting scheduler for "codex2020"... > Currently running 1 scheduler processes > Traceback (most recent call last): > File "/home/mirek/mz/web2py/gluon/restricted.py", line 227, in restricted >exec ccode in environment > File "applications/codex2020/models/scheduler.py", line 80, in >scheduler = Scheduler(db) > File "/home/mirek/mz/web2py/gluon/scheduler.py", line 567, in __init__ >self.define_tables(db, migrate=migrate) > File "/home/mirek/mz/web2py/gluon/scheduler.py", line 659, in > define_tables >migrate=self.__get_migrate('scheduler_worker', migrate) > File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/base.py", line 834, > in define_table >table = self.lazy_define_table(tablename,*fields,**args) > File
[web2py] Re: Text area input field DAL question
you could use a html tag instead of a : {{=event}} http://www.w3schools.com/tags/tag_pre.asp or you could include a TEXTAREA web2py helper in the : {{=TEXTAREA(event)}} you should also set this helper to* readonly* to prevent user interaction with it there are probably other options i ignore -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] lastName, firstName in form
.strip() Richard On Wed, Nov 16, 2016 at 2:29 AM, 'Annet' via web2py-users < web2py@googlegroups.com> wrote: > I have a form in which the user enter his name, for example: 'Thompson, > Brian' > > When I execute the following query: > > rowset = db(db.vtx_vertex.name.ilike(nameform.vars.name)) > > This query return the correct result. > > However, when db.vtx_vertex.name is 'Thompson, Brian ' (a space after > Brian) > and nameform.vars.name is 'Thompson, Brian ' as well, the query does not > return a result. > > Why not, and how can I fix this problem? > > Kind regards, > > Annet > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] what is in the cache ?
how do I retrieve a key,value pair stored in the redis cache ? am doing this : message = cache.redis('message', lambda: 'Hello', time_expire=360) now i want to test that key='message' still exists and get its value ? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] 'str' object has no attribute 'year'
Could it be possible that default value is wrong? Wouldn't better be None? It a bit difficult to say what the problem is without the full table definition and full traceback (at least more detailed one). Richard On Wed, Nov 16, 2016 at 3:35 AM, 'Annet' via web2py-users < web2py@googlegroups.com> wrote: > In a table I defined the following field: > > Field('birthday', writable=False, readable=False, **isemptyorisdate), > > isemptyorisdate has been defined like this: > > isemptyorisdate = dict(type='date', default='', > requires=IS_EMPTY_OR(IS_DATE(format='%d-%m-%Y', > error_message='No match dd-mm-')), > represent=lambda v: v.strftime('%d/%m/%Y') if v else '') > > In web2py's admin this works, however, when I define an update function > containing the following lines of code: > > > db.vtx_person.birthday.readable = db.vtx_personbirthday.writable = True > form = SQLFORM.factory(db.vtx_person, db.lct_address, > Field('phonenumber', length=128, requires=IS_LENGTH(128)), > Field('mobilenumber', length=128, requires=IS_LENGTH(128)), > Field('email', length=128, requires=[IS_LENGTH(128), IS_EMAIL()]), > Field('URL', length=128, requires=IS_EMPTY_OR(IS_URL( > prepend_scheme=None > > > I get the following error: > > 'str' object has no attribute 'year' > When I comment out the line : > > db.vtx_person.birthday.readable = db.vtx_personbirthday.writable = True > > I do not get the error. In appadmin/update/db/vtx_person the birthday > field is rendered like this: > > value="" type="text"> > > > How do I solve tis ussue? > > > Kind regards, > > Annet > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Graph Model (proposal to contribute)
Could we keep both rendering mechanism graphviz + d3? On Wed, Nov 16, 2016 at 4:38 AM, Andrew Willimott wrote: > Here's a start: > https://github.com/willimoa/welcome_d3 > > > > >> -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] lastName, firstName in form
Here what I usually do for search in user field name : search_val = request.vars.txtSearch rows = db(((db.auth_user.registration_key != 'disabled') | (db.auth_user.registration_key == None)) & (db.auth_user.first_name.lower().like('%{0}%'.format(search_val.lower( | ((db.auth_user.registration_key != 'disabled') | (db.auth_user.registration_key == None)) & (db.auth_user.last_name.lower().like('%{0}%'.format(search_val.lower( ).select(db.auth_user.id, db.auth_user.first_name, db.auth_user.last_name, db.auth_user.username, orderby=[db.auth_user.first_name, db.auth_user.last_name]) You can do .lower().strip() to be sure, it important that you made .lower() on "both side" of the query, search value and database value... Richard On Wed, Nov 16, 2016 at 8:11 AM, Richard Vézina wrote: > .strip() > > Richard > > On Wed, Nov 16, 2016 at 2:29 AM, 'Annet' via web2py-users < > web2py@googlegroups.com> wrote: > >> I have a form in which the user enter his name, for example: 'Thompson, >> Brian' >> >> When I execute the following query: >> >> rowset = db(db.vtx_vertex.name.ilike(nameform.vars.name)) >> >> This query return the correct result. >> >> However, when db.vtx_vertex.name is 'Thompson, Brian ' (a space after >> Brian) >> and nameform.vars.name is 'Thompson, Brian ' as well, the query does not >> return a result. >> >> Why not, and how can I fix this problem? >> >> Kind regards, >> >> Annet >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Graph Model (proposal to contribute)
+1 for D3 no need to install graphviz and pygraphviz on the server... 2016-11-16 13:56 GMT+00:00 Richard Vézina : > Could we keep both rendering mechanism graphviz + d3? > > On Wed, Nov 16, 2016 at 4:38 AM, Andrew Willimott > wrote: > >> Here's a start: >> https://github.com/willimoa/welcome_d3 >> >> >> >> >>> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: strange behavior of $@ bash parameter expansion
In fact it is not migration problem. But fatal problem after adding scheduler (Postgres+Scheduler) 1. Clean new app created in /admin 2. Changed private/appconfig.ini to Postgres database (empty database I have created in pgAdmin) 3. Web2py + AppAdmin --> OK 4. added models/scheduler.py: import + instantiate Scheduler ; nothing more 5. restart Web2py + AppAdmin --> OK 6. restart Web2py + AppAdmin --> failure column "worker_stats__tmp" is of type json but expression is of type text LINE 1: UPDATE "scheduler_worker" SET "worker_stats__tmp"="worker_st... ^ HINT: You will need to rewrite or cast the expression. Debian 8 Jessie Testing, Postgres 9.4, python-psycopg2/testing,now 2.6.2-1 amd64 (I hope Web2py uses this one) On Monday, 7 November 2016 18:28:22 UTC+1, Mirek Zvolský wrote: > > I use Debian (testing), Postgres 9.4, > and Web2py 2.14.6 (with current trunk is problem the same) > > I use such command (assigned to an alias) for long time to start my > application > python web2py.py -K codex2020 -X $@ > > Today I received strange behaviour, errors like > web2py.scheduler TICKER: error assigning tasks > or such something (with no effect if I have deleted scheduler_* tables and > their databases/ metadata earlier) > starting scheduler for "codex2020"... > Currently running 1 scheduler processes > Traceback (most recent call last): > File "/home/mirek/mz/web2py/gluon/restricted.py", line 227, in restricted >exec ccode in environment > File "applications/codex2020/models/scheduler.py", line 80, in >scheduler = Scheduler(db) > File "/home/mirek/mz/web2py/gluon/scheduler.py", line 567, in __init__ >self.define_tables(db, migrate=migrate) > File "/home/mirek/mz/web2py/gluon/scheduler.py", line 659, in > define_tables >migrate=self.__get_migrate('scheduler_worker', migrate) > File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/base.py", line 834, > in define_table >table = self.lazy_define_table(tablename,*fields,**args) > File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/base.py", line 873, > in lazy_define_table >polymodel=polymodel) > File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/adapters/base.py", > line 510, in create_table >fake_migrate=fake_migrate > File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/adapters/base.py", > line 623, in migrate_table >self.execute(sub_query) > File > "/home/mirek/mz/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line > 362, in execute >return BaseAdapter.execute(self, *a, **b) > File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/adapters/base.py", > line 1388, in execute >return self.log_execute(*a, **b) > File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/adapters/base.py", > line 1382, in log_execute >ret = self.get_cursor().execute(command, *a[1:], **b) > ProgrammingError: column "worker_stats__tmp" is of type json but > expression is of type text > LINE 1: UPDATE scheduler_worker SET worker_stats__tmp=worker_stats; > ^ > HINT: You will need to rewrite or cast the expression. > > Then I decided then if I run without $@, all will start well: > python web2py.py -K codex2020 -X > > After testing of everything I went back to: > python web2py.py -K codex2020 -X $@ > or > python web2py.py -K codex2020 -X "$@" > > and I have now no more the previous problem. All works well. > > Has somebody any idea about the reason of problems > and can you explain me the difference between $@ and "$@". Which one is > more safe to use? Is there a difference? > > Thanks... > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Graph Model (proposal to contribute)
+1. Is it going to be standard on next upgrades? On Wednesday, November 16, 2016 at 9:58:35 AM UTC-5, Ramos wrote: > > +1 for D3 > no need to install graphviz and pygraphviz on the server... > > > 2016-11-16 13:56 GMT+00:00 Richard Vézina >: > >> Could we keep both rendering mechanism graphviz + d3? >> >> On Wed, Nov 16, 2016 at 4:38 AM, Andrew Willimott > > wrote: >> >>> Here's a start: >>> https://github.com/willimoa/welcome_d3 >>> >>> >>> >>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "web2py-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to web2py+un...@googlegroups.com . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+un...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Text area input field DAL question
You can and should use XML(..., sanitize=True). If it is sanitizing any HTML tags or attributes that you want to preserve, you can configure the sanitizer via the "permitted_tags" and "allowed_attributes" arguments (see http://web2py.com/books/default/chapter/29/05/the-views#XML). Anthony On Tuesday, November 15, 2016 at 7:23:53 PM UTC-5, 黄祥 wrote: > > let say i have a text field that filled with the html tags, how should i > use the represent for that? > *e.g.* > db.define_table('mail_queue', > Field('mail_to', 'list:string'), > Field('subject'), > Field('messages', 'text'), > Field('status'), > format = lambda r: '%s - %s - %s' % (r.mail_to, r.subject, r.status) ) > > db.mail_queue.messages.represent = lambda value, field: XML(value, > sanitize = False) if value else '' > > what i want to achieve is the messages field show html tag work result, > but sanitize = False will open a XSS attack, isn't it? > > db.mail_queue.messages.represent = lambda value, field: XML(value, > sanitize = True) if value else '' > > sanitize = True will not shown the html tag work result, just the html tag. > > any idea? > > thanks and best regards, > stifan > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] lastName, firstName in form
It's probably a good idea to strip any leading/trailing whitespace before the names are ever inserted in the database. Anthony On Wednesday, November 16, 2016 at 9:28:56 AM UTC-5, Richard wrote: > > Here what I usually do for search in user field name : > > search_val = request.vars.txtSearch > rows = db(((db.auth_user.registration_key != 'disabled') | > (db.auth_user.registration_key == None)) & > > (db.auth_user.first_name.lower().like('%{0}%'.format(search_val.lower( | > ((db.auth_user.registration_key != 'disabled') | > (db.auth_user.registration_key == None)) & > > (db.auth_user.last_name.lower().like('%{0}%'.format(search_val.lower( > ).select(db.auth_user.id, db.auth_user.first_name, > db.auth_user.last_name, db.auth_user.username, >orderby=[db.auth_user.first_name, > db.auth_user.last_name]) > > You can do .lower().strip() to be sure, it important that you made > .lower() on "both side" of the query, search value and database value... > > Richard > > On Wed, Nov 16, 2016 at 8:11 AM, Richard Vézina < > ml.richard.vez...@gmail.com> wrote: > >> .strip() >> >> Richard >> >> On Wed, Nov 16, 2016 at 2:29 AM, 'Annet' via web2py-users < >> web2py@googlegroups.com> wrote: >> >>> I have a form in which the user enter his name, for example: 'Thompson, >>> Brian' >>> >>> When I execute the following query: >>> >>> rowset = db(db.vtx_vertex.name.ilike(nameform.vars.name)) >>> >>> This query return the correct result. >>> >>> However, when db.vtx_vertex.name is 'Thompson, Brian ' (a space after >>> Brian) >>> and nameform.vars.name is 'Thompson, Brian ' as well, the query does >>> not return a result. >>> >>> Why not, and how can I fix this problem? >>> >>> Kind regards, >>> >>> Annet >>> >>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "web2py-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to web2py+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: expiration vs long_expiration
The long_expiration is only relevant if you have the "Remember me" option enabled, in which case it applies when the user selects that option. Anthony On Tuesday, November 15, 2016 at 5:07:02 PM UTC-5, 黄祥 wrote: > > is there any difference between expiration and long_expiration? > e.g. > auth.settings.expiration = 60*60 > auth.settings.long_expiration = 60*60 > > can both have the same value or not? > > thanks and best regards, > stifan > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] conditional use of None
None is in the URL vars. http://127.0.0.1:8000/ES3/default/add_new_meeting_segment? specificAddressID=None how to handle None in conditional code in controller? Tried this: if request.get_vars.specificAddressID == None: #if user did not select an address then there is no FK to a db.Address record specificAddressSuperObjectID = db(db.Address.address_title == 'Unknown').select(db.Address.super_object_fk, limitby = (0,1)).first().super_object_fk else: specificAddress = db.Address(request.get_vars.specificAddressID) specificAddressSuperObjectID = specificAddress.super_object_fk but receive error NoneType' object has no attribute 'super_object_fk' if request.get_vars.specificAddressID == None: #if user did not select an address then there is no FK to a db.Address record specificAddressSuperObjectID = db(db.Address.address_title == 'Unknown').select(db.Address.super_object_fk, limitby = (0,1)).first().super_object_fk else: specificAddress = db.Address(request.get_vars.specificAddressID) specificAddressSuperObjectID = specificAddress.super_object_fk Why does the conditional IF line abive not handle the None condition? if request.get_vars.specificAddressID == None: If user enters data in date field, works fine, but I want to be able to handle cases when user does not input anything. thanks Alex Glaros -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: conditional use of None
Have you tried?: if request.get_vars.specificAddressID == "None": Whatever you put in the url is not python, so specificAddressID=None is translated as a string. To translate it into python's None i think the url should be something like: http://127.0.0.1:8000/ES3/default/add_new_meeting_segment?specificAddressID= or without the equal at the end. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: conditional use of None
works! Thanks Alfonso -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Script timed out before returning headers for apache server when scheduler task is running
Hi, I am using web2py as framework for my web application and using the built-in scheduler for the user tasks. They are working fine for more than one years. During the recent several days, I found that whenever I start a task to scheduler, the apache web server is not working, it is stuck in somewhere and give 500 internal server error. If I kill the task process or wait until the task completed, then the apache server goes back to normal. I checked the error log file of apache server, and the error message is "Script timed out before returning headers: wsgihandler.py". I think the scheduler task run is independent of the apache web server and just run in background in parallel. I don't know what could be the reason for this problem. The only thing I changed for the scheduler is the change of migrate from True to False when I initiate the scheduler: scheduler = Scheduler(db,dict(run=run),migrate=False) Did anyone encounter similar problem before? I will be very appreciated if someone can provide me a hint to solve this problem. Thanks very much! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: expiration vs long_expiration
got it, thanks for detail explaination, anthony best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Text area input field DAL question
thanks for the hints, anthony, forgot about permitted_tags and allowed_attributes arguments how to face the html comment for that? *e.g. :* permitted_tags = [' no error occured, but the result is not expected best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.