[web2py] Re: 'tzinfo' is an invalid keyword argument for this function
Option 2 is fine for me, changing d = datetime.date(yearhttp://www.web2py.com/examples/static/epydoc/gluon.validators-pysrc.html# , value.monthhttp://www.web2py.com/examples/static/epydoc/gluon.validators-pysrc.html# , value.dayhttp://www.web2py.com/examples/static/epydoc/gluon.validators-pysrc.html# ) to d = datetime.datetime(yearhttp://www.web2py.com/examples/static/epydoc/gluon.validators-pysrc.html# , value.monthhttp://www.web2py.com/examples/static/epydoc/gluon.validators-pysrc.html# , value.dayhttp://www.web2py.com/examples/static/epydoc/gluon.validators-pysrc.html# ) accomplishes this with implicit defaults On Sunday, January 12, 2014 3:20:38 PM UTC, Massimo Di Pierro wrote: This is wrong in the code but for logical reason. IS_DATE should not accept the timezone info. That is because unless you know a time of the time, it is not possible to determine the date (and time of the day) in the other timezone. This is reflected in the fact that datetime.date does not take a timezone while datetime.datetime. There are two ways out: 1) drop the IS_DATE(timezone) argument 2) make an implicit assumption about the time of date (always 00:00:00?). Suggestions? On Sunday, 12 January 2014 06:00:15 UTC-6, Graham Robbins wrote: IS_DATE() formatter sets d = datetime.date(year, value.month, value.day) and if self.timezone is not None it calls d.replace with the tzinfo keyword, this results in the exception: File /home/www-data/web2py/gluon/validators.py, line 2263, in formatter d = d.replace(tzinfo=utc).astimezone(self.timezone) TypeError: 'tzinfo' is an invalid keyword argument for this function Changing *d* to be a datetime.datetime instance returns the formatted date. The relevant field is: Field('deadline', 'date', requires=IS_DATE(timezone=pytz.timezone( 'America/Chicago'), format='%Y-%m-%d')) Should I be doing anything differently or does IS_DATE() need to be changed? Web2py: 2.8.2-stable+timestamp.2013.11.28.13.54.07 Python: 2.7.3 -- 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/groups/opt_out.
[web2py] Re: parse_as_rest, multiple fields to select
Sounds great! In my opinion it would be very useful feature. W dniu sobota, 11 stycznia 2014 21:54:54 UTC+1 użytkownik Massimo Di Pierro napisał: No but it should be easy to add the ability to do it. I would use the syntax /friend[person]/{person.id}/:field1,field2 Please open a ticket about this. On Saturday, 11 January 2014 12:47:02 UTC-6, Zbigniew Pomianowski wrote: Is it possible to use *parse_as_rest* function and select only particular fields? I have quite big tables with many columns. From most of them I need to get only *id* and corresponding *name*. Whole rows I need only from time to time. In docs there is something like this: /friend[person]/{person.id}/:field Is there something like: /friend[person]/{person.id}/:field1:field2 -- 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/groups/opt_out.
[web2py] Re: How to use a bootstrap button group as radio buttons in a custom form
Thanks Alan - I'm still trying to get the intended result: Bootstrap buttons that function like radio buttons. I studied fields being brought in as normal radios, and like you suggested added the names: div id=thetable_thefield name=thefield class=btn-group data-toggle=buttons-radio input type=radio name=thefield value=first class=btn btn-primary radio/input input type=radio name=thefield value=second class=btn btn-primary radio/input /div which DOES work until you change the type to button: div id=thetable_thefield name=thefield class=btn-group data-toggle=buttons-radio input type=button name=thefield value=first class=btn btn-primary radio/input input type=button name=thefield value=second class=btn btn-primary radio/input /div at which point the value is NOT passed in the form. Is there a simple way to copy/tweak the radio widget, or convince it to act the same for a type=button? I'm afraid creating a new widget from scratch is a bit beyond my web2py skills, at least from what I've read in the manualhttp://web2py.com/books/default/chapter/29/07#Widgets ... thank you for your help, Dave On Sunday, January 12, 2014 4:41:14 AM UTC-5, Alan Etkin wrote: hoping someone can point me in the right direction, as the post title says I want to use a btn-group Try using name=opt for the input element. However, it would be better to use a custom widget. http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#Widgets -- 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/groups/opt_out.
[web2py] Re: How to use a bootstrap button group as radio buttons in a custom form
Thanks Alan - I'm still trying to get the intended result: Bootstrap buttons that function like radio buttons. I studied fields being brought in as normal radios Have you tried setting name=opt for this input instead (leaving the options with their original attributes)? input type=hidden name=opt value=new_game / -- 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/groups/opt_out.
[web2py] REF: Web2py database issue
I have two web2py apps, one updates database the other app should just read. But i want the readonly app to have its own db to ready from with selected tables from the main db. Whats the best way to replicate selected tables and monitor changes to main db. Secondly what would be the configuration of web2py operate in readonly mode? -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- 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/groups/opt_out.
[web2py] rocket-server and --interface
What I want to have: A website, which could be accessed by the https-protocoll (for the administration) and by the http-protokoll (as service for some ip-phones). I have tried: - nohup /usr/local/bin/python2.7 web2py.py -a 123456 --interface xx.xx.xx.xx:8008:server.key:server.crt - nohup /usr/local/bin/python2.7 web2py.py -a 123456 --interface xx.xx.xx.xx:8009 Both works fine. But - nohup /usr/local/bin/python2.7 web2py.py -a 123456 --interface xx.xx.xx.xx:8008:server.key:server.crt;xx.xx.xx.xx:8009 works only with https and reports an error xx.xx.xx.xx:8009 command not found The opposite is - nohup /usr/local/bin/python2.7 web2py.py -a 123456 --xx.xx.xx.xx:8009; xx.xx.xx.xx:8008:server.key:server.crt Now: the http-protocol is ok. It seem to be the same problemas as in this posting: https://groups.google.com/forum/#!msg/web2py/l-1mVlw9efc/HnNXOqaNPocJ Any ideas? Regards, Martin -- 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/groups/opt_out.
[web2py] Re: Suggestions required for Sorting GRID
You can do something like: results = results.sort(lambda row: row.first_name) On Sunday, 12 January 2014 22:21:03 UTC-6, Sarbjit wrote: As per suggestions from this post.https://groups.google.com/forum/#!searchin/web2py/passing$20query$20controller/web2py/meeqqMTozrQ/o_kIUeKDkZ4JI have solved the problem to view the grid results in a different controller by storing the grid results in a session and in the second controller, I am retrieving the results from session and displaying them. *PROBLEM :-* With this implantation, I am having problem using sort method on grid results header. On using sort, I get the following URL : /test/default/search?keywords=order=testdb.testname_signature=. @auth.requires_login() def search(): form,results = dynamic_search(db.testdb) if form.process().accepted: session.results = results redirect(URL('results')) return dict(form=form,results=results) @auth.requires_login() def results(): results = session.results return dict(results=results) So my controller, starts showing all the records and search query results are lost. Is there a way I can sort the grid results stored in the session. So, I am planning to parse the URL and based on the order specified in the URL, I can sort the results. Other solution could be to use orderby while retrieving the results from GRID. But I feel that if I recompute the results from GRID, my selection in the dynamic form (used to build query) would be lost and it will again end up showing all the results. Please let me know what is the efficient way to handle this? -- 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/groups/opt_out.
[web2py] Crash on SQLFORM submission
I'm having a problem that I can't get to the bottom of. The crash happens when a user submits an automatically generated SQLFORM. Here is the traceback from the ticket: File /home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/html.py, line 2189, in process self.validate(**kwargs) File /home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/html.py, line 2128, in validate if self.accepts(**kwargs): File /home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/sqlhtml.py, line 1571, in accepts self.vars.id = self.table.insert(**fields) File /home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/dal.py, line 8598, in insert ret = self._db._adapter.insert(self, self._listify(fields)) File /home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/dal.py, line 1210, in insert raise e DataError: integer out of range Here is the table: db.define_table('user_demographics', Field('sex', type='string', length=8), Field('year_of_birth', type='integer'), Field('country', type='string', length=25), Field('therapist_1', type='string', length=5), Field('therapist_2', type='string', length=5), Field('medication', type='string', length=5), Field('find_out', type='string'), Field('find_out_2', type='text', length=1000),) and here is the code: @auth.requires_login() def user_main(): user_form = SQLFORM(db.user_demographics) if user_form.process().accepted: redirect(URL(r=request, c='social_anxiety', f='page', vars=dict( page_id=next_page_id))) elif user_form.errors: response.flash = 'Please take a look at your answers' Some notes that might be relevant: - There is only one user who has this problem (thousands of other users have used the system successfully). However, they have it *consistently*. Furthermore, this is just one example - they have problems with any form with text/string input. - *I can't reproduce the error*. e.g. If I try to put in a really small/large integer for the year, it is always handled gracefully. If I disable JavaScript, the validator still comes back with useful error messages. - The user is in a non-English country Based on this, I do not think the problem is the input, but something specific to this particular user's system (OS + browser). Any ideas on how I might reproduce this? I'm stumped. To make matters worse, I have very limited opportunity to debug with the user's assistance. Thanks Neil -- 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/groups/opt_out.
Re: [web2py] rocket-server and --interface
On 13 Jan 2014, at 5:28 AM, Martin Weissenboeck mweis...@gmail.com wrote: What I want to have: A website, which could be accessed by the https-protocoll (for the administration) and by the http-protokoll (as service for some ip-phones). I have tried: nohup /usr/local/bin/python2.7 web2py.py -a 123456 --interface xx.xx.xx.xx:8008:server.key:server.crt nohup /usr/local/bin/python2.7 web2py.py -a 123456 --interface xx.xx.xx.xx:8009 Both works fine. But nohup /usr/local/bin/python2.7 web2py.py -a 123456 --interface xx.xx.xx.xx:8008:server.key:server.crt;xx.xx.xx.xx:8009 works only with https and reports an error xx.xx.xx.xx:8009 command not found You need to quote or escape the semicolon. The opposite is nohup /usr/local/bin/python2.7 web2py.py -a 123456 --xx.xx.xx.xx:8009; xx.xx.xx.xx:8008:server.key:server.crt Now: the http-protocol is ok. It seem to be the same problemas as in this posting: https://groups.google.com/forum/#!msg/web2py/l-1mVlw9efc/HnNXOqaNPocJ -- 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/groups/opt_out.
[web2py] Re: keepvalues - need help with this
Have you tried replacing value={{=form.custom.inpval['country']}} with value={{=form.custom.dspval['country']}} On Sunday, 12 January 2014 22:50:43 UTC-6, subbaram...@gmail.com wrote: Really would like some help with this. Anyone have suggestions? Thank you, Kiran On Saturday, January 11, 2014 12:10:07 AM UTC+5:30, subbaram...@gmail.comwrote: Hello All, The *design *is: I have a custom form with the a controller that inserts/updates a table. Tthe form accepts data, and on successful submission of this form, it stays on the same page (there are no redirects to another page or form) *Issue*: The problem am seeing is, when I update values in the form, and submit it, the entered values are lost when the form returns because of successful submit, or due to errors. I have tried to use keepvalues=True in the form.accepts() and form.process() methods. No luck. Details below. Since the page am building has specific design needs, I went with the option of a custom form, where I used the form.custom.* options quite a bit. Therefore input fields in the form look like this input type=text class=form-control {{if form.errors.country:}}invalidinput{{pass}} id=country name=country value={{=form.custom.inpval['country']}} placeholder={{=form.custom.comment['country']}} Also the controller is coded as below x = db(db.x.x_id == auth.user.id).select().first() if x: form = SQLFORM(db.x, record=x) else: form = SQLFORM(db.x) pass # process the form if form.accepts(request.vars, formname='basicinfo_form', keepvalues= True): response.flash = 'Basic Information updated successfully.' elif form.errors: response.flash = 'The submitted form contains errors. The fields in error are highlighted below.' else: response.flash = 'Please fill the form.' pass return dict(form=form) I was thinking that maybe I should capture the request.vars and send it back to the view alongwith the form. If the request.vars.country value exists, then I use that, instead of the form.custom.inpval['country']. This only makes the view code a bit more verbose, but if it solves the problem, then nothing like it. Can anyone suggest what I could do to sort this out? Thank you, Kiran P.S: I did take a look at all the conversations in the forum about keepvalues. None of them seemed to help me. Though I did find this one to be interesting and am curious if this is sorted out already: https://groups.google.com/forum/#!searchin/web2py/keepvalues$20on$20validate/web2py/MNEYo96Shzg/jjKZaMmfAgQJ -- 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/groups/opt_out.
[web2py] Re: Crash on SQLFORM submission
DataError is not a web2py or a python error. It is an error from the driver. I suspect you have an integer field which you changed to string. Web2py knows about the change but the database does not and refuses to store a string in it. Delete everything under databases. You will lose data but you will have a clean migration. On Monday, 13 January 2014 08:09:29 UTC-6, Neil wrote: I'm having a problem that I can't get to the bottom of. The crash happens when a user submits an automatically generated SQLFORM. Here is the traceback from the ticket: File /home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/html.py, line 2189, in process self.validate(**kwargs) File /home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/html.py, line 2128, in validate if self.accepts(**kwargs): File /home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/sqlhtml.py, line 1571, in accepts self.vars.id = self.table.insert(**fields) File /home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/dal.py, line 8598, in insert ret = self._db._adapter.insert(self, self._listify(fields)) File /home/aicbt/webapps/alternate_config/web2py2.5.1/gluon/dal.py, line 1210, in insert raise e DataError: integer out of range Here is the table: db.define_table('user_demographics', Field('sex', type='string', length=8), Field('year_of_birth', type='integer'), Field('country', type='string', length=25), Field('therapist_1', type='string', length=5), Field('therapist_2', type='string', length=5), Field('medication', type='string', length=5), Field('find_out', type='string'), Field('find_out_2', type='text', length=1000),) and here is the code: @auth.requires_login() def user_main(): user_form = SQLFORM(db.user_demographics) if user_form.process().accepted: redirect(URL(r=request, c='social_anxiety', f='page', vars=dict( page_id=next_page_id))) elif user_form.errors: response.flash = 'Please take a look at your answers' Some notes that might be relevant: - There is only one user who has this problem (thousands of other users have used the system successfully). However, they have it *consistently*. Furthermore, this is just one example - they have problems with any form with text/string input. - *I can't reproduce the error*. e.g. If I try to put in a really small/large integer for the year, it is always handled gracefully. If I disable JavaScript, the validator still comes back with useful error messages. - The user is in a non-English country Based on this, I do not think the problem is the input, but something specific to this particular user's system (OS + browser). Any ideas on how I might reproduce this? I'm stumped. To make matters worse, I have very limited opportunity to debug with the user's assistance. Thanks Neil -- 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/groups/opt_out.
Re: [web2py] rocket-server and --interface
On 13 Jan 2014, at 6:10 AM, Jonathan Lundell jlund...@pobox.com wrote: On 13 Jan 2014, at 5:28 AM, Martin Weissenboeck mweis...@gmail.com wrote: What I want to have: A website, which could be accessed by the https-protocoll (for the administration) and by the http-protokoll (as service for some ip-phones). I have tried: • nohup /usr/local/bin/python2.7 web2py.py -a 123456 --interface xx.xx.xx.xx:8008:server.key:server.crt • nohup /usr/local/bin/python2.7 web2py.py -a 123456 --interface xx.xx.xx.xx:8009 Both works fine. But • nohup /usr/local/bin/python2.7 web2py.py -a 123456 --interface xx.xx.xx.xx:8008:server.key:server.crt;xx.xx.xx.xx:8009 works only with https and reports an error xx.xx.xx.xx:8009 command not found You need to quote or escape the semicolon. For example: nohup /usr/local/bin/python2.7 web2py.py -a 123456 --interface xx.xx.xx.xx:8008:server.key:server.crt;xx.xx.xx.xx:8009 or: nohup /usr/local/bin/python2.7 web2py.py -a 123456 --interface xx.xx.xx.xx:8008:server.key:server.crt\;xx.xx.xx.xx:8009 I'm assuming that your command is otherwise correct (that is, I haven't looked at how the --interface option is parsed internally). The opposite is • nohup /usr/local/bin/python2.7 web2py.py -a 123456 --xx.xx.xx.xx:8009; xx.xx.xx.xx:8008:server.key:server.crt Now: the http-protocol is ok. It seem to be the same problemas as in this posting: https://groups.google.com/forum/#!msg/web2py/l-1mVlw9efc/HnNXOqaNPocJ -- 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/groups/opt_out.
Re: [web2py] Re: request.uri_language
Thanks Alan, Jonathan. I've test more this simple solution: routers = dict( BASE = dict(default_application=' test'), test = dict(languages=['en', 'it'], default_language='it'), ) And it works fine for me. The only problem I have now if for switching between two languages reloading the current function. If fact if I switch with (in my menu): {{response.menu.append(('IT', False, URL('it', 'index'), [('EN', False, URL('en', 'index'), [])]))}} It works fine. If I try with request.function, request.function give me the language + the function: {{response.menu.append(('IT', False, URL('it', request.function), [('EN', False, URL('en', request.function), [])]))}} So if I have mydomain.com/it and I ask for english, web2py tries to load mydomain.com/it/en . KO. Is there an elegant way to avoid this problem of do I have to play with a session variable ? Regards. Il giorno domenica 12 gennaio 2014 17:35:22 UTC+1, Jonathan Lundell ha scritto: On 12 Jan 2014, at 8:27 AM, Alan Etkin spam...@gmail.com javascript: wrote: I've got this server error: 200 Error My bad, unless you have specified the name or it is available in that scope, using app, test or whatever would raise a NameError. Perhaps it can be solved using a string (test) for the dictionary key. routers = { test: dict( default_language = possible_languages['default'][0], ... Alan is right; I was misreading the containing dict. -- 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/groups/opt_out.
Re: [web2py] Re: request.uri_language
On 13 Jan 2014, at 7:00 AM, Gael Princivalle gaelprinciva...@gmail.com wrote: Thanks Alan, Jonathan. I've test more this simple solution: routers = dict( BASE = dict(default_application=' test'), test = dict(languages=['en', 'it'], default_language='it'), ) And it works fine for me. The only problem I have now if for switching between two languages reloading the current function. If fact if I switch with (in my menu): {{response.menu.append(('IT', False, URL('it', 'index'), [('EN', False, URL('en', 'index'), [])]))}} It works fine. If I try with request.function, request.function give me the language + the function: {{response.menu.append(('IT', False, URL('it', request.function), [('EN', False, URL('en', request.function), [])]))}} So if I have mydomain.com/it and I ask for english, web2py tries to load mydomain.com/it/en . KO. Is there an elegant way to avoid this problem of do I have to play with a session variable ? There's apparently a deficiency in URL that makes this difficult for you. URL gets the language to insert into the outgoing URL from request.uri_language, and has no language argument to override it. That could and should be fixed. In the meantime, here's a hack you could use (not tested). It needs to be converted to template format, but you'll get the idea. uri_language = request.uri_language urls = {} for lang in ('it', 'en'): request.uri_language = lang urls[lang] = URL(request.function) request.uri_language = uri_language {{response.menu.append(('IT', False, urls['it'], [('EN', False, urls['en'], [])]))}} -- 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/groups/opt_out.
Re: [web2py] Re: request.uri_language
That's a good solution, thanks. In the meantime I've found that you have to specify with C=...the controller and f=... the functiuon in the URL helper. That like that it works fine: {{response.menu.append(('IT', False, URL('it', f=request.function), [('EN', False, URL('en', f=request.function), [])]))}} Thanks again for your help. Il giorno lunedì 13 gennaio 2014 16:22:50 UTC+1, Jonathan Lundell ha scritto: On 13 Jan 2014, at 7:00 AM, Gael Princivalle gaelpri...@gmail.comjavascript: wrote: Thanks Alan, Jonathan. I've test more this simple solution: routers = dict( BASE = dict(default_application=' test'), test = dict(languages=['en', 'it'], default_language='it'), ) And it works fine for me. The only problem I have now if for switching between two languages reloading the current function. If fact if I switch with (in my menu): {{response.menu.append(('IT', False, URL('it', 'index'), [('EN', False, URL('en', 'index'), [])]))}} It works fine. If I try with request.function, request.function give me the language + the function: {{response.menu.append(('IT', False, URL('it', request.function), [('EN', False, URL('en', request.function), [])]))}} So if I have mydomain.com/it and I ask for english, web2py tries to load mydomain.com/it/en . KO. Is there an elegant way to avoid this problem of do I have to play with a session variable ? There's apparently a deficiency in URL that makes this difficult for you. URL gets the language to insert into the outgoing URL from request.uri_language, and has no language argument to override it. That could and should be fixed. In the meantime, here's a hack you could use (not tested). It needs to be converted to template format, but you'll get the idea. uri_language = request.uri_language urls = {} for lang in ('it', 'en'): request.uri_language = lang urls[lang] = URL(request.function) request.uri_language = uri_language {{response.menu.append(('IT', False, urls['it'], [('EN', False, urls['en'], [])]))}} -- 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/groups/opt_out.
Re: [web2py] Re: request.uri_language
On 13 Jan 2014, at 7:48 AM, Gael Princivalle gaelprinciva...@gmail.com wrote: That's a good solution, thanks. In the meantime I've found that you have to specify with C=...the controller and f=... the functiuon in the URL helper. That like that it works fine: {{response.menu.append(('IT', False, URL('it', f=request.function), [('EN', False, URL('en', f=request.function), [])]))}} The only problem with that is that the rewrite code for languages wants to treat the language differently from the controller. It might work, but only because the rewrite code is more clever than I remember. Thanks again for your help. Il giorno lunedì 13 gennaio 2014 16:22:50 UTC+1, Jonathan Lundell ha scritto: On 13 Jan 2014, at 7:00 AM, Gael Princivalle gaelpri...@gmail.com wrote: Thanks Alan, Jonathan. I've test more this simple solution: routers = dict( BASE = dict(default_application=' test'), test = dict(languages=['en', 'it'], default_language='it'), ) And it works fine for me. The only problem I have now if for switching between two languages reloading the current function. If fact if I switch with (in my menu): {{response.menu.append(('IT', False, URL('it', 'index'), [('EN', False, URL('en', 'index'), [])]))}} It works fine. If I try with request.function, request.function give me the language + the function: {{response.menu.append(('IT', False, URL('it', request.function), [('EN', False, URL('en', request.function), [])]))}} So if I have mydomain.com/it and I ask for english, web2py tries to load mydomain.com/it/en . KO. Is there an elegant way to avoid this problem of do I have to play with a session variable ? There's apparently a deficiency in URL that makes this difficult for you. URL gets the language to insert into the outgoing URL from request.uri_language, and has no language argument to override it. That could and should be fixed. In the meantime, here's a hack you could use (not tested). It needs to be converted to template format, but you'll get the idea. uri_language = request.uri_language urls = {} for lang in ('it', 'en'): request.uri_language = lang urls[lang] = URL(request.function) request.uri_language = uri_language {{response.menu.append(('IT', False, urls['it'], [('EN', False, urls['en'], [])]))}} -- 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/groups/opt_out.
[web2py] Re: keepvalues - need help with this
Massimo, Yes, I did. Does not make a difference. Thanks for the suggestion, Kiran On Monday, January 13, 2014 7:49:15 PM UTC+5:30, Massimo Di Pierro wrote: Have you tried replacing value={{=form.custom.inpval['country']}} with value={{=form.custom.dspval['country']}} On Sunday, 12 January 2014 22:50:43 UTC-6, subbaram...@gmail.com wrote: Really would like some help with this. Anyone have suggestions? Thank you, Kiran On Saturday, January 11, 2014 12:10:07 AM UTC+5:30, subbaram...@gmail.comwrote: Hello All, The *design *is: I have a custom form with the a controller that inserts/updates a table. Tthe form accepts data, and on successful submission of this form, it stays on the same page (there are no redirects to another page or form) *Issue*: The problem am seeing is, when I update values in the form, and submit it, the entered values are lost when the form returns because of successful submit, or due to errors. I have tried to use keepvalues=True in the form.accepts() and form.process() methods. No luck. Details below. Since the page am building has specific design needs, I went with the option of a custom form, where I used the form.custom.* options quite a bit. Therefore input fields in the form look like this input type=text class=form-control {{if form.errors.country:}}invalidinput{{pass}} id=country name=country value={{=form.custom.inpval['country']}} placeholder={{=form.custom.comment['country']}} Also the controller is coded as below x = db(db.x.x_id == auth.user.id).select().first() if x: form = SQLFORM(db.x, record=x) else: form = SQLFORM(db.x) pass # process the form if form.accepts(request.vars, formname='basicinfo_form', keepvalues= True): response.flash = 'Basic Information updated successfully.' elif form.errors: response.flash = 'The submitted form contains errors. The fields in error are highlighted below.' else: response.flash = 'Please fill the form.' pass return dict(form=form) I was thinking that maybe I should capture the request.vars and send it back to the view alongwith the form. If the request.vars.country value exists, then I use that, instead of the form.custom.inpval['country']. This only makes the view code a bit more verbose, but if it solves the problem, then nothing like it. Can anyone suggest what I could do to sort this out? Thank you, Kiran P.S: I did take a look at all the conversations in the forum about keepvalues. None of them seemed to help me. Though I did find this one to be interesting and am curious if this is sorted out already: https://groups.google.com/forum/#!searchin/web2py/keepvalues$20on$20validate/web2py/MNEYo96Shzg/jjKZaMmfAgQJ -- 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/groups/opt_out.
Re: [web2py] Re: Writing Web2Py specification and finding free lance Web2Py coders
elance.com? On 11 January 2014 23:04, Simon Ashley gregs...@gregsier.com.au wrote: Often thought that it would be good to push this to another level. We have projects from time to time that would be good to outsource, if people were interested. Something like a project post board, with bidders, assignment, monitoring and completion. -- 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/groups/opt_out. -- 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/groups/opt_out.
[web2py] Re: Crash on SQLFORM submission
This doesn't seem to be the case: - I looked at the database, and the types match the definition in the model - I can't see how that would only cause problems for one user out of thousands. Any other things I can check out? On Monday, 13 January 2014 14:21:55 UTC, Massimo Di Pierro wrote: DataError is not a web2py or a python error. It is an error from the driver. I suspect you have an integer field which you changed to string. Web2py knows about the change but the database does not and refuses to store a string in it. Delete everything under databases. You will lose data but you will have a clean migration. -- 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/groups/opt_out.
[web2py] Detecting OS issue
Hello I am trying to figure out how to detect if a computer is running Windows or Macintosh then load the appropriate files and if any other system Linux/Mobile etc then load the other files The reason for this is I am using Google Earth in a project and I want to load Google Maps if it is not available I am trying to do this {{if session._user_agent['os']['name'] == 'Macintosh' or session._user_agent['os']['name'] == 'Windows':}} // do something {{else:}} // do something {{pass}} This however is creating an error if I try on my mobile device. I have not had a chance to test on my Linux system yet. The error returned is: TypeError: 'NoneType' object has no attribute '__getitem__' I am using the current stable release of web2py 2.8.2 (I think is the version number) any suggestions in how I can do what I need? *Cheers -- 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/groups/opt_out.
[web2py] Re: Crash on SQLFORM submission
Figured it out - I was on the wrong track. It was something the user was typing in. There is a field called Year of birth, and the user was typing in date, month, year ?? (e.g. 2909501950). It passed the integer validator, but it is out of range for a postgresql integer. I guess I should implement my own integer validator? Thanks, Neil On Monday, 13 January 2014 18:10:43 UTC, Neil wrote: This doesn't seem to be the case: - I looked at the database, and the types match the definition in the model - I can't see how that would only cause problems for one user out of thousands. Any other things I can check out? On Monday, 13 January 2014 14:21:55 UTC, Massimo Di Pierro wrote: DataError is not a web2py or a python error. It is an error from the driver. I suspect you have an integer field which you changed to string. Web2py knows about the change but the database does not and refuses to store a string in it. Delete everything under databases. You will lose data but you will have a clean migration. -- 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/groups/opt_out.
[web2py] Re: Crash on SQLFORM submission
Have a look at the request vars on the ticket page and see what was actually submitted. That might provide you a clue. On Monday, January 13, 2014 1:10:43 PM UTC-5, Neil wrote: This doesn't seem to be the case: - I looked at the database, and the types match the definition in the model - I can't see how that would only cause problems for one user out of thousands. Any other things I can check out? On Monday, 13 January 2014 14:21:55 UTC, Massimo Di Pierro wrote: DataError is not a web2py or a python error. It is an error from the driver. I suspect you have an integer field which you changed to string. Web2py knows about the change but the database does not and refuses to store a string in it. Delete everything under databases. You will lose data but you will have a clean migration. -- 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/groups/opt_out.
[web2py] Re: iframe without iframe
Have a look at jQuery.load() http://api.jquery.com/load/ You should be able to do something like $( '#element').load( //web2py/a/f/c/view.html ); On Sunday, January 12, 2014 6:30:40 PM UTC-5, Kenneth wrote: Hello, is there a way of integration data from an web2py site into an other sites. Like many integrates Tvitter Tweedk onto theur website. I't like to use web2py to create a small page that is shown on another website, like iframe but without iframes. Any ideas for this? Kenneth -- 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/groups/opt_out.
Re: [web2py] REF: Web2py database issue
web2py readonly : You implement select only in your app function everywhere : db().select() SQLFORM(..., readonly=True) SQLFORM.grid(..., deletable=False, editable=False, create=Flase, details=True, selectable=True) Replication : An audit trail on your table that received the new data should be what you want? :)# Richard On Mon, Jan 13, 2014 at 7:12 AM, Teddy Nyambe software@gmail.comwrote: I have two web2py apps, one updates database the other app should just read. But i want the readonly app to have its own db to ready from with selected tables from the main db. Whats the best way to replicate selected tables and monitor changes to main db. Secondly what would be the configuration of web2py operate in readonly mode? -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- 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/groups/opt_out. -- 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/groups/opt_out.
Re: [web2py] REF: Web2py database issue
Also, set DAL(..., migrate_enabled=False) to prevent migrations. Anthony On Monday, January 13, 2014 2:35:40 PM UTC-5, Richard wrote: web2py readonly : You implement select only in your app function everywhere : db().select() SQLFORM(..., readonly=True) SQLFORM.grid(..., deletable=False, editable=False, create=Flase, details=True, selectable=True) Replication : An audit trail on your table that received the new data should be what you want? :)# Richard On Mon, Jan 13, 2014 at 7:12 AM, Teddy Nyambe softwa...@gmail.comjavascript: wrote: I have two web2py apps, one updates database the other app should just read. But i want the readonly app to have its own db to ready from with selected tables from the main db. Whats the best way to replicate selected tables and monitor changes to main db. Secondly what would be the configuration of web2py operate in readonly mode? -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- 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 javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- 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/groups/opt_out.
[web2py] linux shell scripts and web2py
Hi I consider use web2py but I have one question. I have big linux application built from many linux shell scripts and I would like to run it under web2py, but I dont know it is possible. Generally I want to use web2py/html/jquery as grapfic interface to that all scripts. Is any inner function or other simple way ( CGI ? ) to do it ? Regards Adam -- 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/groups/opt_out.
[web2py] Re: keepvalues - need help with this
Strange. How about {{=request.vars.country or form.custom.inpval['country']}} On Monday, 13 January 2014 11:13:33 UTC-6, subbaram...@gmail.com wrote: Massimo, Yes, I did. Does not make a difference. Thanks for the suggestion, Kiran On Monday, January 13, 2014 7:49:15 PM UTC+5:30, Massimo Di Pierro wrote: Have you tried replacing value={{=form.custom.inpval['country']}} with value={{=form.custom.dspval['country']}} On Sunday, 12 January 2014 22:50:43 UTC-6, subbaram...@gmail.com wrote: Really would like some help with this. Anyone have suggestions? Thank you, Kiran On Saturday, January 11, 2014 12:10:07 AM UTC+5:30, subbaram...@gmail.com wrote: Hello All, The *design *is: I have a custom form with the a controller that inserts/updates a table. Tthe form accepts data, and on successful submission of this form, it stays on the same page (there are no redirects to another page or form) *Issue*: The problem am seeing is, when I update values in the form, and submit it, the entered values are lost when the form returns because of successful submit, or due to errors. I have tried to use keepvalues=True in the form.accepts() and form.process() methods. No luck. Details below. Since the page am building has specific design needs, I went with the option of a custom form, where I used the form.custom.* options quite a bit. Therefore input fields in the form look like this input type=text class=form-control {{if form.errors.country:}}invalidinput{{pass}} id=country name=country value={{=form.custom.inpval['country']}} placeholder={{=form.custom.comment['country']}} Also the controller is coded as below x = db(db.x.x_id == auth.user.id).select().first() if x: form = SQLFORM(db.x, record=x) else: form = SQLFORM(db.x) pass # process the form if form.accepts(request.vars, formname='basicinfo_form', keepvalues =True): response.flash = 'Basic Information updated successfully.' elif form.errors: response.flash = 'The submitted form contains errors. The fields in error are highlighted below.' else: response.flash = 'Please fill the form.' pass return dict(form=form) I was thinking that maybe I should capture the request.vars and send it back to the view alongwith the form. If the request.vars.country value exists, then I use that, instead of the form.custom.inpval['country']. This only makes the view code a bit more verbose, but if it solves the problem, then nothing like it. Can anyone suggest what I could do to sort this out? Thank you, Kiran P.S: I did take a look at all the conversations in the forum about keepvalues. None of them seemed to help me. Though I did find this one to be interesting and am curious if this is sorted out already: https://groups.google.com/forum/#!searchin/web2py/keepvalues$20on$20validate/web2py/MNEYo96Shzg/jjKZaMmfAgQJ -- 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/groups/opt_out.
[web2py] Re: Crash on SQLFORM submission
look at is_int_in_range()... http://web2py.com/examples/static/epydoc/web2py.gluon.validators.IS_INT_IN_RANGE-class.html Also, don't store years as ints. Database basics, man. On Monday, January 13, 2014 11:30:12 AM UTC-7, Neil wrote: Figured it out - I was on the wrong track. It was something the user was typing in. There is a field called Year of birth, and the user was typing in date, month, year ?? (e.g. 2909501950). It passed the integer validator, but it is out of range for a postgresql integer. I guess I should implement my own integer validator? Thanks, Neil On Monday, 13 January 2014 18:10:43 UTC, Neil wrote: This doesn't seem to be the case: - I looked at the database, and the types match the definition in the model - I can't see how that would only cause problems for one user out of thousands. Any other things I can check out? On Monday, 13 January 2014 14:21:55 UTC, Massimo Di Pierro wrote: DataError is not a web2py or a python error. It is an error from the driver. I suspect you have an integer field which you changed to string. Web2py knows about the change but the database does not and refuses to store a string in it. Delete everything under databases. You will lose data but you will have a clean migration. -- 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/groups/opt_out.
Re: [web2py] linux shell scripts and web2py
It's surely possible... Don't know the complexity of you shell script, but I would suggest to pick some of the simple one and try to implement them in web2py directly... Maybe Fabric could be of some interest for you since it a pretty nice gateway to shell script from python... Richard On Mon, Jan 13, 2014 at 2:51 PM, Adam Detektyw adambo...@gmail.com wrote: Hi I consider use web2py but I have one question. I have big linux application built from many linux shell scripts and I would like to run it under web2py, but I dont know it is possible. Generally I want to use web2py/html/jquery as grapfic interface to that all scripts. Is any inner function or other simple way ( CGI ? ) to do it ? Regards Adam -- 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/groups/opt_out. -- 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/groups/opt_out.
[web2py] Re: Detecting OS issue
Have a look at python's platform module. For example: import platform if platform.system() == 'Windows': elif platform.system() == 'Linux': On Tuesday, January 14, 2014 7:26:09 AM UTC+13, Jon Smith wrote: Hello I am trying to figure out how to detect if a computer is running Windows or Macintosh then load the appropriate files and if any other system Linux/Mobile etc then load the other files The reason for this is I am using Google Earth in a project and I want to load Google Maps if it is not available I am trying to do this {{if session._user_agent['os']['name'] == 'Macintosh' or session._user_agent['os']['name'] == 'Windows':}} // do something {{else:}} // do something {{pass}} This however is creating an error if I try on my mobile device. I have not had a chance to test on my Linux system yet. The error returned is: TypeError: 'NoneType' object has no attribute '__getitem__' I am using the current stable release of web2py 2.8.2 (I think is the version number) any suggestions in how I can do what I need? *Cheers -- 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/groups/opt_out.
[web2py] Re: Detecting OS issue
that's going to tell if the SERVER is win,linux or mac @john. start small. embed {{=BEAUTIFY(request.user_agent())}} in your view and start from there to see what's the missing key you're trying to inspect. On Monday, January 13, 2014 9:12:24 PM UTC+1, Limedrop wrote: Have a look at python's platform module. For example: import platform if platform.system() == 'Windows': elif platform.system() == 'Linux': On Tuesday, January 14, 2014 7:26:09 AM UTC+13, Jon Smith wrote: Hello I am trying to figure out how to detect if a computer is running Windows or Macintosh then load the appropriate files and if any other system Linux/Mobile etc then load the other files The reason for this is I am using Google Earth in a project and I want to load Google Maps if it is not available I am trying to do this {{if session._user_agent['os']['name'] == 'Macintosh' or session._user_agent['os']['name'] == 'Windows':}} // do something {{else:}} // do something {{pass}} This however is creating an error if I try on my mobile device. I have not had a chance to test on my Linux system yet. The error returned is: TypeError: 'NoneType' object has no attribute '__getitem__' I am using the current stable release of web2py 2.8.2 (I think is the version number) any suggestions in how I can do what I need? *Cheers -- 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/groups/opt_out.
[web2py] Does migration from a 'string' field to a 'list:string' field preserve data?
Does a migration from a 'string' field to a 'list:string' field preserve string data that is already in the database and convert it to the format required by list:string? -- 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/groups/opt_out.
[web2py] Pygal
I am trying to use http://pygal.org/ with my web2py. But I can't import paygal. Since I am new to python programing I've got lost. I've tried easy_install pygal in shell, like from this example http://www.web2pyslices.com/slice/show/1634/beauty-graphics-and-charts-with-pygal but it does not work for me. Can someone please lead me through process of adding module to web2py -- 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/groups/opt_out.
Re: [web2py] Pygal
Maybe you can try this [1] to import pygal. With this example, you need to generate a SVG file and after, show in the page [2]. [1] - http://pygal.org/first_steps/ [2] - http://edutechwiki.unige.ch/en/Using_SVG_with_HTML5_tutorial#Embeding_SVG_in_HTML_5_with_the_src_tag Cheers, 2014/1/13 Janko Strusa janko.str...@gmail.com: I am trying to use http://pygal.org/ with my web2py. But I can't import paygal. Since I am new to python programing I've got lost. I've tried easy_install pygal in shell, like from this example http://www.web2pyslices.com/slice/show/1634/beauty-graphics-and-charts-with-pygal but it does not work for me. Can someone please lead me through process of adding module to web2py -- 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/groups/opt_out. -- 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/groups/opt_out.
Re: [web2py] Re: Writing Web2Py specification and finding free lance Web2Py coders
Yep but more community based and focused. W2p is still just a small subset of the hire a contractor market. Elements could be open sourced and used by the wider community as slices. Maybe bounties/ rewards/ competitions to push applications that are currently thought bubbles (albeit mature ones) such as d3/dc.js wrappers, angular.js integration into one page w2py sites, w2py front ends to pacioli. Just floating the idea for comments etc On Tuesday, January 14, 2014 3:58:05 AM UTC+10, Calvin Morrison wrote: elance.com? -- 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/groups/opt_out.
[web2py] Compile app from command line
Hello everyone, I'm compiling my local apps with this command: python -c import gluon.compileapp; gluon.compileapp.compile_application('applications/myapp') And everything is working well. But when I try to do the same thing in the server (as admin), in the production environment I get this error: Traceback (most recent call last): File string, line 1, in ? File gluon/__init__.py, line 15, in ? from globals import current File gluon/globals.py, line 17, in ? from storage import Storage, List File gluon/storage.py, line 73 return value if not value else \ ^ SyntaxError: invalid syntax I know it doesn't give too much information so I'm lost. Without compiling my app works well so I guess the web2py environment is well installed. Anyone has any clue of what is it happening? On the other hand, really is there a difference in performance bewtween a compiled app and a non compiled app? I don't notice a great difference when I use my app compiled. Kind regards and thank you 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/groups/opt_out.
Re: [web2py] Compile app from command line
On Mon, Jan 13, 2014 at 11:08 PM, Wonton rferb...@gmail.com wrote: Hello everyone, I'm compiling my local apps with this command: python -c import gluon.compileapp; gluon.compileapp.compile_application('applications/myapp') And everything is working well. But when I try to do the same thing in the server (as admin), in the production environment I get this error: Traceback (most recent call last): File string, line 1, in ? File gluon/__init__.py, line 15, in ? from globals import current File gluon/globals.py, line 17, in ? from storage import Storage, List File gluon/storage.py, line 73 return value if not value else \ ^ SyntaxError: invalid syntax Probably a python version mismatch. What python version do you have when run it from the shell? Can be checked with: $ python -c import sys;print sys.version Ricardo -- 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/groups/opt_out.
[web2py] Re: Does migration from a 'string' field to a 'list:string' field preserve data?
I just test this with a simple app using SQLite database and it seems that it doesn't quite work. It appears it will truncate the string data that exists in the string field. Specifically it will remove the first and last character of whatever is in the string field. For example: hello - ell something - omthin world - orl Migration back from list:string to string will preserve the existing list:string data in the web2py representation: hello, world - |hello|world| one, two - |one|two| On Monday, January 13, 2014 3:34:47 PM UTC-5, User wrote: Does a migration from a 'string' field to a 'list:string' field preserve string data that is already in the database and convert it to the format required by list:string? -- 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/groups/opt_out.
Re: [web2py] Compile app from command line
That must be the problem. Both versions are very different. My local version is 2.7.5 (default, Aug 25 2013, 00:04:04) and the server version is 2.4.3 (#1, Jun 18 2012, 08:55:23). I will try to update the server versionand see what happens. Thank you very much Ricardo! On Tuesday, January 14, 2014 12:52:02 AM UTC+1, Ricardo Pedroso wrote: On Mon, Jan 13, 2014 at 11:08 PM, Wonton rfer...@gmail.com javascript: wrote: Hello everyone, I'm compiling my local apps with this command: python -c import gluon.compileapp; gluon.compileapp.compile_application('applications/myapp') And everything is working well. But when I try to do the same thing in the server (as admin), in the production environment I get this error: Traceback (most recent call last): File string, line 1, in ? File gluon/__init__.py, line 15, in ? from globals import current File gluon/globals.py, line 17, in ? from storage import Storage, List File gluon/storage.py, line 73 return value if not value else \ ^ SyntaxError: invalid syntax Probably a python version mismatch. What python version do you have when run it from the shell? Can be checked with: $ python -c import sys;print sys.version Ricardo -- 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/groups/opt_out.
Re: [web2py] LDAP Auth
Hi Richard, Thank you for your reply. I have since made this work for my purposes by modifying the framework. Thanks, Maeghan On Friday, December 20, 2013 6:43:35 AM UTC-8, Richard wrote: Could you show your mods? It could help to understand the issue you have how we can solve them... Richard On Thu, Dec 19, 2013 at 7:30 PM, Maggs maggs.c...@gmail.com javascript: wrote: Yes secure ldap is causing a lot of problems. I hope it gets sorted out eventually. For now I'm having to modify the framework for my needs. On Wednesday, November 27, 2013 7:18:45 AM UTC-8, Richard wrote: ldap_auth need care, to me it's a draft that need code review, but it works... I had many issue when I deploy ldap_auth with AD... But I didn't have time to work further on these issues, we figure it out what was the bottom of them, but refatoring ldap_auth need time and the most important tests... Richard On Tue, Nov 26, 2013 at 8:12 PM, Maggs maggs.c...@gmail.com wrote: I am in this situation where my team is in the process of migrating our ldap servers to the vpc and as a result I must update my applications to use secure ldap. I have unfortunately run into an issue with ldap_auth where it will use secure ldap but it only takes a ca cert file, but I need to use ca cert, cert and key files all together. This is possible directly through python-ldap like so: con.set_option(ldap.OPT_X_TLS_CACERTFILE, cacert_file) con.set_option(ldap.OPT_X_TLS_CERTFILE, cert_file) con.set_option(ldap.OPT_X_TLS_KEYFILE, key_file) but doesn't appear to be an option at all through the ldap_auth wrapper provided through web2py. I am having to modify this code manually to make this work. I'm just curious why these 2 other files aren't options and the ca cert is the only option? 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+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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 javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- 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/groups/opt_out.
[web2py] LDAP Auth
Hi all, I am running web2py 2.5.1 and have my auth set up to use secure ldap. Since switching from regular to secure ldap, I've noticed that web2py no longer saves the passwords of any newly added accounts to the db. Though I understand the reason for this since it's secure and all, I do actually need the passwords to be saved here. Is there a way to turn this on manually? I have done a whole lot of googling and reading through documentation to no avail. Apparently I'm the only person to ever want to do such a thing. Thanks, Maeghan -- 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/groups/opt_out.
Re: [web2py] REF: Web2py database issue
Brilliant, am using mural db...have found an inbuilt replication feature in mysql. So will try out the dam(..., migrate_enabled=False) feature for read only. And of course will use only select statements in the read only app. Thanx On 13 Jan 2014 21:42, Anthony abasta...@gmail.com wrote: Also, set DAL(..., migrate_enabled=False) to prevent migrations. Anthony On Monday, January 13, 2014 2:35:40 PM UTC-5, Richard wrote: web2py readonly : You implement select only in your app function everywhere : db().select() SQLFORM(..., readonly=True) SQLFORM.grid(..., deletable=False, editable=False, create=Flase, details=True, selectable=True) Replication : An audit trail on your table that received the new data should be what you want? :)# Richard On Mon, Jan 13, 2014 at 7:12 AM, Teddy Nyambe softwa...@gmail.comwrote: I have two web2py apps, one updates database the other app should just read. But i want the readonly app to have its own db to ready from with selected tables from the main db. Whats the best way to replicate selected tables and monitor changes to main db. Secondly what would be the configuration of web2py operate in readonly mode? -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- 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/groups/opt_out. -- 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/groups/opt_out. -- 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/groups/opt_out.
[web2py] Storing lots of txt files: Database or Filesystem? Advantages/Disadvantages
- The files will not be larger than say 200kb, but there will be lots of them(1000's). - Users will need to download the original file. - The files will be parsed on the initial upload, but I don't expect to touch the files much after that. - The files will have sensitive info and will need to be encrypted while being stored. From my research it appears that storing the files to the filesystem is the way to go in this scenario. Am I missing anything here? Are there any other advantages to having the files in the db? -- 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/groups/opt_out.
[web2py] Need a Web2py tutor/mentor.
I don't know anyone who builds webapps with python. I've watched A LOT of videos and read A LOT of posts about web2py. I've got the basics down and have built a couple of basic apps using web2py. I'd like to find a tutor/mentor who could spend a couple of hours with me (skype/google hangout) to point me in the right direction on a few items. I'm willing to pay for your time. Suggestions? -- 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/groups/opt_out.
[web2py] Re: Storing lots of txt files: Database or Filesystem? Advantages/Disadvantages
please check this discussion. https://groups.google.com/forum/#!topic/web2py/t83nQfT24gE 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/groups/opt_out.
Re: [web2py] Compile app from command line
Looking at your python version, you're running a RHEL 5 (or a derivative, such as CentOS). Just a word of caution if you decide to attempt updating the OS python's version - search the net for previous experiences. It's not straightforward, as other important parts of the OS depend on it (ie. yum, etc.). You might want to look into other possibilities, such as using python 2.6 from EPEL repository. This solution also has virtualenv available. Regards On Tuesday, January 14, 2014 1:08:23 AM UTC+1, Wonton wrote: That must be the problem. Both versions are very different. My local version is 2.7.5 (default, Aug 25 2013, 00:04:04) and the server version is 2.4.3 (#1, Jun 18 2012, 08:55:23). I will try to update the server versionand see what happens. Thank you very much Ricardo! On Tuesday, January 14, 2014 12:52:02 AM UTC+1, Ricardo Pedroso wrote: On Mon, Jan 13, 2014 at 11:08 PM, Wonton rfer...@gmail.com wrote: Hello everyone, I'm compiling my local apps with this command: python -c import gluon.compileapp; gluon.compileapp.compile_application('applications/myapp') And everything is working well. But when I try to do the same thing in the server (as admin), in the production environment I get this error: Traceback (most recent call last): File string, line 1, in ? File gluon/__init__.py, line 15, in ? from globals import current File gluon/globals.py, line 17, in ? from storage import Storage, List File gluon/storage.py, line 73 return value if not value else \ ^ SyntaxError: invalid syntax Probably a python version mismatch. What python version do you have when run it from the shell? Can be checked with: $ python -c import sys;print sys.version Ricardo -- 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/groups/opt_out.
[web2py] Re: How to use a bootstrap button group as radio buttons in a custom form
Thanks again Alan, but the name in the original was just an example and in the second post I reverted to actual variables, which is why you see parts... and alas that did not fix it. that said I *think* I have it working, just need to battle through the CSS nightmare that is bootstrap and figure out why the :checked appearance is so lousy, then I will post the working solution here for posterity;) On Monday, January 13, 2014 6:07:03 AM UTC-5, Alan Etkin wrote: Thanks Alan - I'm still trying to get the intended result: Bootstrap buttons that function like radio buttons. I studied fields being brought in as normal radios Have you tried setting name=opt for this input instead (leaving the options with their original attributes)? input type=hidden name=opt value=new_game / -- 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/groups/opt_out.
Re: [web2py] Re: keepvalues - need help with this
Yes, that works: use request.vars.*. That was the option which I had mentioned I may need to resort to, since *keepvalues *doesn't seem to work for me. This basically comes down to me creating a bunch of widgets; mirroring the ones in web2py, where a widget would have logic, similar to the one below, in it. I need to figure out how to create a widget now. Am familiar with creating jsp tag libraries, and dojo widgets. | input type=text class=form-control {{if form.errors.country:}}invalidinput{{pass}} id=country name=country value={{=request.vars.country or form.custom.inpval['country']}} placeholder=|{{=form.custom.comment['country']}} | | Thanks for your inputs, Kiran Kiran Subbaraman http://subbaraman.wordpress.com/about/ On 1/14/2014 1:23 AM, Massimo Di Pierro wrote: Strange. How about {{=request.vars.country or form.custom.inpval['country']}} On Monday, 13 January 2014 11:13:33 UTC-6, subbaram...@gmail.com wrote: Massimo, Yes, I did. Does not make a difference. Thanks for the suggestion, Kiran On Monday, January 13, 2014 7:49:15 PM UTC+5:30, Massimo Di Pierro wrote: Have you tried replacing value={{=form.custom.inpval['country']}} with value={{=form.custom.dspval['country']}} On Sunday, 12 January 2014 22:50:43 UTC-6, subbaram...@gmail.com wrote: Really would like some help with this. Anyone have suggestions? Thank you, Kiran On Saturday, January 11, 2014 12:10:07 AM UTC+5:30, subbaram...@gmail.com wrote: Hello All, The *design *is: I have a custom form with the a controller that inserts/updates a table. Tthe form accepts data, and on successful submission of this form, it stays on the same page (there are no redirects to another page or form) *Issue*: The problem am seeing is, when I update values in the form, and submit it, the entered values are lost when the form returns because of successful submit, or due to errors. I have tried to use keepvalues=True in the form.accepts() and form.process() methods. No luck. Details below. Since the page am building has specific design needs, I went with the option of a custom form, where I used the form.custom.* options quite a bit. Therefore input fields in the form look like this | input type=text class=form-control {{if form.errors.country:}}invalidinput{{pass}} id=country name=country value={{=form.custom.inpval['country']}} placeholder=|{{=form.custom.comment['country']}} | | Also the controller is coded as below | x =db(db.x.x_id ==auth.user.id).select().first() ifx: form =SQLFORM(db.x,record=x) else: form =SQLFORM(db.x) pass # process the form ifform.accepts(request.vars,formname='basicinfo_form',keepvalues=True): response.flash ='Basic Information updated successfully.' elifform.errors: response.flash ='The submitted form contains errors. The fields in error are highlighted below.' else: response.flash ='Please fill the form.' pass returndict(form=form) | I was thinking that maybe I should capture the request.vars and send it back to the view alongwith the form. If the request.vars.country value exists, then I use that, instead of the form.custom.inpval['country']. This only makes the view code a bit more verbose, but if it solves the problem, then nothing like it. Can anyone suggest what I could do to sort this out? Thank you, Kiran P.S: I did take a look at all the conversations in the forum about keepvalues. None of them seemed to help me. Though I did find this one to be interesting and am curious if this is sorted out already: https://groups.google.com/forum/#!searchin/web2py/keepvalues$20on$20validate/web2py/MNEYo96Shzg/jjKZaMmfAgQJ
[web2py] Is there a way to have a field in one table be computed by a field in another table?
In the online doc on computed field, the computed fields uses a field in the current table, and not in another table. I modified the one-to-many example by adding a 'total_items' field on person. If I want 'total_items' to be the sum of all items the person currently has, and this field should be updated when an inserted/deleted 'thing' for this person happens, what should computed be? db.define_table('person', Field('name'), Field('total_items', 'integer', compute=#lamdba r: r.??), # what should go here? format='%(name)s') db.define_table('thing', Field('name'), Field('owner_id', 'reference person'), format='%(name)s') -- 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/groups/opt_out.
[web2py] Re: SQLFORM and IS_IN_SET problem
So I tested the migration feature and string to list:string doesn't work. So we are left with the fact that a list:string field with IS_IN_SET multiple=False will not select the current value in an SQLFORM. Seems kind of like a bug to me, does anyone else think so? On Tuesday, January 7, 2014 8:08:13 PM UTC-5, User wrote: I have the same problem as the original poster. I am only storing a single value as of now but I'm using list:string instead of string so that if I change my mind to allow multiple values it will be easier to transition. Is this a bug that it won't preselect the selected value? Alternatively, does migration from a string field to a list:string field preserve the string data? On Monday, October 10, 2011 7:20:46 PM UTC-4, Anthony wrote: On Monday, October 10, 2011 6:01:49 PM UTC-4, Cliff wrote: Mostly fixed now. There was also a bug in my controller code that was complicating things. One problem remains. With readonly=True, the field still shows the dictionary key rather than the value. With readonly, I guess it's not using the widget, so it will just show the value stored in the field itself. Maybe you can define a represent function for the field so it shows the label associated with the value. Anthony -- 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/groups/opt_out.
[web2py] Re: Does migration from a 'string' field to a 'list:string' field preserve data?
It appears it will leave the string data that exists in the string field alone in the database, however web2py will interpret it such that the first and last character are truncated. For example: hello - ell something - omethin world - orl As soon as you add another list item to the string, then web2py will overwrite the original string's first and last characters with pipe characters in the database in addition to adding the new item. Migration back from list:string to string will preserve whatever list:string data is there (in the web2py representation format). hello, world - |hello|world| one, two - |one|two| Would it make sense for the migration process to handle this more gracefully? On Monday, January 13, 2014 3:34:47 PM UTC-5, User wrote: Does a migration from a 'string' field to a 'list:string' field preserve string data that is already in the database and convert it to the format required by list:string? -- 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/groups/opt_out.
Re: [web2py] Is there a way to have a field in one table be computed by a field in another table?
|compute=#lamdba r: db(db.thing.owner_id == r).count()| Would something like this work? Am just guessing here, and not something that I have tried out. Kiran Subbaraman http://subbaraman.wordpress.com/about/ On 1/14/2014 11:18 AM, Apple Mason wrote: In the online doc on computed field, the computed fields uses a field in the current table, and not in another table. I modified the one-to-many example by adding a 'total_items' field on person. If I want 'total_items' to be the sum of all items the person currently has, and this field should be updated when an inserted/deleted 'thing' for this person happens, what should computed be? | db.define_table('person', Field('name'), Field('total_items', 'integer', compute=#lamdba r: r.??), # what should go here? format='%(name)s') db.define_table('thing', Field('name'), Field('owner_id', 'reference person'), format='%(name)s')| -- 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/groups/opt_out. -- 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/groups/opt_out.
[web2py] Re: Data Fixtures
I have the same question. Is there any update on this almost 2 years later? On Thursday, March 8, 2012 4:32:45 PM UTC-5, Bruce Wade wrote: Hi, I have seen lots of postings about people wanting to pre-load data (fixtures) in web2py. However I have never found a standard solution. What are the best practices? Also before someone suggests putting them in the models directory I don't think that is a good idea. I would prefer something more like django where we can run a command to load the fixtures whenever we want. IE: python web2py.py -f fixtures_path or file -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com -- 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/groups/opt_out.