[web2py] Re: import_from_csv_file and id_map={}
Is id_map still necessary to preserver references when using import_form_csv_file function? I read this in the docs ( http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#CSV--all-tables-at-once- ): "When importing, the new records will be appended to the database if it is not empty. In general the new imported records will not have the same record id as the original (saved) records but web2py will restore references so they are not broken, even if the id values may change." This does not have any explicit mention of using the id_map parameter, so is it still necessary to preserve the references between tables? On Tuesday, March 17, 2015 at 7:33:21 AM UTC-7, Tom Clerckx wrote: > > Thanks. > > I will try to make some time and contribute in that way. > > Note: > You may want to update the link to your profile on > http://web2py.com/init/default/who > --> it results in a page not found. > > Best regards, > Tom. > > On Wednesday, March 11, 2015 at 7:07:04 PM UTC+1, Tom Clerckx wrote: >> >> I recently learned (by searching through the google-group) the usefulness >> of the id_map={} parameter in the db.import_from_csv_file function. >> I was wondering why this is not included in the documentation of web2py? >> >> Is this on the 'todo' list or is there another reason why it is not >> included? >> >> Best regards, >> Tom. >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Web2py admin page causing internal error (version 2.9.10)
I didn't update the extra files from web2py (like appadmin.py) into my app folder, but it still worked. I've updated the files now as well though. On Thu, Jul 30, 2015 at 11:45 AM, Richard Vézina < ml.richard.vez...@gmail.com> wrote: > You mean you don't do it and your app still works? Or you are not there > yet... > > Hope it works for you... > > Richard > > On Thu, Jul 30, 2015 at 2:39 PM, Mark Li wrote: > >> I did miss this, I keep skipping over this part! >> >> On Thu, Jul 30, 2015 at 6:28 AM, Richard Vézina < >> ml.richard.vez...@gmail.com> wrote: >> >>> Don't forget to update the web2py file in your app... >>> >>> Backup your app before :) >>> >>> https://groups.google.com/d/msg/web2py/tVyL7z7WHkw/mce13Vh-k3UJ >>> >>> Richard >>> >>> >>> On Thu, Jul 30, 2015 at 12:48 AM, Mark Li >>> wrote: >>> >>>> Deleting all the .pyc files from the web2py directory seems to have >>>> done the trick. >>>> >>>> On Wed, Jul 29, 2015 at 8:31 PM, Mark Li >>>> wrote: >>>> >>>>> I've updated to version 2.11.2, and the problem still persists. I've >>>>> deleted all errors, cache, and sessions for both admin app and "myapp" >>>>> >>>>> I am getting the following traceback when I look in the admin/errors >>>>> files: >>>>> >>>>> Traceback (most recent call last): >>>>> File "/home/marladarla7/web2py/ >>>>> gluon/restricted.py", line 224, in restricted >>>>> exec ccode in environment >>>>> File "applications/admin/models/0_imports.py", line 15, in >>>>> from mercurial import ui, hg, cmdutil >>>>> File "/home/marladarla7/web2py/gluon/custom_import.py", line 71, in >>>>> custom_importer >>>>> return NATIVE_IMPORTER(oname, globals, locals, fromlist, level) >>>>> File "mercurial.py", line 3, in >>>>> if DEMO_MODE or MULTI_USER_MODE: >>>>> NameError: name 'DEMO_MODE' is not defined >>>>> >>>>> I have checked 0.py model, and DEMO_MODE = False, so I have no idea >>>>> why I am getting this error >>>>> >>>>> On Wednesday, July 29, 2015 at 12:52:54 PM UTC-7, Richard wrote: >>>>>> >>>>>> sorry I miss read... 2.9.10... >>>>>> >>>>>> Why not 2.9.12... >>>>>> >>>>>> Why not install 2.11.2?? >>>>>> >>>>>> Richard >>>>>> >>>>>> On Wed, Jul 29, 2015 at 3:49 PM, Richard Vézina < >>>>>> ml.richa...@gmail.com> wrote: >>>>>> >>>>>>> Did you update the admin app? >>>>>>> >>>>>>> Also, if I remember there have been many correction over 2.10.x >>>>>>> web2py build... I would avoid the 2.10.x series for this reason... I >>>>>>> remember having testing and having found it not that stable and I stay >>>>>>> with >>>>>>> 2.9.5... >>>>>>> >>>>>>> 2.11.2 seems to work great... >>>>>>> >>>>>>> Richard >>>>>>> >>>>>>> On Wed, Jul 29, 2015 at 3:30 PM, Dave S wrote: >>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Wednesday, July 29, 2015 at 11:44:44 AM UTC-7, Mark Li wrote: >>>>>>>>> >>>>>>>>> I am looking at the errors for the admin (at the files), and I am >>>>>>>>> getting a " name 'DEMO_MODE' is not >>>>>>>>> defined"" >>>>>>>>> error >>>>>>>>> >>>>>>>>> >>>>>>>> That doesn't ring any bells for me, although I'm currently on >>>>>>>> 2.11.2. I think the step that required some extra effort for pydal >>>>>>>> 2.10.x. >>>>>>>> >>>>>>>> /dps >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> On Wednesday, July 29, 2015 at
Re: [web2py] Re: Web2py admin page causing internal error (version 2.9.10)
I did miss this, I keep skipping over this part! On Thu, Jul 30, 2015 at 6:28 AM, Richard Vézina wrote: > Don't forget to update the web2py file in your app... > > Backup your app before :) > > https://groups.google.com/d/msg/web2py/tVyL7z7WHkw/mce13Vh-k3UJ > > Richard > > > On Thu, Jul 30, 2015 at 12:48 AM, Mark Li wrote: > >> Deleting all the .pyc files from the web2py directory seems to have done >> the trick. >> >> On Wed, Jul 29, 2015 at 8:31 PM, Mark Li wrote: >> >>> I've updated to version 2.11.2, and the problem still persists. I've >>> deleted all errors, cache, and sessions for both admin app and "myapp" >>> >>> I am getting the following traceback when I look in the admin/errors >>> files: >>> >>> Traceback (most recent call last): >>> File "/home/marladarla7/web2py/ >>> gluon/restricted.py", line 224, in restricted >>> exec ccode in environment >>> File "applications/admin/models/0_imports.py", line 15, in >>> from mercurial import ui, hg, cmdutil >>> File "/home/marladarla7/web2py/gluon/custom_import.py", line 71, in >>> custom_importer >>> return NATIVE_IMPORTER(oname, globals, locals, fromlist, level) >>> File "mercurial.py", line 3, in >>> if DEMO_MODE or MULTI_USER_MODE: >>> NameError: name 'DEMO_MODE' is not defined >>> >>> I have checked 0.py model, and DEMO_MODE = False, so I have no idea why >>> I am getting this error >>> >>> On Wednesday, July 29, 2015 at 12:52:54 PM UTC-7, Richard wrote: >>>> >>>> sorry I miss read... 2.9.10... >>>> >>>> Why not 2.9.12... >>>> >>>> Why not install 2.11.2?? >>>> >>>> Richard >>>> >>>> On Wed, Jul 29, 2015 at 3:49 PM, Richard Vézina >>>> wrote: >>>> >>>>> Did you update the admin app? >>>>> >>>>> Also, if I remember there have been many correction over 2.10.x web2py >>>>> build... I would avoid the 2.10.x series for this reason... I remember >>>>> having testing and having found it not that stable and I stay with >>>>> 2.9.5... >>>>> >>>>> 2.11.2 seems to work great... >>>>> >>>>> Richard >>>>> >>>>> On Wed, Jul 29, 2015 at 3:30 PM, Dave S wrote: >>>>> >>>>>> >>>>>> >>>>>> On Wednesday, July 29, 2015 at 11:44:44 AM UTC-7, Mark Li wrote: >>>>>>> >>>>>>> I am looking at the errors for the admin (at the files), and I am >>>>>>> getting a " name 'DEMO_MODE' is not >>>>>>> defined"" >>>>>>> error >>>>>>> >>>>>>> >>>>>> That doesn't ring any bells for me, although I'm currently on >>>>>> 2.11.2. I think the step that required some extra effort for pydal >>>>>> 2.10.x. >>>>>> >>>>>> /dps >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> On Wednesday, July 29, 2015 at 11:24:07 AM UTC-7, Mark Li wrote: >>>>>>>> >>>>>>>> I've run sessions2trash.py to remove all sessions, as well as >>>>>>>> remove all the files from the errors folder. Unfortunately I'm still >>>>>>>> getting the error loop. Should I do this for the admin app as well? >>>>>>>> >>>>>>>> On Wednesday, July 29, 2015 at 10:52:06 AM UTC-7, Dave S wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Wednesday, July 29, 2015 at 10:20:36 AM UTC-7, Mark Li wrote: >>>>>>>>>> >>>>>>>>>> I just upgraded my web2py version on Pythonanywhere from 2.7.4 to >>>>>>>>>> 2.9.10, so my live site can match my test site web2py version >>>>>>>>>> >>>>>>>>>> This in turn has caused the admin page to start producing errors, >>>>>>>>>> so I am unable to look at error tickets (they will just produce more >>>>>>>>>> errors). >>>>>>>>
[web2py] Re: Getting a demo_mode not defined error in admin (even though demo_mode defined in 0.py)
I upgraded to version 2.11.2, but the error was still occurring. I deleted all the .pyc files from the web2py directory and this seems to have solved the problem. On Wednesday, July 29, 2015 at 12:06:46 PM UTC-7, Mark Li wrote: > > I am getting a very odd error in my admin app (2.9.10) on PythonAnywhere. > I am getting the following error: > > Traceback (most recent call last): > File "/home/marladarla7/web2py/gluon/restricted.py", line 224, in > restricted > exec ccode in environment > File "applications/admin/models/0_imports.py", line 15, in > from mercurial import ui, hg, cmdutil > File "/home/marladarla7/web2py/gluon/custom_import.py", line 71, in > custom_importer > return NATIVE_IMPORTER(oname, globals, locals, fromlist, level) > File "mercurial.py", line 3, in > if DEMO_MODE or MULTI_USER_MODE: > NameError: name 'DEMO_MODE' is not defined > > I have checked 0.py model, and DEMO_MODE = False, so I have no idea why I > am getting this error > > This error started occurring after I unzipped the 2.9.10 web2py zip over > my old install (2.7.4). > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Web2py admin page causing internal error (version 2.9.10)
Deleting all the .pyc files from the web2py directory seems to have done the trick. On Wed, Jul 29, 2015 at 8:31 PM, Mark Li wrote: > I've updated to version 2.11.2, and the problem still persists. I've > deleted all errors, cache, and sessions for both admin app and "myapp" > > I am getting the following traceback when I look in the admin/errors files: > > Traceback (most recent call last): > File "/home/marladarla7/web2py/ > gluon/restricted.py", line 224, in restricted > exec ccode in environment > File "applications/admin/models/0_imports.py", line 15, in > from mercurial import ui, hg, cmdutil > File "/home/marladarla7/web2py/gluon/custom_import.py", line 71, in > custom_importer > return NATIVE_IMPORTER(oname, globals, locals, fromlist, level) > File "mercurial.py", line 3, in > if DEMO_MODE or MULTI_USER_MODE: > NameError: name 'DEMO_MODE' is not defined > > I have checked 0.py model, and DEMO_MODE = False, so I have no idea why I > am getting this error > > On Wednesday, July 29, 2015 at 12:52:54 PM UTC-7, Richard wrote: >> >> sorry I miss read... 2.9.10... >> >> Why not 2.9.12... >> >> Why not install 2.11.2?? >> >> Richard >> >> On Wed, Jul 29, 2015 at 3:49 PM, Richard Vézina >> wrote: >> >>> Did you update the admin app? >>> >>> Also, if I remember there have been many correction over 2.10.x web2py >>> build... I would avoid the 2.10.x series for this reason... I remember >>> having testing and having found it not that stable and I stay with 2.9.5... >>> >>> 2.11.2 seems to work great... >>> >>> Richard >>> >>> On Wed, Jul 29, 2015 at 3:30 PM, Dave S wrote: >>> >>>> >>>> >>>> On Wednesday, July 29, 2015 at 11:44:44 AM UTC-7, Mark Li wrote: >>>>> >>>>> I am looking at the errors for the admin (at the files), and I am >>>>> getting a " name 'DEMO_MODE' is not defined"" >>>>> error >>>>> >>>>> >>>> That doesn't ring any bells for me, although I'm currently on 2.11.2. >>>> I think the step that required some extra effort for pydal 2.10.x. >>>> >>>> /dps >>>> >>>> >>>> >>>> >>>>> On Wednesday, July 29, 2015 at 11:24:07 AM UTC-7, Mark Li wrote: >>>>>> >>>>>> I've run sessions2trash.py to remove all sessions, as well as remove >>>>>> all the files from the errors folder. Unfortunately I'm still getting the >>>>>> error loop. Should I do this for the admin app as well? >>>>>> >>>>>> On Wednesday, July 29, 2015 at 10:52:06 AM UTC-7, Dave S wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Wednesday, July 29, 2015 at 10:20:36 AM UTC-7, Mark Li wrote: >>>>>>>> >>>>>>>> I just upgraded my web2py version on Pythonanywhere from 2.7.4 to >>>>>>>> 2.9.10, so my live site can match my test site web2py version >>>>>>>> >>>>>>>> This in turn has caused the admin page to start producing errors, >>>>>>>> so I am unable to look at error tickets (they will just produce more >>>>>>>> errors). >>>>>>>> >>>>>>>> I'm quite lost as to what I can do to fix this problem, as I can't >>>>>>>> even read the error tickets (it's just a continuing cycle of internal >>>>>>>> errors). >>>>>>>> >>>>>>> >>>>>>> You probably need to clear old sessions and old tickets out (back up >>>>>>> the tickets, then clear the directory). As I remember it, old sessions >>>>>>> and >>>>>>> old tickets were the two biggest sources of error loops. >>>>>>> >>>>>>> /dps >>>>>>> >>>>>>> >>>>>> -- >>>> Resources: >>>> - http://web2py.com >>>> - http://web2py.com/book (Documentation) >>>> - http://github.com/web2py/web2py (Source code) >>>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "web2py-users" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to web2py+un...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >> -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/Z84QlkT6MqE/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Web2py admin page causing internal error (version 2.9.10)
I've updated to version 2.11.2, and the problem still persists. I've deleted all errors, cache, and sessions for both admin app and "myapp" I am getting the following traceback when I look in the admin/errors files: Traceback (most recent call last): File "/home/marladarla7/web2py/ gluon/restricted.py", line 224, in restricted exec ccode in environment File "applications/admin/models/0_imports.py", line 15, in from mercurial import ui, hg, cmdutil File "/home/marladarla7/web2py/gluon/custom_import.py", line 71, in custom_importer return NATIVE_IMPORTER(oname, globals, locals, fromlist, level) File "mercurial.py", line 3, in if DEMO_MODE or MULTI_USER_MODE: NameError: name 'DEMO_MODE' is not defined I have checked 0.py model, and DEMO_MODE = False, so I have no idea why I am getting this error On Wednesday, July 29, 2015 at 12:52:54 PM UTC-7, Richard wrote: > > sorry I miss read... 2.9.10... > > Why not 2.9.12... > > Why not install 2.11.2?? > > Richard > > On Wed, Jul 29, 2015 at 3:49 PM, Richard Vézina > wrote: > >> Did you update the admin app? >> >> Also, if I remember there have been many correction over 2.10.x web2py >> build... I would avoid the 2.10.x series for this reason... I remember >> having testing and having found it not that stable and I stay with 2.9.5... >> >> 2.11.2 seems to work great... >> >> Richard >> >> On Wed, Jul 29, 2015 at 3:30 PM, Dave S >> > wrote: >> >>> >>> >>> On Wednesday, July 29, 2015 at 11:44:44 AM UTC-7, Mark Li wrote: >>>> >>>> I am looking at the errors for the admin (at the files), and I am >>>> getting a " name 'DEMO_MODE' is not defined"" >>>> error >>>> >>>> >>> That doesn't ring any bells for me, although I'm currently on 2.11.2. I >>> think the step that required some extra effort for pydal 2.10.x. >>> >>> /dps >>> >>> >>> >>> >>>> On Wednesday, July 29, 2015 at 11:24:07 AM UTC-7, Mark Li wrote: >>>>> >>>>> I've run sessions2trash.py to remove all sessions, as well as remove >>>>> all the files from the errors folder. Unfortunately I'm still getting the >>>>> error loop. Should I do this for the admin app as well? >>>>> >>>>> On Wednesday, July 29, 2015 at 10:52:06 AM UTC-7, Dave S wrote: >>>>>> >>>>>> >>>>>> >>>>>> On Wednesday, July 29, 2015 at 10:20:36 AM UTC-7, Mark Li wrote: >>>>>>> >>>>>>> I just upgraded my web2py version on Pythonanywhere from 2.7.4 to >>>>>>> 2.9.10, so my live site can match my test site web2py version >>>>>>> >>>>>>> This in turn has caused the admin page to start producing errors, so >>>>>>> I am unable to look at error tickets (they will just produce more >>>>>>> errors). >>>>>>> >>>>>>> I'm quite lost as to what I can do to fix this problem, as I can't >>>>>>> even read the error tickets (it's just a continuing cycle of internal >>>>>>> errors). >>>>>>> >>>>>> >>>>>> You probably need to clear old sessions and old tickets out (back up >>>>>> the tickets, then clear the directory). As I remember it, old sessions >>>>>> and >>>>>> old tickets were the two biggest sources of error loops. >>>>>> >>>>>> /dps >>>>>> >>>>>> >>>>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "web2py-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to web2py+un...@googlegroups.com . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Getting a demo_mode not defined error in admin (even though demo_mode defined in 0.py)
I am getting a very odd error in my admin app (2.9.10) on PythonAnywhere. I am getting the following error: Traceback (most recent call last): File "/home/marladarla7/web2py/gluon/restricted.py", line 224, in restricted exec ccode in environment File "applications/admin/models/0_imports.py", line 15, in from mercurial import ui, hg, cmdutil File "/home/marladarla7/web2py/gluon/custom_import.py", line 71, in custom_importer return NATIVE_IMPORTER(oname, globals, locals, fromlist, level) File "mercurial.py", line 3, in if DEMO_MODE or MULTI_USER_MODE: NameError: name 'DEMO_MODE' is not defined I have checked 0.py model, and DEMO_MODE = False, so I have no idea why I am getting this error This error started occurring after I unzipped the 2.9.10 web2py zip over my old install (2.7.4). -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Web2py admin page causing internal error (version 2.9.10)
I am looking at the errors for the admin (at the files), and I am getting a " name 'DEMO_MODE' is not defined"" error On Wednesday, July 29, 2015 at 11:24:07 AM UTC-7, Mark Li wrote: > > I've run sessions2trash.py to remove all sessions, as well as remove all > the files from the errors folder. Unfortunately I'm still getting the error > loop. Should I do this for the admin app as well? > > On Wednesday, July 29, 2015 at 10:52:06 AM UTC-7, Dave S wrote: >> >> >> >> On Wednesday, July 29, 2015 at 10:20:36 AM UTC-7, Mark Li wrote: >>> >>> I just upgraded my web2py version on Pythonanywhere from 2.7.4 to >>> 2.9.10, so my live site can match my test site web2py version >>> >>> This in turn has caused the admin page to start producing errors, so I >>> am unable to look at error tickets (they will just produce more errors). >>> >>> I'm quite lost as to what I can do to fix this problem, as I can't even >>> read the error tickets (it's just a continuing cycle of internal errors). >>> >> >> You probably need to clear old sessions and old tickets out (back up the >> tickets, then clear the directory). As I remember it, old sessions and old >> tickets were the two biggest sources of error loops. >> >> /dps >> >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Web2py admin page causing internal error (version 2.9.10)
I've run sessions2trash.py to remove all sessions, as well as remove all the files from the errors folder. Unfortunately I'm still getting the error loop. Should I do this for the admin app as well? On Wednesday, July 29, 2015 at 10:52:06 AM UTC-7, Dave S wrote: > > > > On Wednesday, July 29, 2015 at 10:20:36 AM UTC-7, Mark Li wrote: >> >> I just upgraded my web2py version on Pythonanywhere from 2.7.4 to 2.9.10, >> so my live site can match my test site web2py version >> >> This in turn has caused the admin page to start producing errors, so I am >> unable to look at error tickets (they will just produce more errors). >> >> I'm quite lost as to what I can do to fix this problem, as I can't even >> read the error tickets (it's just a continuing cycle of internal errors). >> > > You probably need to clear old sessions and old tickets out (back up the > tickets, then clear the directory). As I remember it, old sessions and old > tickets were the two biggest sources of error loops. > > /dps > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Web2py admin page causing internal error (version 2.9.10)
I just upgraded my web2py version on Pythonanywhere from 2.7.4 to 2.9.10, so my live site can match my test site web2py version This in turn has caused the admin page to start producing errors, so I am unable to look at error tickets (they will just produce more errors). I'm quite lost as to what I can do to fix this problem, as I can't even read the error tickets (it's just a continuing cycle of internal errors). -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Prevent multiple submit buttons from showing "Working..." on submit
I am currently not using the newest version of web2py; I'll probably update in the near future and add a reminder to look into this. On Mon, Jul 6, 2015 at 10:23 AM, Krzysztof Socha wrote: > > > On Wednesday, December 11, 2013 at 10:01:39 PM UTC+1, Mark Li wrote: >> >> I looked into the code and my web2py.js was not the same as the github >> link, which I noticed because my forminputclickselector did not contain >> >> :not([name]) >> >> . When I diff-ed the original link for the newest web2py.js, with my >> current web2py.js, it showed no difference. Very odd, maybe I had an old >> web2py.js in browser cache. Sorry for the confusion. >> >> >>> > I have the same problem now -all of my (non-submit!) buttons got > 'Working...' message when submitting the form. > I checked the github link again... The lines do not match anymore, but I > have not found not([name]) anywhere now... How do I disable this behaviour? > > Krzysztof. > > -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/aT_YWu0Ublo/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Plain Text and HTML Email with auth.messages.verify_email
Hey Falko, I went with plain text email at first, but now everything is HTML email. Sorry I can't really help you out here! On Sat, Jun 20, 2015 at 4:10 PM, Falko Delarue wrote: > how did you do it? could you please explain ┐(・。・┐) ♪ > > > On Saturday, September 15, 2012 at 1:17:50 AM UTC+2, c h wrote: >> >> for what it's worth i have re-implemented some of the auth functions that >> send mail so that i can send both plain text and HTML emails (i don't read >> email in HTML so i still like plain text versions). i'm not sure how many >> people are left who are like meif there are enough it would be great to >> be able to specify to auth the plain text and the HTML versions for all >> emails - perhaps even pass in path to views (which is what i do in my >> extensions). >> >> cfh >> >> On Friday, September 14, 2012 2:25:04 PM UTC-7, Massimo Di Pierro wrote: >>> >>> If the email text looks like '' it should be send as >>> html. >>> >>> On Friday, 14 September 2012 12:12:21 UTC-5, Mark Li wrote: >>>> >>>> Is it possible to send both Plain Text and HTML Emails with >>>> auth.messages.verify_email? From the book, it seems >>>> auth.messages.verify_email only accepts a single 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/x7NSemz7Jx8/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Remember me with custom or alternate login?
Alrighty just figured out my problem, hopefully it will apply to your case, Lisandro! The "name" attribute of the "remember_me" checkbox input is actually "keep me logged in" on my local site (not sure if this changed with web2py versions, or I just made this change and forgot it). Thus, request.vars.remember_me was None every time, even if the checkbox was actually checked. I changed my javascript and python code to use "keep_me_logged_in" instead of "remember_me", and now it's working, I would suggest using "print request.vars" in your login code, so you can see what vars are actually getting passed in from the form. If there is no "remember_me" variable, then that's most likely your main problem. On Fri, Mar 20, 2015 at 12:11 PM, Mark Li wrote: > I'm not quite sure, all the relevant parts of your code match mine. I did > just test this on my local site, and it doesn't work. However, it does work > for the live site, so I'm going to take a look and see what's going on. > > > > On Fri, Mar 20, 2015 at 6:22 AM, Lisandro > wrote: > >> I'm having trouble to get this to work. >> I've already implemented my own login through ajax, but I can't get to >> work the "remember me" part. >> >> This is my code: >> >> def _login(): >> email = request.post_vars.email >> password = request.post_vars.password >> remember = request.post_vars.remember >> user = auth.login_bare(email, password) >> if not user: >> return response.json({'success':False}) >> else: >> if remember: >> session.auth.expiration = 3600 * 24 * 30 # one month >> session.auth.remember = True >> response.cookies[response.session_id_name]["expires"] = >> session.auth.expiration >> return response.json({'success':True}) >> >> However, I login, close the browser, reopen it, and I'm asked to login >> again. What am I missing? >> >> >> >> El jueves, 6 de junio de 2013, 19:07:31 (UTC-3), Anthony escribió: >>> >>> Yes, sorry, there's one more thing you have to do -- you have to convert >>> the session cookie to a non-session cookie: >>> >>> response.cookies[response.session_id_name]["expires"] = session.auth. >>> expiration >>> >>> That will happen the next time Auth is initialized (which would happen >>> on the next request), but it won't happen if you simply close the browser. >>> >>> Anthony >>> >>> On Thursday, June 6, 2013 5:33:37 PM UTC-4, Mark Li wrote: >>>> >>>> Here's the relevant part of the code I'm using. I make an ajax call to >>>> the function below >>>> >>>> def ajax_login(): >>>> email = request.vars.email >>>> password = request.vars.password >>>> remember_me = request.vars.remember_me >>>> >>>> user = auth.login_bare(email, password) >>>> if user: >>>> if remember_me: >>>> session.auth.expiration = auth.settings.long_expiration >>>> session.auth.remember = True >>>> >>>> >>>> >>>> -- >> 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 a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/HdoErSDw-z8/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Remember me with custom or alternate login?
I'm not quite sure, all the relevant parts of your code match mine. I did just test this on my local site, and it doesn't work. However, it does work for the live site, so I'm going to take a look and see what's going on. On Fri, Mar 20, 2015 at 6:22 AM, Lisandro wrote: > I'm having trouble to get this to work. > I've already implemented my own login through ajax, but I can't get to > work the "remember me" part. > > This is my code: > > def _login(): > email = request.post_vars.email > password = request.post_vars.password > remember = request.post_vars.remember > user = auth.login_bare(email, password) > if not user: > return response.json({'success':False}) > else: > if remember: > session.auth.expiration = 3600 * 24 * 30 # one month > session.auth.remember = True > response.cookies[response.session_id_name]["expires"] = > session.auth.expiration > return response.json({'success':True}) > > However, I login, close the browser, reopen it, and I'm asked to login > again. What am I missing? > > > > El jueves, 6 de junio de 2013, 19:07:31 (UTC-3), Anthony escribió: >> >> Yes, sorry, there's one more thing you have to do -- you have to convert >> the session cookie to a non-session cookie: >> >> response.cookies[response.session_id_name]["expires"] = session.auth. >> expiration >> >> That will happen the next time Auth is initialized (which would happen on >> the next request), but it won't happen if you simply close the browser. >> >> Anthony >> >> On Thursday, June 6, 2013 5:33:37 PM UTC-4, Mark Li wrote: >>> >>> Here's the relevant part of the code I'm using. I make an ajax call to >>> the function below >>> >>> def ajax_login(): >>> email = request.vars.email >>> password = request.vars.password >>> remember_me = request.vars.remember_me >>> >>> user = auth.login_bare(email, password) >>> if user: >>> if remember_me: >>> session.auth.expiration = auth.settings.long_expiration >>> session.auth.remember = True >>> >>> >>> >>> -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/HdoErSDw-z8/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How to set an email header for the built-in auth() reset password email?
I currently have my email in web2py setup in a standard way: mail = auth.settings.mailer mail.settings.server = 'smtp.example.com:25' mail.settings.sender = 'y...@example.com' mail.settings.login = 'username:password' If I was to manually use mail.send() for this email, it would be something like the code below: mail.send('y...@example.com', 'Message subject', 'html body', headers= {'header1':'abc'} ) I would like to set an email header for the request_reset_password email (from auth()), but since I don't explicitly use mail.send() I'm not sure how I would go about adding a header for this email. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Returning a token for Android app authentication
Hey Mark, I did finish this, although it's been some time since I've looked into the code for the mobile-related stuff. Most of it still makes sense to me On Friday, October 10, 2014 1:31:09 PM UTC-7, Mark Graves wrote: > > Did you ever finish this? > > I implemented something similar. > > I'd love to collaborate and get a repo up for working with mobile devices > with web2py as an app back end. > > On Sunday, January 6, 2013 11:43:05 AM UTC-6, dlypka wrote: >> >> If you mimic the same http traffic that a browser would generate, then of >> course you will get all the normal web2py functionality such as the session. >> >> The web2py session is usually stored in the database which means it can >> store a large amount of data without the size limits of cookie storage. And >> it will persist between requests. >> >> On Friday, January 4, 2013 6:19:14 PM UTC-6, Mark Li wrote: >>> >>> Would it be necessary to connect to the same web2py session? >>> >>> To my understanding, connecting to the same session would be necessary >>> if the session contained Auth information indicating whether or not a user >>> was logged in. However, using auth.login_bare(), I only return a token on >>> login success, and the Auth information is never stored in session. Only >>> the token would be used to check whether or not a user was authenticated, >>> as this info is not stored in session. >>> >>> The login/authentication from Android would only be used for API calls, >>> and not for browsing the site. In the 'tokens' table, there would be >>> information about the user that would be similar to the Auth info stored in >>> session. When the token is passed to web2py, it would return the same >>> information that would normally be stored in session about the user. >>> >>> Thanks again for your help and checking my logic, I'm still pretty new >>> to this! >>> >>> On Thursday, January 3, 2013 7:57:45 PM UTC-8, dlypka wrote: >>>> >>>> But are you reconnecting to the same web2py session on each request? >>>> >>>> On Thursday, January 3, 2013 3:20:01 PM UTC-6, Mark Li wrote: >>>>> >>>>> I reviewed your code again and looked into the source code for web2py >>>>> to see how web2py deals with session login cookies. >>>>> >>>>> For what I want to accomplish, I believe I have found a method which >>>>> does not involved changing web2py source code. It's simpler and more >>>>> straight forward for me to wrap my head around (also not having to worry >>>>> about storing cookies in the app). Please let me know if there's anything >>>>> important I am missing or security flaws that I should consider. >>>>> >>>>> >>>>> 1. Embed webview into native Android app, using auth.login_bare to >>>>> authenticate. >>>>> 2. On login success, return a token of similar format to web2py's >>>>> session cookies. >>>>> 3. Store this token in the database (in a table named 'tokens'), and >>>>> send back to Android app as a cookie >>>>> 4. For every request to my web service that requires authentication, >>>>> send the token as a cookie and have the receiving API controller function >>>>> extract the cookie/token. If the token is currently in the db.tokens, >>>>> then >>>>> the user has been authenticated and the request returns the appropriate >>>>> data. >>>>> 5. On logout/password change, delete the issued tokens for this user >>>>> from db.tokens, so the same token can't be used to authenticate for >>>>> future >>>>> api calls. >>>>> >>>>> On Tuesday, January 1, 2013 10:33:26 PM UTC-8, dlypka wrote: >>>>>> >>>>>> I was not precisely calling from a native Android or native IOS app. >>>>>> I was using a PhoneGap client, which is different. It is looks like a >>>>>> web browser but is not a browser client. >>>>>> PhoneGap can only use HTML5 storage unless you write a native Android >>>>>> / IOS PhoneGap extension/plugin. >>>>>> So my technique will work from almost any client platform, even from >>>>>> a Windows native client app for example >>>>>> as long as it uses HTTP.
[web2py] Re: How to alter attributes of multiple elements with the same prefix, in a form
So this little bit of code solved my problem: elements_with_auth_user_ids = login_form.elements(_id=re.compile( '^auth_user')) for x in elements_with_auth_user_ids: x['_id']= "login_" + x['_id'] Using regex with the elements method, found all the ID's starting with "auth_user", and added a "login_" user prefix. This prevents having duplicate ID's on the page (b/c I have the register form on the same page). On Monday, August 18, 2014 9:43:47 AM UTC-7, Mark Li wrote: > > I am currently trying to alter all the ID's of the elements in the > auth.login() form. Basically, I want to add a prefix or suffix to all the > elements that have an ID. > > All of the id's (except for the submit button row), are prefixed with > "auth_user_". Is it possible to use form.elements() to select all those > elements at once? > > I tried using a css3 substring selector, like > > login_form.elements('[id*="auth_user"]') > > but this selected a few extra elements that did not have the auth_user ID > prefix. Is there an efficient way to accomplish this? > > As a last resort, I can change the ID's of each element individually > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: auth.login() does not return input value (username) on error, if auth.define_tables(username=True).
Feel like this should be the default behavior, although I'm not sure if there's a particular reason for redirecting as opposed to returning a form. On Thu, Sep 18, 2014 at 12:21 PM, Leonel Câmara wrote: > Humm I had to add keepvalues=True (there could be an > auth.settings.keepvalues) to the form.accepts and remove the redirect > replacing it with a return form. > > Basically: > if form.accepts(request, session if self.csrf_prevention > else None, > formname='login', dbio=False, > onvalidation=onvalidation, > hideerror=settings.hideerror, > keepvalues=True): > >() > > if not user: > self.log_event(self.messages['login_failed_log'], >request.post_vars) > # invalid login > session.flash = self.messages.invalid_login > callback(onfail, None) > #redirect( > #self.url(args=request.args, > vars=request.get_vars), > #client_side=settings.client_side) > return form > > > > Why are we redirecting anyway? > > > -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/gXBfCGki9ns/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: auth.login() does not return input value (username) on error, if auth.define_tables(username=True).
I posted a google code ticket in case anyone else stumbles across this: https://code.google.com/p/web2py/issues/detail?id=1987 For now, I will directly alter the form HTML to include the values for username/email input after a failed login. On Wednesday, September 17, 2014 4:42:36 PM UTC-7, Mark Li wrote: > > Is there a reason for this behavior? Or is it a bug? > > On Wednesday, September 17, 2014 4:34:44 PM UTC-7, Mark Li wrote: >> >> My previous post was somewhat off. >> >> Actually, what happens is that if the form passes validation, but has >> incorrect login credentials, auth.login() will trigger a redirect with the >> following code: >> >> redirect(self.url(args=request.args, vars=request.get_vars), >> client_side=settings.client_side) >> >> Upon redirect, the form.vars are lost, and thus the form is no >> pre-populated with the previously typed in value. This redirect does not >> occur if the form does not pass validation (such as having an invalid >> email), and thus the returned form still has form.vars >> >> If the login credentials are incorrect, the returned form should have all >> the previously typed in values (except for the password for security >> reasons), so the user can see where they made the error. If you return a >> blank form, the user must guess what they typed in the username/email >> input, which is needlessly frustrating. >> >> On Monday, September 15, 2014 1:42:10 PM UTC-7, Mark Li wrote: >>> >>> After submitting a failed login attempt with auth.login(), the failed >>> username input is not returned (it is cleared out). This is not a problem >>> when auth.define_tables(username=False), which would return the failed >>> email input upon login error. But, when username=True, the form no longer >>> returns the failed input after a login error. This would be an important >>> issue for users, because they don't see their failed credentials that they >>> previously typed (excluding the password). >>> >>> I added a print request.function to the model, and after a failed login >>> attempt (with auth.define_tables(username=True)), there is a double >>> redirect, which seemed to cause problems previously as well: >>> https://groups.google.com/forum/#!searchin/web2py/auth.login$20return$20username/web2py/9omfJYNoOC8/RrLOgeXENvMJ >>> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: auth.login() does not return input value (username) on error, if auth.define_tables(username=True).
Is there a reason for this behavior? Or is it a bug? On Wednesday, September 17, 2014 4:34:44 PM UTC-7, Mark Li wrote: > > My previous post was somewhat off. > > Actually, what happens is that if the form passes validation, but has > incorrect login credentials, auth.login() will trigger a redirect with the > following code: > > redirect(self.url(args=request.args, vars=request.get_vars), > client_side=settings.client_side) > > Upon redirect, the form.vars are lost, and thus the form is no > pre-populated with the previously typed in value. This redirect does not > occur if the form does not pass validation (such as having an invalid > email), and thus the returned form still has form.vars > > If the login credentials are incorrect, the returned form should have all > the previously typed in values (except for the password for security > reasons), so the user can see where they made the error. If you return a > blank form, the user must guess what they typed in the username/email > input, which is needlessly frustrating. > > On Monday, September 15, 2014 1:42:10 PM UTC-7, Mark Li wrote: >> >> After submitting a failed login attempt with auth.login(), the failed >> username input is not returned (it is cleared out). This is not a problem >> when auth.define_tables(username=False), which would return the failed >> email input upon login error. But, when username=True, the form no longer >> returns the failed input after a login error. This would be an important >> issue for users, because they don't see their failed credentials that they >> previously typed (excluding the password). >> >> I added a print request.function to the model, and after a failed login >> attempt (with auth.define_tables(username=True)), there is a double >> redirect, which seemed to cause problems previously as well: >> https://groups.google.com/forum/#!searchin/web2py/auth.login$20return$20username/web2py/9omfJYNoOC8/RrLOgeXENvMJ >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: auth.login() does not return input value (username) on error, if auth.define_tables(username=True).
My previous post was somewhat off. Actually, what happens is that if the form passes validation, but has incorrect login credentials, auth.login() will trigger a redirect with the following code: redirect(self.url(args=request.args, vars=request.get_vars), client_side=settings.client_side) Upon redirect, the form.vars are lost, and thus the form is no pre-populated with the previously typed in value. This redirect does not occur if the form does not pass validation (such as having an invalid email), and thus the returned form still has form.vars If the login credentials are incorrect, the returned form should have all the previously typed in values (except for the password for security reasons), so the user can see where they made the error. If you return a blank form, the user must guess what they typed in the username/email input, which is needlessly frustrating. On Monday, September 15, 2014 1:42:10 PM UTC-7, Mark Li wrote: > > After submitting a failed login attempt with auth.login(), the failed > username input is not returned (it is cleared out). This is not a problem > when auth.define_tables(username=False), which would return the failed > email input upon login error. But, when username=True, the form no longer > returns the failed input after a login error. This would be an important > issue for users, because they don't see their failed credentials that they > previously typed (excluding the password). > > I added a print request.function to the model, and after a failed login > attempt (with auth.define_tables(username=True)), there is a double > redirect, which seemed to cause problems previously as well: > https://groups.google.com/forum/#!searchin/web2py/auth.login$20return$20username/web2py/9omfJYNoOC8/RrLOgeXENvMJ > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: How to return a more specific error message from auth.login(), rather than a generic "invalid login"
Thanks for the help guys! I've implemented something similar to Leonel's suggestion for now. I've also posted a Google Code issue about this: https://code.google.com/p/web2py/issues/detail?id=1984 On Monday, September 15, 2014 5:43:56 PM UTC-7, Anthony wrote: > > On Monday, September 15, 2014 2:20:06 PM UTC-4, Mark Li wrote: >> >> Ahhh, that is quite frustrating! I see this a quite a big usability >> improvement at virtually no cost to security; would an optional parameter >> like auth.login(return_specific_error=True) still fail security checks for >> owasp? >> > > Maybe post a Google Code issue requesting something like this. I think > maybe we could adjust the code to pass the reason for the failure to the > login_onfail callback, which could then change the session flash or set > some other flag in the session (no need for a new return_specific_error > argument). > > 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/d/optout.
[web2py] auth.login() does not return input value (username) on error, if auth.define_tables(username=True).
After submitting a failed login attempt with auth.login(), the failed username input is not returned (it is cleared out). This is not a problem when auth.define_tables(username=False), which would return the failed email input upon login error. But, when username=True, the form no longer returns the failed input after a login error. This would be an important issue for users, because they don't see their failed credentials that they previously typed (excluding the password). I added a print request.function to the model, and after a failed login attempt (with auth.define_tables(username=True)), there is a double redirect, which seemed to cause problems previously as well: https://groups.google.com/forum/#!searchin/web2py/auth.login$20return$20username/web2py/9omfJYNoOC8/RrLOgeXENvMJ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: How to return a more specific error message from auth.login(), rather than a generic "invalid login"
Ahhh, that is quite frustrating! I see this a quite a big usability improvement at virtually no cost to security; would an optional parameter like auth.login(return_specific_error=True) still fail security checks for owasp? If this isn't possible at a web2py framework level, I'd like to know how do-able or advisable it would be to implement my own login method, where everything would virtually be the same as auth.login(), but it would return specific error messages. On Friday, September 12, 2014 2:43:35 PM UTC-7, Derek wrote: > > You and I understand that, but that doesn't make it any more valid to > return more specific login error related information. > > https://www.owasp.org/index.php/Authentication_Cheat_Sheet#User_IDs > > If we want to pass security checks for 'owasp' then we have to have > generic messages for login failures. Boneheaded as it may be, it's what > people expect secure software to do. > > On Thursday, September 11, 2014 1:49:36 PM UTC-7, Mark Li wrote: >> >> Looking through the source for auth.login(), it seems that the same >> "invalid login" error is given no matter what the particular error is >> (either username/email, or the password is wrong). >> >> I wanted to know if it is possible to return a more specific error msg >> after a failed login. If I use username and password as my login inputs, >> then I want to know the cause of a failed login: >> 1. Is the username in the database? >> 2. Is the password correct for that username? >> >> MailChimp did a brief write-up about this: >> http://blog.mailchimp.com/social-login-buttons-arent-worth-it/, where >> giving users a specific error msg had a very big impact on reducing login >> failure rates. They also addressed the security issue of being vague for >> login failure errors; it was determined to be a false risk. You can find >> out whether or not a username is taken through the registration form >> anyway, so providing a specific error msg on the login page does not tell >> you any more information than the registration page. >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How to return a more specific error message from auth.login(), rather than a generic "invalid login"
Looking through the source for auth.login(), it seems that the same "invalid login" error is given no matter what the particular error is (either username/email, or the password is wrong). I wanted to know if it is possible to return a more specific error msg after a failed login. If I use username and password as my login inputs, then I want to know the cause of a failed login: 1. Is the username in the database? 2. Is the password correct for that username? MailChimp did a brief write-up about this: http://blog.mailchimp.com/social-login-buttons-arent-worth-it/, where giving users a specific error msg had a very big impact on reducing login failure rates. They also addressed the security issue of being vague for login failure errors; it was determined to be a false risk. You can find out whether or not a username is taken through the registration form anyway, so providing a specific error msg on the login page does not tell you any more information than the registration page. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] How to put both login and register forms on one page...
The details of this problem are explained more thoroughly here: https://groups.google.com/forum/#!topic/web2py/13gozLyE3Eo On Thursday, August 28, 2014 1:11:47 PM UTC-7, Mark Li wrote: > > There seems to be a problem with this implementation > > For example, if you have > def page(): > login_form = auth.login() > register_form = auth.register() > > return dict(login_form=login_form, register_form=register_form) > > If you go to the page with both forms, and submit the register form with > errors (such as completely blank), the password field is NOT validated for > the submitted register form! > > I have a test example here: > http://tedlee.pythonanywhere.com/welcome/default/formtest > > If you define auth.register() first, instead of auth.login(), then this > problem does not appear for register, but there might be problems with > auth.login() (I have not tested this yet). > > On Wednesday, January 23, 2013 7:45:34 PM UTC-8, rochacbruno wrote: >> >> return dict(register=auth.register() , login=auth.login()) >> >> {{=register}} >> >> {{=login}} >> Em 23/01/2013 20:39, "sasogeek" escreveu: >> >>> how do I put the login and register forms on one page... so that a user >>> is logged in if they click the login button (if they've entered correct >>> email and password) and are signed up if they click the register button >>> with form data for a new account? >>> >>> -- >>> >>> >>> >>> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Both auth.login() and auth.register() on the same page, prevents password validation
Ahh yes that would explain it. Thanks for the tip, Anthony! Also, submitted the issue: https://code.google.com/p/web2py/issues/detail?id=1971 On Thursday, August 28, 2014 3:36:17 PM UTC-7, Anthony wrote: > > Looks like a bug. The login() method does the following: > > passfield = settings.password_field > try: > table_user[passfield].requires[-1].min_length = 0 > except: > pass > > It sets the minimum length for the password field to 0 but doesn't restore > it. Please submit a Google Code issue. > > In the meantime, you can just define the register form first, or after > defining the login form, do: > > db.auth_user.password.requires[-1].min_length = auth.settings. > password_min_length > > Anthony > > On Thursday, August 28, 2014 4:17:33 PM UTC-4, Mark Li wrote: >> >> I currently have both auth.login() and auth.register() forms on the same >> page. A simplified version of my code below: >> >> def page(): >> login_form = auth.login() >> register_form = auth.register() >> >> return dict(login_form=login_form, register_form=register_form) >> >> If you go to the page with both forms, and submit the register form with >> errors (such as completely blank), the password field is NOT validated for >> the submitted register form! >> >> I have a test example here: >> http://tedlee.pythonanywhere.com/welcome/default/formtest >> >> If you define auth.register() first, instead of auth.login(), then this >> problem does not appear for register, but there might be problems with >> auth.login() (I have not tested this yet). >> >> Is this a bug, or is there a proper way to include both login and >> register forms on the same page, while having correct server-side >> validation? >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Both auth.login() and auth.register() on the same page, prevents password validation
I currently have both auth.login() and auth.register() forms on the same page. A simplified version of my code below: def page(): login_form = auth.login() register_form = auth.register() return dict(login_form=login_form, register_form=register_form) If you go to the page with both forms, and submit the register form with errors (such as completely blank), the password field is NOT validated for the submitted register form! I have a test example here: http://tedlee.pythonanywhere.com/welcome/default/formtest If you define auth.register() first, instead of auth.login(), then this problem does not appear for register, but there might be problems with auth.login() (I have not tested this yet). Is this a bug, or is there a proper way to include both login and register forms on the same page, while having correct server-side validation? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] How to put both login and register forms on one page...
There seems to be a problem with this implementation For example, if you have def page(): login_form = auth.login() register_form = auth.register() return dict(login_form=login_form, register_form=register_form) If you go to the page with both forms, and submit the register form with errors (such as completely blank), the password field is NOT validated for the submitted register form! I have a test example here: http://tedlee.pythonanywhere.com/welcome/default/formtest If you define auth.register() first, instead of auth.login(), then this problem does not appear for register, but there might be problems with auth.login() (I have not tested this yet). On Wednesday, January 23, 2013 7:45:34 PM UTC-8, rochacbruno wrote: > > return dict(register=auth.register() , login=auth.login()) > > {{=register}} > > {{=login}} > Em 23/01/2013 20:39, "sasogeek" > > escreveu: > >> how do I put the login and register forms on one page... so that a user >> is logged in if they click the login button (if they've entered correct >> email and password) and are signed up if they click the register button >> with form data for a new account? >> >> -- >> >> >> >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Registration passworld field security risk on form failure?
This problem was patched here today: https://github.com/web2py/web2py/commit/5364193759f266e0c07128de2a7b6b54a82ef736 On Wed, Aug 27, 2014 at 10:40 AM, Willoughby wrote: > It got posted to the developer list yesterday, so it would seem at least > some of the maintainers think it's an issue worth discussion. > > > On Wednesday, August 27, 2014 1:11:57 PM UTC-4, Mark Li wrote: >> >> Under the Net tab in Firebug, the Post contains the submitted variables, >> and the response tab is the HTML of the returned page. This response >> contains the password input value in plain text. >> >> If I submitted the password as "asdf" and submitted the registration form >> with failures, the response will contain this (as shown in the net tab): >> > "password" value="asdf" /> >> >> Does no one else experience this behavior? >> >> On Tuesday, August 26, 2014 11:08:14 AM UTC-7, Willoughby wrote: >>> >>> Using the same Firebug, look at the Net tab - look at your post and the >>> response. >>> >>> >>> On Tuesday, August 26, 2014 1:32:14 PM UTC-4, Mark Li wrote: >>>> >>>> Looking at the password input through Firebug/developer tools, and the >>>> value of the password input is the plaintext of the password I entered. >>>> >>>> I have a test site here: http://tedlee.pythonanywhere. >>>> com/welcome/default/user/register >>>> >>>> Typing in a password and failing registration will return that >>>> password. Is this just the behavior of a modern browser (to remember failed >>>> inputs), or is it web2py form handling? >>>> >>>> In the case that web2py did only return asterisks, wouldn't that be >>>> very misleading to the user? Because the password input is masked, they >>>> would assume that the returned password value (after registration failure) >>>> was what they previously had typed, not a password replaced with asterisks. >>>> Thus on re-submitting the form, they would not think to alter the password >>>> and would just submit a password with asterisks. >>>> >>>> On Monday, August 25, 2014 3:25:44 PM UTC-7, Derek wrote: >>>>> >>>>> Have you actually looked at it? I believe it just returns asterisks. >>>>> >>>>> On Monday, August 25, 2014 3:02:49 PM UTC-7, Mark Li wrote: >>>>>> >>>>>> I am currently looking into whether or not password fields should be >>>>>> cleared on registration error after the form fails server-side >>>>>> validation. >>>>>> At the moment, web2py shows the password after a registration error, >>>>>> instead of leaving it blank. While this may make editing the password >>>>>> easier (in case there are pw errors), it seems to pose a security risk >>>>>> because you are sending the password back to the client in plain text. To >>>>>> my understanding, this would allow the page to be cached with the >>>>>> password's value in plain text. >>>>>> >>>>>> I tested this on a variety of browsers and systems, so to the best of >>>>>> my knowledge this is behavior is not unique to a browser. >>>>>> >>>>>> Does this pose a reasonable security risk? >>>>>> >>>>>> Some reference links: >>>>>> http://ux.stackexchange.com/questions/3/why-do-most- >>>>>> create-account-forms-clear-the-password-fields-upon-wrong-validation >>>>>> http://ux.stackexchange.com/questions/20418/when-form- >>>>>> submission-fails-password-field-gets-blanked-why-is-that-the-case >>>>>> >>>>> -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/5zmTyjSlr5E/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Registration passworld field security risk on form failure?
Under the Net tab in Firebug, the Post contains the submitted variables, and the response tab is the HTML of the returned page. This response contains the password input value in plain text. If I submitted the password as "asdf" and submitted the registration form with failures, the response will contain this (as shown in the net tab): Does no one else experience this behavior? On Tuesday, August 26, 2014 11:08:14 AM UTC-7, Willoughby wrote: > > Using the same Firebug, look at the Net tab - look at your post and the > response. > > > On Tuesday, August 26, 2014 1:32:14 PM UTC-4, Mark Li wrote: >> >> Looking at the password input through Firebug/developer tools, and the >> value of the password input is the plaintext of the password I entered. >> >> I have a test site here: >> http://tedlee.pythonanywhere.com/welcome/default/user/register >> >> Typing in a password and failing registration will return that password. >> Is this just the behavior of a modern browser (to remember failed inputs), >> or is it web2py form handling? >> >> In the case that web2py did only return asterisks, wouldn't that be very >> misleading to the user? Because the password input is masked, they would >> assume that the returned password value (after registration failure) was >> what they previously had typed, not a password replaced with asterisks. >> Thus on re-submitting the form, they would not think to alter the password >> and would just submit a password with asterisks. >> >> On Monday, August 25, 2014 3:25:44 PM UTC-7, Derek wrote: >>> >>> Have you actually looked at it? I believe it just returns asterisks. >>> >>> On Monday, August 25, 2014 3:02:49 PM UTC-7, Mark Li wrote: >>>> >>>> I am currently looking into whether or not password fields should be >>>> cleared on registration error after the form fails server-side validation. >>>> At the moment, web2py shows the password after a registration error, >>>> instead of leaving it blank. While this may make editing the password >>>> easier (in case there are pw errors), it seems to pose a security risk >>>> because you are sending the password back to the client in plain text. To >>>> my understanding, this would allow the page to be cached with the >>>> password's value in plain text. >>>> >>>> I tested this on a variety of browsers and systems, so to the best of >>>> my knowledge this is behavior is not unique to a browser. >>>> >>>> Does this pose a reasonable security risk? >>>> >>>> Some reference links: >>>> >>>> http://ux.stackexchange.com/questions/3/why-do-most-create-account-forms-clear-the-password-fields-upon-wrong-validation >>>> >>>> http://ux.stackexchange.com/questions/20418/when-form-submission-fails-password-field-gets-blanked-why-is-that-the-case >>>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Registration passworld field security risk on form failure?
Looking at the password input through Firebug/developer tools, and the value of the password input is the plaintext of the password I entered. I have a test site here: http://tedlee.pythonanywhere.com/welcome/default/user/register Typing in a password and failing registration will return that password. Is this just the behavior of a modern browser (to remember failed inputs), or is it web2py form handling? In the case that web2py did only return asterisks, wouldn't that be very misleading to the user? Because the password input is masked, they would assume that the returned password value (after registration failure) was what they previously had typed, not a password replaced with asterisks. Thus on re-submitting the form, they would not think to alter the password and would just submit a password with asterisks. On Monday, August 25, 2014 3:25:44 PM UTC-7, Derek wrote: > > Have you actually looked at it? I believe it just returns asterisks. > > On Monday, August 25, 2014 3:02:49 PM UTC-7, Mark Li wrote: >> >> I am currently looking into whether or not password fields should be >> cleared on registration error after the form fails server-side validation. >> At the moment, web2py shows the password after a registration error, >> instead of leaving it blank. While this may make editing the password >> easier (in case there are pw errors), it seems to pose a security risk >> because you are sending the password back to the client in plain text. To >> my understanding, this would allow the page to be cached with the >> password's value in plain text. >> >> I tested this on a variety of browsers and systems, so to the best of my >> knowledge this is behavior is not unique to a browser. >> >> Does this pose a reasonable security risk? >> >> Some reference links: >> >> http://ux.stackexchange.com/questions/3/why-do-most-create-account-forms-clear-the-password-fields-upon-wrong-validation >> >> http://ux.stackexchange.com/questions/20418/when-form-submission-fails-password-field-gets-blanked-why-is-that-the-case >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Registration passworld field security risk on form failure?
I am currently looking into whether or not password fields should be cleared on registration error after the form fails server-side validation. At the moment, web2py shows the password after a registration error, instead of leaving it blank. While this may make editing the password easier (in case there are pw errors), it seems to pose a security risk because you are sending the password back to the client in plain text. To my understanding, this would allow the page to be cached with the password's value in plain text. I tested this on a variety of browsers and systems, so to the best of my knowledge this is behavior is not unique to a browser. Does this pose a reasonable security risk? Some reference links: http://ux.stackexchange.com/questions/3/why-do-most-create-account-forms-clear-the-password-fields-upon-wrong-validation http://ux.stackexchange.com/questions/20418/when-form-submission-fails-password-field-gets-blanked-why-is-that-the-case -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How to alter attributes of multiple elements with the same prefix, in a form
I am currently trying to alter all the ID's of the elements in the auth.login() form. Basically, I want to add a prefix or suffix to all the elements that have an ID. All of the id's (except for the submit button row), are prefixed with "auth_user_". Is it possible to use form.elements() to select all those elements at once? I tried using a css3 substring selector, like login_form.elements('[id*="auth_user"]') but this selected a few extra elements that did not have the auth_user ID prefix. Is there an efficient way to accomplish this? As a last resort, I can change the ID's of each element individually -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: SQLFORM generating duplicate ids in HTML
Was the duplicate ID's bug ever fixed or addressed with an optional prefix field? It currently looks like I would have to manually alter all the ID's of my auth.login() form, because auth.register() form is on the same page. On Wednesday, January 27, 2010 5:17:14 PM UTC-8, Jonathan Lundell wrote: > > On Jan 27, 2010, at 5:07 PM, Thadeus Burgess wrote: > > > Doesn't javascript input serialization expect to look the field up by id? > > There's nothing *wrong* with having an id; it just needs to be unique on > the page. > > > > > it should be > > > > form = id = formname class=formname: > > input: > > class = formname > > id = formname_field > > > > #formname input { ... } > > #formname #formname_users_email { ... } > > #formname .formname { ... } > > > > This would give a lot more flexibility from both a CSS design and a UI > > design using jquery selection. > > > > -Thadeus > > > > > > > > > > > > On Wed, Jan 27, 2010 at 5:12 PM, Jonathan Lundell > wrote: > >> On Jan 27, 2010, at 2:30 PM, Thadeus Burgess wrote: > >> > >>> if it was defaulted to None we could go > >>> > >>> if _id == None then id = tablename else id = _id > >>> > >>> Id accept that, just set a unique id for each of my forms and nothing > >>> will conflict and it will still keep good with old apps. > >> > >> And _id = False for no id at all. > >> > >> It's not that it isn't useful to put all of them into the same class; > it's that class is the right way to do it, rather than id. > >> > >> > >>> > >>> -Thadeus > >>> > >>> > >>> > >>> > >>> > >>> On Wed, Jan 27, 2010 at 4:27 PM, Wes James > wrote: > Why not: > > form1=SQLFORM(..., _id="what_you_want") > > -wes > > On Wed, Jan 27, 2010 at 7:31 AM, mdipierro > wrote: > > The ids are only used for CSS. you can do > > > > form1=SQLFORM(...,_class='form1') > > form1.accepts(request.post_vars,formname=None) > > form2=SQLFORM(...,_class='form2') > > form2.accepts(request.post_vars,formname=None) > > return dict(form1=form1,form2=form2) > > > > and you can use the class to refer to the id of the first or the > > second in CSS. There should be no ambiguity. > > > > Massimo > > > > > > > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: How to differentiate logic for auth.login() and auth.register() forms on the same page?
Yep that did it, thanks Leonel! On Thursday, August 14, 2014 4:55:45 PM UTC-7, Leonel Câmara wrote: > > You need to differentiate them using the form name. > > Something like: > > if request.post_vars._formname == 'login': ># do my login stuff > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How to differentiate logic for auth.login() and auth.register() forms on the same page?
I am currently using auth.login() and auth.register() forms on the same page I would like to use the following code for the login (to allow users to sign up with either username or email) auth.settings.login_userfield = 'email' if request.vars.email and IS_EMAIL()(request.vars.email)[1]: auth.settings.login_userfield = 'username' request.vars.username = request.vars.email request.post_vars.username = request.vars.username request.vars.email = None request.post_vars.email = None return dict(form=auth.login()) So the whole function looks like this (including the registration form): def mypage(): auth.settings.login_userfield = 'email' #to allow user to login with either username or email if request.vars.email and IS_EMAIL()(request.vars.email)[1]: auth.settings.login_userfield = 'username' request.vars.username = request.vars.email request.post_vars.username = request.vars.username request.vars.email = None request.post_vars.email = None return dict(login_form=auth.login(), register_form=auth.register()) Because the auth.login() and auth.register() forms both have inputs with the same name (password, email, username), how can I differentiate between whether a form was submitted by the login or the register form (both have request.vars.email). I only want the above logic to affect the auth.login() form, and may also want certain logic to only affect the register form. I was considering a check for request.vars.username (which is not present in the login form), but if the registration form username input is empty, then request.vars.username is still None (thus can't differentiate b/t login and register). -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: duplicate ids on using auth.login and auth.register forms on same page
Was this problem addressed, or is there are workaround for this? I am currently trying to implement something very similar, where both auth.login() and auth.register() forms are on the same page. Currently, they produce duplicate ID's (ex. both login and register password inputs have the id of "auth_user_password"). On Tuesday, May 18, 2010 6:28:56 AM UTC-7, mdipierro wrote: > > I am on the case... > > On May 18, 1:15 am, Tarun wrote: > > We are also facing same issue forhttp://radbox.me/for this. The code > > used is > > > > > > {{=auth.login()}} > > {{=A('Forgot password?', > > _href=URL(request.application,'account','user/retrieve_password'))}} > p> > > > > > > > > {{=auth.register()}} > > By registering, you confirm that you accept our > href="{{=URL(request.application, 'support', 'tos')}}">Terms of > > service. > > > > I can only see class for auth_user_password_two__row, for all other > > fields ids are used. > > > > Thanks > > Tarun > > > > On May 13, 6:36 pm, mdipierro wrote: > > > > > please post an example of the controller and view. If I understand the > > > problem, this should work. > > > > > On May 13, 1:54 am, Rohan wrote: > > > > > > i am using latest version 1.77.3 (2010-04-20 02:48:54) > > > > > > On May 12, 8:29 pm, mdipierro wrote: > > > > > > > This was fixed. What version of web2py are you using? > > > > > > > On May 12, 5:51 am, Rohan wrote: > > > > > > > > I am using auth.login and auth.register forms on a single page > and it > > > > > > is resulting in duplicate ids for email and password rows. > > > > > > similar discussions were going on this threadhttp:// > groups.google.com/group/web2py/browse_frm/thread/e43c1203d8749630 > > > > > > Is there any update on 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/d/optout.
[web2py] Re: Display registration error for auth.register_bare()
I'd like to give a shot at AJAX-ifying the auth.register() form, but I'm not quite sure where to start. Looks quite daunting (for me). I'm looking at auth.register() source and web2py.js; would I simply want to add code to web2py.js to force the auth.register() forms to submit via AJAX (and return errors via ajax as well)? Or would this involve adding changes to auth.register() as well, such as providing an option auth.register(ajax=False)? On Wednesday, July 23, 2014 4:42:05 PM UTC-7, Mark Li wrote: > > Posted up a ticket for both suggestions: > > https://code.google.com/p/web2py/issues/detail?id=1955 > https://code.google.com/p/web2py/issues/detail?id=1956 > > On Wednesday, July 23, 2014 12:49:01 AM UTC-7, Massimo Di Pierro wrote: >> >> Both are good suggestions. >> >> On Tuesday, 22 July 2014 11:55:33 UTC-5, Mark Li wrote: >>> >>> Hey Massimo! Just for clarification, are you referring to opening a >>> ticket for: >>> >>> 1. auth.register() only showing a flash msg on registration error, >>> without a page reload >>> >>> OR >>> >>> 2. auth.register_bare() returning error msg on registration fail, >>> instead of just False >>> >>> >>> In my case I would like functionality for #1, but I just wanted to know >>> to which of my suggestions you were referring to. >>> >>> >>> On Monday, July 21, 2014 11:32:13 PM UTC-7, Massimo Di Pierro wrote: >>>> >>>> Please open a ticket. Perhaps this should be the default behavior. Easy >>>> to change. >>>> >>>> On Monday, 21 July 2014 14:59:34 UTC-5, Mark Li wrote: >>>>> >>>>> Maybe I'm not going about this in the right way. I basically want >>>>> auth.register() functionality, but without a page reload on registration >>>>> fail; just a flash msg of the error. >>>>> >>>>> On Monday, July 21, 2014 12:07:05 PM UTC-7, Mark Li wrote: >>>>>> >>>>>> Is it possible to return the registration error msg from >>>>>> auth.register_bare(), similar to how auth.register() would display the >>>>>> error msg after submit? From what I can gather in the source, seems like >>>>>> it >>>>>> only returns False on fail, and the user object on success. I would like >>>>>> to >>>>>> display more information to the user (password too short, username >>>>>> already >>>>>> taken, etc.), if registration fails. >>>>>> >>>>>> I am implementing an ajax registration, where I do not want the page >>>>>> to reload on submit unless registration is successful. >>>>>> >>>>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: How to prevent interactive shell from 303 error with redirect in model file.
Thanks a lot, Anthony! I was not aware of request.global_settings.cmd_options, and yes it works in differentiating between the http request and shell. I've posted up a ticket for this as well: https://code.google.com/p/web2py/issues/detail?id=1957 On Saturday, July 26, 2014 8:27:48 PM UTC-7, Anthony wrote: > > Try: > > cmd_opts = request.global_settings.cmd_options > if request.function=="index" and not (cmd_opts and (cmd_opts.shell or > cmd_opts.scheduler)): > redirect(URL('splash')) > > We should probably provide a more convenient method to check whether we > have an http request vs. a shell or scheduler run (maybe a flag such as > request.is_http_request). Feel free to submit a Google Code issue about > this. > > Anthony > > On Saturday, July 26, 2014 9:38:54 PM UTC-4, Mark Li wrote: >> >> I am currently redirecting my "index" page to another page (the "splash" >> page). The index page is the default function in my routes.py. The idea, is >> that if a user visits the "index" page, they will get redirected to the >> "splash" page, which works fine. At it's core, my redirect code looks like >> this (inside a models file): >> >> >> if request.function=="index": >> redirect(URL('splash')) >> >> >> However, upon using the interactive shell: >> python web2py.py -M -S appname >> >> I get a 303 error and can't start the interactive shell, because the >> index function is requested at the start of the interactive shell (causing >> a redirect). I still want the index page to redirect to the splash page, >> but the interactive shell does not work with the redirect code. Not quite >> sure what the best way to go about this is. I have several background >> scripts that run using the interactive shell; I would still like these to >> work, while maintaining the redirect code for users visiting the front-end >> of the site. >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How to prevent interactive shell from 303 error with redirect in model file.
I am currently redirecting my "index" page to another page (the "splash" page). The index page is the default function in my routes.py. The idea, is that if a user visits the "index" page, they will get redirected to the "splash" page, which works fine. At it's core, my redirect code looks like this (inside a models file): if request.function=="index": redirect(URL('splash')) However, upon using the interactive shell: python web2py.py -M -S appname I get a 303 error and can't start the interactive shell, because the index function is requested at the start of the interactive shell (causing a redirect). I still want the index page to redirect to the splash page, but the interactive shell does not work with the redirect code. Not quite sure what the best way to go about this is. I have several background scripts that run using the interactive shell; I would still like these to work, while maintaining the redirect code for users visiting the front-end of the site. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Display registration error for auth.register_bare()
Posted up a ticket for both suggestions: https://code.google.com/p/web2py/issues/detail?id=1955 https://code.google.com/p/web2py/issues/detail?id=1956 On Wednesday, July 23, 2014 12:49:01 AM UTC-7, Massimo Di Pierro wrote: > > Both are good suggestions. > > On Tuesday, 22 July 2014 11:55:33 UTC-5, Mark Li wrote: >> >> Hey Massimo! Just for clarification, are you referring to opening a >> ticket for: >> >> 1. auth.register() only showing a flash msg on registration error, >> without a page reload >> >> OR >> >> 2. auth.register_bare() returning error msg on registration fail, instead >> of just False >> >> >> In my case I would like functionality for #1, but I just wanted to know >> to which of my suggestions you were referring to. >> >> >> On Monday, July 21, 2014 11:32:13 PM UTC-7, Massimo Di Pierro wrote: >>> >>> Please open a ticket. Perhaps this should be the default behavior. Easy >>> to change. >>> >>> On Monday, 21 July 2014 14:59:34 UTC-5, Mark Li wrote: >>>> >>>> Maybe I'm not going about this in the right way. I basically want >>>> auth.register() functionality, but without a page reload on registration >>>> fail; just a flash msg of the error. >>>> >>>> On Monday, July 21, 2014 12:07:05 PM UTC-7, Mark Li wrote: >>>>> >>>>> Is it possible to return the registration error msg from >>>>> auth.register_bare(), similar to how auth.register() would display the >>>>> error msg after submit? From what I can gather in the source, seems like >>>>> it >>>>> only returns False on fail, and the user object on success. I would like >>>>> to >>>>> display more information to the user (password too short, username >>>>> already >>>>> taken, etc.), if registration fails. >>>>> >>>>> I am implementing an ajax registration, where I do not want the page >>>>> to reload on submit unless registration is successful. >>>>> >>>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Display registration error for auth.register_bare()
Hey Massimo! Just for clarification, are you referring to opening a ticket for: 1. auth.register() only showing a flash msg on registration error, without a page reload OR 2. auth.register_bare() returning error msg on registration fail, instead of just False In my case I would like functionality for #1, but I just wanted to know to which of my suggestions you were referring to. On Monday, July 21, 2014 11:32:13 PM UTC-7, Massimo Di Pierro wrote: > > Please open a ticket. Perhaps this should be the default behavior. Easy to > change. > > On Monday, 21 July 2014 14:59:34 UTC-5, Mark Li wrote: >> >> Maybe I'm not going about this in the right way. I basically want >> auth.register() functionality, but without a page reload on registration >> fail; just a flash msg of the error. >> >> On Monday, July 21, 2014 12:07:05 PM UTC-7, Mark Li wrote: >>> >>> Is it possible to return the registration error msg from >>> auth.register_bare(), similar to how auth.register() would display the >>> error msg after submit? From what I can gather in the source, seems like it >>> only returns False on fail, and the user object on success. I would like to >>> display more information to the user (password too short, username already >>> taken, etc.), if registration fails. >>> >>> I am implementing an ajax registration, where I do not want the page to >>> reload on submit unless registration is successful. >>> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Display registration error for auth.register_bare()
Maybe I'm not going about this in the right way. I basically want auth.register() functionality, but without a page reload on registration fail; just a flash msg of the error. On Monday, July 21, 2014 12:07:05 PM UTC-7, Mark Li wrote: > > Is it possible to return the registration error msg from > auth.register_bare(), similar to how auth.register() would display the > error msg after submit? From what I can gather in the source, seems like it > only returns False on fail, and the user object on success. I would like to > display more information to the user (password too short, username already > taken, etc.), if registration fails. > > I am implementing an ajax registration, where I do not want the page to > reload on submit unless registration is successful. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Display registration error for auth.register_bare()
Is it possible to return the registration error msg from auth.register_bare(), similar to how auth.register() would display the error msg after submit? From what I can gather in the source, seems like it only returns False on fail, and the user object on success. I would like to display more information to the user (password too short, username already taken, etc.), if registration fails. I am implementing an ajax registration, where I do not want the page to reload on submit unless registration is successful. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: 1054, "Unknown column in 'field list'... Help me
I've had this happen several times, and the solution provided in this link have worked for me. http://comments.gmane.org/gmane.comp.python.web2py/42344 On Sunday, March 9, 2014 11:58:29 PM UTC-7, sujin...@gmail.com wrote: > > I had made MXPDEVICE table, and I added MXPPCPLATFORM table yesterday. > Then definition of MXPDEVICE changed as below (Red color part). > > - > db.define_table('MXPDEVICE', > Field('NAME','string', notnull=True, label='Device'), > Field('MODEL_NO','string', required=True), > Field('PLATFORM_ID', db.MXPPLATFORM, ondelete='NO ACTION', > required=True, label='Platform'), > Field('PLATFORM_VERSION',required=True), > Field('PC_PLATFORM_ID', db.MXPPCPLATFORM, ondelete='NO ACTION', > required=True, label='PC Platform'), > Field('PC_PLATFORM_VERSION',required=True), > Field('DEVICE_INFO', 'text', required=True), > Field('DEFAULT_TESTER_ID', db.MXPTESTER, required=True, ondelete='NO > ACTION', label = 'Tester'), > Field('DEFAULT_TEST_DEVICE_YN', 'boolean', default=True), > Field('USE_YN', 'boolean', default=True, writable=False, readable = > False ), > Field('CREATED_ON', 'datetime', default=request.now, writable=False > ), > Field('UPDATED_ON', 'datetime', update=request.now, writable=False > )) > > - > > and then I got Error.. > === > Database db select > Traceback > Traceback (most recent call last): > File > "/home/mxptest/web2py/applications/mxpTest/controllers/appadmin.py", line > 270, in select > *fields, limitby=(start, stop)) > File "/home/mxptest/web2py/gluon/dal.py", line 10335, in select > return adapter.select(self.query,fields,attributes) > File "/home/mxptest/web2py/gluon/dal.py", line 1831, in select > return self._select_aux(sql,fields,attributes) > File "/home/mxptest/web2py/gluon/dal.py", line 1796, in _select_aux > self.execute(sql) > File "/home/mxptest/web2py/gluon/dal.py", line 1916, in execute > return self.log_execute(*a, **b) > File "/home/mxptest/web2py/gluon/dal.py", line 1910, in log_execute > ret = self.cursor.execute(command, *a[1:], **b) > File "/usr/lib/pymodules/python2.7/MySQLdb/cursors.py", line 166, in > execute > self.errorhandler(self, exc, value) > File "/usr/lib/pymodules/python2.7/MySQLdb/connections.py", line 35, in > defaulterrorhandler > raise errorclass, errorvalue > OperationalError: (1054, "Unknown column 'MXPDEVICE.PC_PLATFORM_ID' in > 'field list'") > === > I thought it's because of migration. > but even though I changed the option, It wasn't solved. > > Thank you for your answer!! > > > - > > > Hi. > I tried adding new columns, but I got that error 1054, "Unknown column in > 'field list'. > As web2py document > (set fake_migrate=True and after the metadata has been rebuilt, set > fake_migrate=False and migrate the table again).--- I'm using MySQL), I > did it but the problem was not solved. > I searched and tried many things... change migration option, delete .table > file etc... But It didn't work. > > Is anybody who knows solution? Help m > > Thank you so much!!! :) > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Prevent multiple submit buttons from showing "Working..." on submit
I looked into the code and my web2py.js was not the same as the github link, which I noticed because my forminputclickselector did not contain :not([name]) . When I diff-ed the original link for the newest web2py.js, with my current web2py.js, it showed no difference. Very odd, maybe I had an old web2py.js in browser cache. Sorry for the confusion. On Mon, Dec 9, 2013 at 2:54 AM, Martin Weissenboeck wrote: > Interesting. My minimal app does not show any "Working..." message. > I have to make more tests. > > > 2013/12/9 Martin Weissenboeck > >> ok, maybe during the next two hours. >> >> >> 2013/12/9 Niphlod >> >>> this is really unexpected. >>> this line >>> >>> https://github.com/web2py/web2py/blob/master/applications/welcome/static/js/web2py.js#L462 >>> "selects" all the inputs in the form ... that syntax **should** leave >>> out all inputs with a name attribute.... >>> Can you pack a minimal app to reproduce the issue ? >>> >>> >>> >>> On Sunday, December 8, 2013 3:28:06 AM UTC+1, Mark Li wrote: >>> >>>> My web2py.js is the same as the one shipped with the latest web2py. >>>> >>>> I also tried adding a "data-w2p_disable_with" attribute to the input, >>>> but it didn't change to the attribute value: >>>> >>>> >>>> >>>> >>>> On Fri, Dec 6, 2013 at 11:55 AM, Niphlod wrote: >>>> >>>>> can you please check that your web2py.js is the same one shipped with >>>>> the latest web2py ? >>>>> You can fetch it here >>>>> https://raw.github.com/web2py/web2py/master/applications/ >>>>> welcome/static/js/web2py.js >>>>> >>>>> >>>>> On Friday, December 6, 2013 12:31:17 AM UTC+1, Mark Li wrote: >>>>>> >>>>>> Hey Niphlod, >>>>>> >>>>>> The 2 submit buttons have different names, here's the resulting HTML. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> However, clicking on either results in both having the "working..." >>>>>> message. Is this not intended behavior? >>>>>> >>>>>> One of the form submit buttons is from the SQLFORM (i add a _name >>>>>> attribute later), and the other one I insert into the form. >>>>>> >>>>>> On Thursday, December 5, 2013 12:50:00 PM UTC-8, Niphlod wrote: >>>>>>> >>>>>>> uhm, you're right. However, usually with different submit buttons >>>>>>> you'd likely have one of them having a "name" attribute (and those are >>>>>>> "excluded" from being put in the "working..." state) is this your >>>>>>> case ? >>>>>>> >>>>>>> How are you handling different "posts" based on the fact that the >>>>>>> user clicks on one instead of the other ? >>>>>>> >>>>>>> BTW2: if any "clickable-something" has a data-w2p_disable_with >>>>>>> attribute, that one is used instead of the default "Working..." message >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>> 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 a topic in the >>>>> Google Groups "web2py-users" group. >>>>> To unsubscribe from this topic, visit https://groups.google.com/d/ >>>>> topic/web2py/aT_YWu0Ublo/unsubscribe. >>>>> To unsubscribe from this group and all its topics, 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.
Re: [web2py] Re: Prevent multiple submit buttons from showing "Working..." on submit
My web2py.js is the same as the one shipped with the latest web2py. I also tried adding a "data-w2p_disable_with" attribute to the input, but it didn't change to the attribute value: On Fri, Dec 6, 2013 at 11:55 AM, Niphlod wrote: > can you please check that your web2py.js is the same one shipped with the > latest web2py ? > You can fetch it here > > https://raw.github.com/web2py/web2py/master/applications/welcome/static/js/web2py.js > > > On Friday, December 6, 2013 12:31:17 AM UTC+1, Mark Li wrote: >> >> Hey Niphlod, >> >> The 2 submit buttons have different names, here's the resulting HTML. >> >> >> >> >> > /> >> >> >> >> >> >> However, clicking on either results in both having the "working..." >> message. Is this not intended behavior? >> >> One of the form submit buttons is from the SQLFORM (i add a _name >> attribute later), and the other one I insert into the form. >> >> On Thursday, December 5, 2013 12:50:00 PM UTC-8, Niphlod wrote: >>> >>> uhm, you're right. However, usually with different submit buttons you'd >>> likely have one of them having a "name" attribute (and those are "excluded" >>> from being put in the "working..." state) is this your case ? >>> >>> How are you handling different "posts" based on the fact that the user >>> clicks on one instead of the other ? >>> >>> BTW2: if any "clickable-something" has a data-w2p_disable_with >>> attribute, that one is used instead of the default "Working..." message >>> >>> >>> >>> -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/aT_YWu0Ublo/unsubscribe. > To unsubscribe from this group and all its topics, 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: Prevent multiple submit buttons from showing "Working..." on submit
Hey Niphlod, The 2 submit buttons have different names, here's the resulting HTML. However, clicking on either results in both having the "working..." message. Is this not intended behavior? One of the form submit buttons is from the SQLFORM (i add a _name attribute later), and the other one I insert into the form. On Thursday, December 5, 2013 12:50:00 PM UTC-8, Niphlod wrote: > > uhm, you're right. However, usually with different submit buttons you'd > likely have one of them having a "name" attribute (and those are "excluded" > from being put in the "working..." state) is this your case ? > > How are you handling different "posts" based on the fact that the user > clicks on one instead of the other ? > > BTW2: if any "clickable-something" has a data-w2p_disable_with attribute, > that one is used instead of the default "Working..." message > > > > -- 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] Prevent multiple submit buttons from showing "Working..." on submit
I currently have 2 submit buttons in a form. When a user clicks on one of them, it changes both submit input values to "Working..." I looked into web2py.js and tried applying the suggestion there for preventing "Working.." from showing up on the buttons /*if you don't want to see "working..." on buttons, replace the following * two lines with this one * el.data('w2p_disable_with', el[method]()); */ This would be fine with 1 submit button. However, with 2 submit buttons, the value of the 2nd submit button is changed to the value of the 1st. For example, button 1 text is "Save", and button 2 text is "Post", clicking on either will change button 2 text to "Save" (after applying the suggestions from web2py.js Is there any way to disable the changing of the value/text of the submit input on submission (for multiple submit buttons in 1 form)? -- 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: Saving incomplete form with required fields (to prevent dynamically added form inputs from disappear
Yep, the "finished" field will prevent the unfinished records from being exposed where they shouldn't be. On Mon, Nov 25, 2013 at 11:15 AM, Dave S wrote: > On Saturday, November 23, 2013 11:44:05 PM UTC-8, Mark Li wrote: >> >> I think I've found an optimal solution for this. >> >> Since the validators for my table are only enforced at the form-level, I >> first insert a blank playlists record, and then use a SQLFORM or CRUD to >> update the newly inserted record. I can't submit an incomplete form, but I >> can insert an incomplete record and mark the "finished" column as false. >> >> This way, the playlist id already exists and I can save the >> playlist_tracks to the reference table. The validators will still apply >> when the user submits the form. >> >> > As long as the "finished" field is adequate protection from having an > incomplete or invalid entry messing up some of your db table processing at > a later time if the user doesn't correct the form. I think I would have > done something with storing partials in the session, but maybe one the > Respected Regulars has some alternative advice. > > /dps > > > >> On Saturday, November 23, 2013 6:50:19 PM UTC-8, Mark Li wrote: >>> >>> >>> I currently have 2 tables as follows, with a form containing values both >>> tables >>> >>> db.define_table('playlist', >>> Field('title', notnull=True), >>> Field('description'), >>> Field('tags'), >>> Field('genre', 'reference genre') >>> Field('finished', 'boolean') >>> ) >>> >>> db.define_table('playlist_tracks', >>> Field('playlist', 'reference playlist'), >>> Field('songname') >>> ) >>> >>> >>> >>> The form to add playlist_tracks is dynamic; a user enters a songname, >>> which appends an input element with value=songname. When the user submits >>> the form, if the form does not pass validation, then the playlist_tracks >>> will all disappear when the page reloads, since they were added dynamically. >>> >>> I want to prevent this from happening, as it can be very time consuming >>> to add all the playlist tracks. I want to save the playlist_tracks in the >>> reference table so they don't disappear, but it's not possible because >>> there is no 'playlist' reference (the playlist didn't pass validation). I >>> also want to give the user the option of "saving" an incomplete form to >>> work on later, which has the same problem because the incomplete form might >>> not pass validation, and thus there is no 'playlist' reference. >>> >>> What would be the best method of saving this incomplete form, so the >>> dynamically added playlist tracks will have a playlist reference? >>> >>> I was thinking about inserting the record with dummy default values, >>> after validation fails, but that has the disadvantage of automatically >>> filling a required field that the user didn't choose. For example, if a >>> user doesn't enter a title and doesn't select a genre from the select >>> drop-down, then after validation fails, I'll insert the record with >>> "Untitled Playlist" and genre==1 (and all other fields that passed >>> validation would remain unchanged) but still show the form errors. >>> >>> >>> -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/GG0oaBNSthE/unsubscribe. > To unsubscribe from this group and all its topics, 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: Saving incomplete form with required fields (to prevent dynamically added form inputs from disappear
I think I've found an optimal solution for this. Since the validators for my table are only enforced at the form-level, I first insert a blank playlists record, and then use a SQLFORM or CRUD to update the newly inserted record. I can't submit an incomplete form, but I can insert an incomplete record and mark the "finished" column as false. This way, the playlist id already exists and I can save the playlist_tracks to the reference table. The validators will still apply when the user submits the form. On Saturday, November 23, 2013 6:50:19 PM UTC-8, Mark Li wrote: > > > I currently have 2 tables as follows, with a form containing values both > tables > > db.define_table('playlist', > Field('title', notnull=True), > Field('description'), > Field('tags'), > Field('genre', 'reference genre') > Field('finished', 'boolean') > ) > > db.define_table('playlist_tracks', > Field('playlist', 'reference playlist'), > Field('songname') > ) > > > > The form to add playlist_tracks is dynamic; a user enters a songname, > which appends an input element with value=songname. When the user submits > the form, if the form does not pass validation, then the playlist_tracks > will all disappear when the page reloads, since they were added dynamically. > > I want to prevent this from happening, as it can be very time consuming to > add all the playlist tracks. I want to save the playlist_tracks in the > reference table so they don't disappear, but it's not possible because > there is no 'playlist' reference (the playlist didn't pass validation). I > also want to give the user the option of "saving" an incomplete form to > work on later, which has the same problem because the incomplete form might > not pass validation, and thus there is no 'playlist' reference. > > What would be the best method of saving this incomplete form, so the > dynamically added playlist tracks will have a playlist reference? > > I was thinking about inserting the record with dummy default values, after > validation fails, but that has the disadvantage of automatically filling a > required field that the user didn't choose. For example, if a user doesn't > enter a title and doesn't select a genre from the select drop-down, then > after validation fails, I'll insert the record with "Untitled Playlist" and > genre==1 (and all other fields that passed validation would remain > unchanged) but still show the form errors. > > > -- 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] Saving incomplete form with required fields (to prevent dynamically added form inputs from disappear
I currently have 2 tables as follows, with a form containing values both tables db.define_table('playlist', Field('title', notnull=True), Field('description'), Field('tags'), Field('genre', 'reference genre') Field('finished', 'boolean') ) db.define_table('playlist_tracks', Field('playlist', 'reference playlist'), Field('songname') ) The form to add playlist_tracks is dynamic; a user enters a songname, which appends an input element with value=songname. When the user submits the form, if the form does not pass validation, then the playlist_tracks will all disappear when the page reloads, since they were added dynamically. I want to prevent this from happening, as it can be very time consuming to add all the playlist tracks. I want to save the playlist_tracks in the reference table so they don't disappear, but it's not possible because there is no 'playlist' reference (the playlist didn't pass validation). I also want to give the user the option of "saving" an incomplete form to work on later, which has the same problem because the incomplete form might not pass validation, and thus there is no 'playlist' reference. What would be the best method of saving this incomplete form, so the dynamically added playlist tracks will have a playlist reference? I was thinking about inserting the record with dummy default values, after validation fails, but that has the disadvantage of automatically filling a required field that the user didn't choose. For example, if a user doesn't enter a title and doesn't select a genre from the select drop-down, then after validation fails, I'll insert the record with "Untitled Playlist" and genre==1 (and all other fields that passed validation would remain unchanged) but still show the form errors. -- 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: After reset password, delete rows from table associated with user
Thanks for pointing me in the right direction, Stifan. I added this line to the model file: db.auth_user._after_update.append(lambda s: remove_mobile_token(s, db)) and this function in a module def remove_mobile_token(set, db): request = current.request #delete mobile tokens if the change IS NOT from reset_password if request.function == "user" and request.args>0 and request.args(0)== "reset_password" : user_id = set.select().first().id db(db.mobile_tokens.username==user_id).delete() db.commit() I tried using the f variable from the after_update callback (containing dictionary of fields to be updated) to check for existence of "password" in f, but changes to the auth_user table using auth.profile() form contains all the fields for auth_user, thus any changes using the auth.profile() form would trigger a mobile_token deletion. To make sure only changes to the password field would trigger mobile_token deletion, I check that the request is coming from the user/reset_password. On Wednesday, November 6, 2013 4:51:33 AM UTC-8, 黄祥 wrote: > > i think you can achieve it using after_update callback. define > after_update function for auth_user to delete the mobile_tokens row that > associated with user. > > ref: > > http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#before-and-after-callbacks > > 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.
[web2py] After reset password, delete rows from table associated with user
I currently have a table of tokens db.define_table('mobile_tokens', Field ('username', 'reference auth_user'), Field ('token') ) After a user resets their password, all the mobile tokens for that user should also be deleted. After a user resets their password, is it possible to user auth.settings.reset_password_onvalidation to get the id of the user (who just changed their password), in order to delete the mobile_tokens associated with that user? The user is not yet logged in, so auth.user.id doesn't work. So far, I have been resorting to the auth.settings.reset_password_next to delete the mobile_tokens once the user is on the redirect page. However, the purpose of the redirect page is just to show confirmation that the password has changed, not to clear the mobile_tokens on every visit. It seems more logical to have the mobile_token deletion be attached to the reset_password function. -- 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: cache.action questions (views with db selects, and different views for logged-in users)
Thanks Niphlod and Anthony! That answered my question about caching views with database selects. However, my problem with client-side caching differently for logged-in and non-logged in users is still a problem. Niphlod, I'm not sure what you're referring to by the "user" parameter. The closet parameters to "user" would be "session" and "public". But I don't see these options helping to differentiate between logged in and non-logged for caching. Doesn't "session" only add a session id key for server-side caching, and "public" only determine whether a cache is useable on a single user's machine, or the user's network? Anthony, my problem still persists with your code; the "public" parameter does not seem to be the proper parameter for this problem. For example, when a user first hits the page (not logged-in), the public parameter will be set to True. This will cache the page in it's non-logged in state. If the user then logs in, and hits the page again, the browser will serve the non-logged-in version of the page from cache. No matter what the value of "public" is (unless the browser doesn't cache at all for public=false), if the user hits the page in either logged-in/non-logged in state, and goes to the same page later in the opposite state, the browser will serve the previously cached version of that page (which will be in the wrong logged-in/non-logged in state). The "public" parameter, if set to False, is helpful in preventing cached logged-in versions of the site from being the same across users. However, for each user, it does not help differentiate between logged in and non-logged cache pages. I've done some more research, and there doesn't seem to be any straightforward or practical ways of doing this. The main problem is that the browser can't tell whether a cached page is logged-in/not-logged in (since it's the same URL). Let me know if I'm missing something here, I'd like to take advantage of cache.action. On Monday, October 21, 2013 6:07:56 AM UTC-7, Anthony wrote: > > > For users who aren't logged in, the pages would be the same. However, if a >> user is logged in, then there are links to the users' profile, as well as a >> logout link; thus making the page different for every user, and different >> for logged-in vs. non-logged-in users. Is there any way to effectively >> cache these pages, or only cache the non-logged in page for non-logged in >> viewers? >> > > cache.action does two things -- it sends appropriate response headers to > the browser to enable client-side caching, and it (optionally) does > server-side caching via the web2py cache mechanism. You might want to avoid > doing per-user server-side caching, as that will start to fill up server > memory, and you'd have to make sure you manually clear cached values > periodically. Maybe consider something like: > > @cache.client(cache_model=cache.ram if not auth.is_logged_in() else None, > public=not auth.is_logged_in(), ...) > > That will do server-side caching of the non-logged-in page only, and it > will set public client-side caching to False for logged in users. > > >> Secondly, cache.action can't be used to cache views with database >> selects. However, if the database select was converted to a list/dict, with >> as_list() or as_dict(), would caching the page with cache.action be >> possible (this would make it pickleable as a regular dictionary)? >> > > Not sure what you mean -- can you show some code? cache.action caches only > the output of the decorated function (and only if cache_model is specified > -- otherwise, all it does is send headers to the browser to enable > client-side caching). > > 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] cache.action questions (views with db selects, and different views for logged-in users)
I have 2 questions about cache.action Firstly, I am looking into cache.action to cache several static pages (about, contact, etc), that rarely change content. For users who aren't logged in, the pages would be the same. However, if a user is logged in, then there are links to the users' profile, as well as a logout link; thus making the page different for every user, and different for logged-in vs. non-logged-in users. Is there any way to effectively cache these pages, or only cache the non-logged in page for non-logged in viewers? Secondly, cache.action can't be used to cache views with database selects. However, if the database select was converted to a list/dict, with as_list() or as_dict(), would caching the page with cache.action be possible (this would make it pickleable as a regular dictionary)? Would there be a significant improvement of using cache.action to cache the view that has a database select, over simply caching the select? -- 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: 2.4.7 problems
I've just encountered this problem myself, and I opened a ticket about this since I couldn't find one already posted. http://code.google.com/p/web2py/issues/detail?id=1736&thanks=1736&ts=1382314136 -- 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] Retrieving user id for auth.settings.reset_password_onaccept
I'm trying to retrieve the user id for auth.settings.reset_password_onaccept.append( code needing user id here). The user is not logged in when they reset their password. The auth.reset_password function contains the user object, but I'm not sure how I can obtain that user id to use in onaccept.append, because the user id is not one of the form variables. Any help is appreciated! -- 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] Database models don't import when using IPython 1.0.0 with web2py 2.7 (interactive shell)
I recently upgraded to the new version of web2py from 2.5 (on Pythonanywhere); everything seems to work fine except for the interactive shell. Using the command "python web2py.py -M -S appname" worked fine with 2.5, but now it doesn't seem to import the database models. I get the error "name 'db' is not defined" when trying to query the database. This runs web2py in IPython 1.0.0 When I run Web2py in a plain python shell using "python web2py.py -M -P -S appname", then querying the database works fine. Not the biggest problem, but I do enjoy using IPython and wanted to see if others were having problems with the database models not importing (even with the -M option). I'm doing this on Pythonanywhere; the problem arose immediately after the web2py upgrade and not any Pythonanywhere changes. -- 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] 1071, 'Specified key was too long; max key length is 767 bytes'
Just wanted to chime in on this. For me, I had to add a "length=255" to all my "unique=True" fields, even after adding length=255 for the "string" fields. On Wednesday, October 9, 2013 11:46:48 AM UTC-7, Niphlod wrote: > > sorry for being late. This is from web2py's 2.6.0 changelog. > > Attention MySQL users: The length of string fields changed from 255 to 512 > bytes. If you have migrations enabled this will trigger a large migration. > To prevent it, first set migrate_enabled=False, upgrade, check everything > is ok, then add length=255 to your string Fields, then re-enable migrations > with migrate_enabled=True if needed. > > tl;dr: remember to ALWAYS set length= for strings. > > tl;dr n.2 : Mysql has huge issues. One of them is that you can't index a > too large column. > > > On Wednesday, October 9, 2013 9:25:51 AM UTC+2, Gwayne aka Mike Veltman > wrote: >> >> >> >> I found it. >> >> >> >> It was in db.py >> >> >> >> db.define_table('frame', >> >> >> >> Field('framename', type='string', >> >> # #unique=True, < >> the problem. Is it a bug ? >> >> label=T('Framename')), >> >> Field('description', type='string', >> >> label=T('Description')), >> >> Field('netboot', type='string',default="None", >> >> label=T('Netboot information')), >> >> Field('ip', type='string', >> >> #unique=True, >> >> label=T('IP Address')), >> >> Field('servermodel', type='string',default="p6", >> >> label=T('Server model')), >> >> Field('serial', type='string',default="None", >> >> label=T('Serial Number')), >> >> Field('lvname', type='string',default="FRAMEx", >> >> label=T('Frame extension for storage logical volumes')), >> >> Field('framestaterecord_ID', type='integer', >> >> label=T('Frame State record ID')), >> >> Field('created_on','datetime',default=request.now, >> >> label=T('Created On'),writable=False,readable=False), >> >> Field('modified_on','datetime',default=request.now, >> >> label=T('Modified On'),writable=False,readable=False, >> >> update=request.now), >> >> format='%(framename)s', >> >> migrate=True) >> >> >> >> >> >> >> >> On Tuesday 08 October 2013 13:41:31 Mike Veltman wrote: >> >> Ok, I am now fighting with it for two days and it drives me crazy. >> >> My gut feeling says mysql 5.1 --> mysql 5.5 upgrade is the cause. Am I >> right ? And how do I solve it. :-) >> >> >> >> Error ticket for "adeploy" >> >> Ticket ID >> >> 192.168.2.106.2013-10-08.12-46-19.24f3f1a5-d637-4522-965b-fed4958115ed >> >> (1071, 'Specified key was >> too long; max key length is 767 bytes') >> >> Version >> >> web2py™ >> >> Version 2.7.2-stable+timestamp.2013.10.07.13.52.24 >> >> Traceback >> >> >> >> 1. >> 2. >> 3. >> 4. >> 5. >> 6. >> 7. >> 8. >> 9. >> 10. >> 11. >> 12. >> 13. >> 14. >> 15. >> 16. >> 17. >> 18. >> 19. >> 20. >> 21. >> 22. >> >> Traceback (most recent call last): >> File "/srv/web-apps/web2py/gluon/restricted.py", line 217, in restricted >> exec ccode in environment >> File "/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py", line >> 178, in >> File "/srv/web-apps/web2py/gluon/dal.py", line 7911, in define_table >> table = self.lazy_define_table(tablename,*fields,**args) >> File "/srv/web-apps/web2py/gluon/dal.py", line 7948, in lazy_define_table >> polymodel=polymodel) >> File "/srv/web-apps/web2py/gluon/dal.py", line 1029, in create_table >> fake_migrate=fake_migrate) >> File "/srv/web-apps/web2py/gluon/dal.py", line 1136, in migrate_table >> self.execute(sub_query) >> File "/srv/web-apps/web2py/gluon/dal.py", line 1836, in execute >> return self.log_execute(*a, **b) >> File "/srv/web-apps/web2py/gluon/dal.py", line 1830, in log_execute >> ret = self.cursor.execute(command, *a[1:], **b) >> File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 173, in >> execute >> self.errorhandler(self, exc, value) >> File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, >> in defaulterrorhandler >> raise errorclass, errorvalue >> OperationalError: (1071, 'Specified key was too long; max key length is >> 767 bytes') >> >> In file: /srv/web-apps/web2py/applications/adeploy/compiled/models/db.pyc >> >> 1. >> >> at 0x168c468, file >> "/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py", line >> 28> >> >> >> >> >> >> >> >> -- 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: Specifying onvalidation with auth.profile() prevents default onaccepts method
Ahh ok, thanks Anthony. If the form is being processed before adding the extra element to the DOM, then is it possible to add an error like form.errors.confirm_password = "Must enter correct password" This would usually cause the error message to appear below the input row, but the confirm_password field does not display the error in this case. Would I have to manually check for an error and add an error div, or is there still a way to use the builtin error messages? On Friday, September 6, 2013 6:42:40 AM UTC-7, Anthony wrote: > > You are adding an element to the form DOM after the form has been > processed, so the new field will not get added to form.vars. However, in > your onvalidation function, you should be able to replace > form.vars.confirm_password with request.vars.confirm_password. > > Anthony > > On Friday, September 6, 2013 2:17:49 AM UTC-4, Mark Li wrote: >> >> Thanks Massimo. However, using >> auth.settings.profile_onvalidation.append(reauthenticate_user) >> >> has presented a problem of its own. >> >> I insert an extra field ("confirm_password"), to recheck in the >> onvalidation method. However, the form.vars does not contain >> form.vars.confirm_password, which worked before when I was using form. >> process(onvalidation=reauthenticate_user) >> >> >> Here is the relevant code: >> >> auth.settings.profile_onvalidation.append(reauthenticate_user) >> form=auth.profile() >> my_extra_element = TR(LABEL('Confirm Password'),INPUT(_type="password", >> _name="confirm_password", _class="string")) >> form[0].insert(-1,my_extra_element) >> >> >> def reauthenticate_user(form): >> #recheck the user password >> plain_password = form.vars.confirm_password >> if db.auth_user.password.validate(plain_password) != (db(db.auth_user >> .id==auth.user.id).select().first().password, None): >> form.errors.confirm_password = "Must enter correct password" >> >> >> The form passed into reauthenticate_user does not contain >> form.vars.confirm_password variable. Any ideas on why this happens now, but >> not before? >> >> >> On Thursday, September 5, 2013 4:46:11 PM UTC-7, Massimo Di Pierro wrote: >>> >>> This >>> >>> form = auth.profile() >>> form.process(onvalidation=reauthenticate_user) >>> >>> is wrong because auth.profile() already calls process inside. Instead >>> you should do: >>> >>> auth.settings.profile_onvalidation.append(reauthenticate_user) >>> form = auth.profile() >>> >>> On Thursday, 5 September 2013 17:42:18 UTC-5, Mark Li wrote: >>>> >>>> Currently I am creating a form with auth.profile() >>>> >>>> I have an onvalidation method to perform some extra checks. >>>> >>>> form = auth.profile() >>>> if form.process(onvalidation=reauthenticate_user).accepted: >>>> >>>> response.flash = "Changes Saved" >>>> elif form.errors: >>>> >>>> response.flash = "Errors found >>>> >>>> >>>> >>>> This prevented auth.user object from being updated, which >>>> auth.profile() usually takes care of. >>>> >>>> I also tried it with the following: >>>> >>>> form = auth.profile() >>>> form.process(onvalidation=reauthenticate_user) >>>> >>>> >>>> >>>> but the default accepts method that usually updates auth.user doesn't >>>> work either >>>> >>>> For now, I've just added the following to the accepted method: >>>> auth.user.update(db.auth_user._filter_fields(form.vars)) >>>> >>>> But I'm interested in knowing if it's possible to specify an >>>> onvalidation method for auth.profile(), while still using the built-in >>>> accepts method. >>>> >>> -- --- 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: Specifying onvalidation with auth.profile() prevents default onaccepts method
Thanks Massimo. However, using auth.settings.profile_onvalidation.append(reauthenticate_user) has presented a problem of its own. I insert an extra field ("confirm_password"), to recheck in the onvalidation method. However, the form.vars does not contain form.vars.confirm_password, which worked before when I was using form. process(onvalidation=reauthenticate_user) Here is the relevant code: auth.settings.profile_onvalidation.append(reauthenticate_user) form=auth.profile() my_extra_element = TR(LABEL('Confirm Password'),INPUT(_type="password",_name ="confirm_password", _class="string")) form[0].insert(-1,my_extra_element) def reauthenticate_user(form): #recheck the user password plain_password = form.vars.confirm_password if db.auth_user.password.validate(plain_password) != (db(db.auth_user.id ==auth.user.id).select().first().password, None): form.errors.confirm_password = "Must enter correct password" The form passed into reauthenticate_user does not contain form.vars.confirm_password variable. Any ideas on why this happens now, but not before? On Thursday, September 5, 2013 4:46:11 PM UTC-7, Massimo Di Pierro wrote: > > This > > form = auth.profile() > form.process(onvalidation=reauthenticate_user) > > is wrong because auth.profile() already calls process inside. Instead you > should do: > > auth.settings.profile_onvalidation.append(reauthenticate_user) > form = auth.profile() > > On Thursday, 5 September 2013 17:42:18 UTC-5, Mark Li wrote: >> >> Currently I am creating a form with auth.profile() >> >> I have an onvalidation method to perform some extra checks. >> >> form = auth.profile() >> if form.process(onvalidation=reauthenticate_user).accepted: >> >> response.flash = "Changes Saved" >> elif form.errors: >> >> response.flash = "Errors found >> >> >> >> This prevented auth.user object from being updated, which auth.profile() >> usually takes care of. >> >> I also tried it with the following: >> >> form = auth.profile() >> form.process(onvalidation=reauthenticate_user) >> >> >> >> but the default accepts method that usually updates auth.user doesn't >> work either >> >> For now, I've just added the following to the accepted method: >> auth.user.update(db.auth_user._filter_fields(form.vars)) >> >> But I'm interested in knowing if it's possible to specify an onvalidation >> method for auth.profile(), while still using the built-in accepts method. >> > -- --- 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] Specifying onvalidation with auth.profile() prevents default onaccepts method
Currently I am creating a form with auth.profile() I have an onvalidation method to perform some extra checks. form = auth.profile() if form.process(onvalidation=reauthenticate_user).accepted: response.flash = "Changes Saved" elif form.errors: response.flash = "Errors found This prevented auth.user object from being updated, which auth.profile() usually takes care of. I also tried it with the following: form = auth.profile() form.process(onvalidation=reauthenticate_user) but the default accepts method that usually updates auth.user doesn't work either For now, I've just added the following to the accepted method: auth.user.update(db.auth_user._filter_fields(form.vars)) But I'm interested in knowing if it's possible to specify an onvalidation method for auth.profile(), while still using the built-in accepts method. -- --- 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: Force user to reenter password to save auth.profile() changes
For anyone else wondering how to do this, I decided to add a "password" field and have onvalidation check the password. This link gave me the idea for checking the text password against the encrypted pw: https://groups.google.com/forum/#!msg/web2py/eqbXmseZ6XA/abnGIMevI6wJ On Wednesday, August 7, 2013 10:18:17 PM UTC-7, Mark Li wrote: > > I currently have a "settings" page, where a form created by auth.profile() > is displayed. I want to force the user to re-enter his/her password in > order to save any changes they make to their profile (such as email, > username, etc). > > Not really sure the best way to go about this, all the authentication > stuff I've dealt with involves logging the user in with both email and pw. > In this case, the user is already logged in, but I just want them to > reenter their password before changing important profile information. > -- --- 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] Force user to reenter password to save auth.profile() changes
I currently have a "settings" page, where a form created by auth.profile() is displayed. I want to force the user to re-enter his/her password in order to save any changes they make to their profile (such as email, username, etc). Not really sure the best way to go about this, all the authentication stuff I've dealt with involves logging the user in with both email and pw. In this case, the user is already logged in, but I just want them to reenter their password before changing important profile information. -- --- 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: Inner join and left join in a many to many relationship
I think I've figured it out. I just needed one left join, but with the two arguments in the ON clause: query = ((db.likes.like_score!=-1) | (db.likes.like_score==None)) rows = db(query).select(db.songs.ALL, db.auth_user.id, db.likes.like_score, left=db.likes.on((db.likes.songname == db.songs.id) & (db.likes.username == auth.user.id)) , orderby='', limitby=(0,30)) If there are any mistakes please let me know! On Wednesday, July 17, 2013 8:05:18 PM UTC-7, Mark Li wrote: > > I have an intermediate table representing a many to many relationship > between users and songs. Users can like/dislike many songs, and songs can > be liked/disliked by many users. I am trying to retrieve a list of 30 > songs, that can be any songs except for songs that have been disliked by > the user. > > Here's a simplified version of the 3 tables: > > #Table 1: > db.define_table('auth_user', > Field('id') > ) > > #Table 2: > db.define_table('songs', > Field('id') > ) > > #Table 3 (intermediate) > db.define_table('likes_and_dislikes', > Field('username', 'reference auth_user'), > Field('songname','reference songs'), > Field('like_score', 'integer') > ) > > > > Originally I had made 2 database selects to accomplish this, first finding > all the songs that have been disliked by the user (this can be a very high > number), and then querying songs to avoid the disliked songs: > > disliked_ids = [] > dislike_query = (db.likes.username==auth.user.id) & (db.likes.like_score > ==-1) #score of -1 represents a dislike > disliked_songs = db(dislike_query).select().as_list() > for row in disliked_songs: > disliked_ids.append(row['songname']) > > query = (~db.songinfo.id.belongs(disliked_ids)) > song_rows = db(pre_query).select(orderby='', limitby=(0,30)) > > > I'm sure there's a more efficient way to do this, and I have been looking > into left joins and inner joins to accomplish everything in one database > select. My understanding of joins get a little hazy once there needs to be > more than join performed, any help is appreciated! > > > > -- --- 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] Inner join and left join in a many to many relationship
I have an intermediate table representing a many to many relationship between users and songs. Users can like/dislike many songs, and songs can be liked/disliked by many users. I am trying to retrieve a list of 30 songs, that can be any songs except for songs that have been disliked by the user. Here's a simplified version of the 3 tables: #Table 1: db.define_table('auth_user', Field('id') ) #Table 2: db.define_table('songs', Field('id') ) #Table 3 (intermediate) db.define_table('likes_and_dislikes', Field('username', 'reference auth_user'), Field('songname','reference songs'), Field('like_score', 'integer') ) Originally I had made 2 database selects to accomplish this, first finding all the songs that have been disliked by the user (this can be a very high number), and then querying songs to avoid the disliked songs: disliked_ids = [] dislike_query = (db.likes.username==auth.user.id) & (db.likes.like_score==-1 ) #score of -1 represents a dislike disliked_songs = db(dislike_query).select().as_list() for row in disliked_songs: disliked_ids.append(row['songname']) query = (~db.songinfo.id.belongs(disliked_ids)) song_rows = db(pre_query).select(orderby='', limitby=(0,30)) I'm sure there's a more efficient way to do this, and I have been looking into left joins and inner joins to accomplish everything in one database select. My understanding of joins get a little hazy once there needs to be more than join performed, any help is appreciated! -- --- 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: Remember me with custom or alternate login?
Ahh yep that did the trick, thanks for the help Anthony! On Thursday, June 6, 2013 3:07:31 PM UTC-7, Anthony wrote: > > Yes, sorry, there's one more thing you have to do -- you have to convert > the session cookie to a non-session cookie: > > response.cookies[response.session_id_name]["expires"] = session.auth. > expiration > > That will happen the next time Auth is initialized (which would happen on > the next request), but it won't happen if you simply close the browser. > > Anthony > > On Thursday, June 6, 2013 5:33:37 PM UTC-4, Mark Li wrote: >> >> Here's the relevant part of the code I'm using. I make an ajax call to >> the function below >> >> def ajax_login(): >> email = request.vars.email >> password = request.vars.password >> remember_me = request.vars.remember_me >> >> user = auth.login_bare(email, password) >> if user: >> if remember_me: >> session.auth.expiration = auth.settings.long_expiration >> session.auth.remember = True >> >> >> >> -- --- 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: Remember me with custom or alternate login?
Here's the relevant part of the code I'm using. I make an ajax call to the function below def ajax_login(): email = request.vars.email password = request.vars.password remember_me = request.vars.remember_me user = auth.login_bare(email, password) if user: if remember_me: session.auth.expiration = auth.settings.long_expiration session.auth.remember = True -- --- 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: Remember me with custom or alternate login?
Does anyone know why the session.auth.remember and session.auth.expiration are only saved after a new page load? Currently, I am making an ajax call that sets session.auth.remember and session.auth.expiration (after auth.login_bare()). If I close the browser after the ajax call without a new page load, then the session.auth.remember is not saved and the user is not logged in. However, if I make the ajax call, then load a new page/refresh the page, and then close the browser, session.auth.remember is saved. Is there any reason why a page refresh/load does this, and why the ajax call alone will not save session.auth.remember and session.auth.expiration (and thus keep the user logged in)? -- --- 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] DAL and MySQL indexing
Awesome, thanks for that! On Thursday, January 31, 2013 4:43:24 PM UTC-8, rochacbruno wrote: > > Since you have the indexes created on DB backend, The DAL will use this > for any query on that table, because the output of .select() is in fact a > pure SQL statement. > > > -- --- 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] DAL and MySQL indexing
Simple question. My web2py app just received a heavy amount of traffic, and I was looking for ways I could optimize performance. I am currently using MySQL, and using a database query like rows = db(db.tablename.category=="category_name").select() I am aware that web2py does not automatically create indexes for the database table. After I've created indexes for the table, is it necessary to use Raw SQL through db.executesql() to take advantage of MySQL indexing, or can I still use the same DAL query? -- --- 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: Register action using info from POST
Thanks for the tips Anthony! I'm going to look more into the first method you suggested. Do you know if enabling Captcha would affect the custom register action if I used auth.register()? Right now, the db.auth_user.validate_and_insert(**fields) works fine. I would be unable to implement Captcha on the clientside (android app), so would auth.register() not work in that case if I have Captchas enabled? On Thursday, January 24, 2013 4:57:51 AM UTC, Anthony wrote: > > Or an easier option is to use the > auth.get_or_create_user()<http://code.google.com/p/web2py/source/browse/gluon/tools.py#1704>method, > though that doesn't provide the password verification > field/validation that the auth.register() function includes (which you may > not want anyway). It also won't provide the CSRF protection that the > auth.register() formkey provides. > > Anthony > > On Wednesday, January 23, 2013 11:45:15 PM UTC-5, Anthony wrote: >> >> You might consider looking at the auth.register() code: >> http://code.google.com/p/web2py/source/browse/gluon/tools.py#2168 >> >> Another option might be to generate an auth.register() form and send the >> formkey to the client to be passed back as a hidden field in the POST call. >> You can then let the web2py auth.register() function handle the >> registration as usual. >> >> If you use a web2py view to create the register form, you can do: >> >> > /> >> >> >> Otherwise, you can make an Ajax request to get a formkey: >> >> def get_formkey(): >> return auth.register().formkey >> >> That will put the formkey in the session, and when the form is submitted, >> the submitted formkey value will be compared to the value in the session. >> Note, you also need to send a "_formname" field with the value "register". >> >> Your register function could then be: >> >> def register(): >> auth.register() >> return 'An error occurred' >> >> Note, by default, if the registration is accepted, that will do a >> client-side redirect to auth.settings.register_next (assuming web2py.js is >> loaded in the client). If you don't want a redirect, you can define an >> onaccept function that raises an HTTP >> exception<http://web2py.com/books/default/chapter/29/04#HTTP-and-redirect>in >> order to return a string: >> >> def register(): >> def success(form): >> raise HTTP(200, 'Success') >> auth.register(onaccept=success) >> return 'An error occurred' >> >> This is untested, so I may have missed something. >> >> Anthony >> >> On Wednesday, January 23, 2013 6:11:26 PM UTC-5, Mark Li wrote: >>> >>> I have decided to use validate_and_insert with web2py's REST methods >>> >>> db.auth_user.validate_and_insert(**fields) >>> >>> Testing so far, I was able to add a user even though the email and >>> password fields were empty in the POST call. I altered my api action so >>> that it checks whether or not the email and password fields in the request >>> are empty. All other validators seem to be working fine. >>> >>> If anyone has previous experience with validate_and_insert with the >>> auth_user table, and knows of any registration holes this way, please let >>> me know! >>> >>> >>> On Tuesday, January 22, 2013 6:50:06 PM UTC-8, Mark Li wrote: >>>> >>>> I am currently using web2py's auth to return a registration form. >>>> >>>> However, I would also like users to be able to register RESTfully, with >>>> the email and password information in a POST call. How would I write a >>>> register action that mimics auth.register(), except the information is >>>> from >>>> a POST, not a form. >>>> >>> -- --- 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: Register action using info from POST
I have decided to use validate_and_insert with web2py's REST methods db.auth_user.validate_and_insert(**fields) Testing so far, I was able to add a user even though the email and password fields were empty in the POST call. I altered my api action so that it checks whether or not the email and password fields in the request are empty. All other validators seem to be working fine. If anyone has previous experience with validate_and_insert with the auth_user table, and knows of any registration holes this way, please let me know! On Tuesday, January 22, 2013 6:50:06 PM UTC-8, Mark Li wrote: > > I am currently using web2py's auth to return a registration form. > > However, I would also like users to be able to register RESTfully, with > the email and password information in a POST call. How would I write a > register action that mimics auth.register(), except the information is from > a POST, not a form. > --
[web2py] Register action using info from POST
I am currently using web2py's auth to return a registration form. However, I would also like users to be able to register RESTfully, with the email and password information in a POST call. How would I write a register action that mimics auth.register(), except the information is from a POST, not a form. --
[web2py] Re: Httponly for cookies/sessions
Yep that did the trick, thanks Anthony! On Monday, January 14, 2013 2:45:21 PM UTC-8, Mark Li wrote: > > I haven't found anything in the web2py documentation about setting the > httponly attribute for cookies and sessions. > > For sessions, there is session.secure() to set the session cookies to > secure, is there a similiar method to setting the httponly option for > session cookies? > > > Also for regular cookies, the following would make the cookie secure > > response.cookies['mycookie']['secure'] = True > > > So is there something similar you can do to set HttpOnly to true? > --
[web2py] Re: Httponly for cookies/sessions
On Monday, January 14, 2013 2:45:21 PM UTC-8, Mark Li wrote: > > I haven't found anything in the web2py documentation about setting the > httponly attribute for cookies and sessions. > > For sessions, there is session.secure() to set the session cookies to > secure, is there a similiar method to setting the httponly option for > session cookies? > > > Also for regular cookies, the following would make the cookie secure > > response.cookies['mycookie']['secure'] = True > > > So is there something similar you can do to set HttpOnly to true? > --
[web2py] Httponly for cookies/sessions
I haven't found anything in the web2py documentation about setting the httponly attribute for cookies and sessions. For sessions, there is session.secure() to set the session cookies to secure, is there a similiar method to setting the httponly option for session cookies? Also for regular cookies, the following would make the cookie secure response.cookies['mycookie']['secure'] = True So is there something similar you can do to set HttpOnly to true? --
[web2py] Re: Returning a token for Android app authentication
Would it be necessary to connect to the same web2py session? To my understanding, connecting to the same session would be necessary if the session contained Auth information indicating whether or not a user was logged in. However, using auth.login_bare(), I only return a token on login success, and the Auth information is never stored in session. Only the token would be used to check whether or not a user was authenticated, as this info is not stored in session. The login/authentication from Android would only be used for API calls, and not for browsing the site. In the 'tokens' table, there would be information about the user that would be similar to the Auth info stored in session. When the token is passed to web2py, it would return the same information that would normally be stored in session about the user. Thanks again for your help and checking my logic, I'm still pretty new to this! On Thursday, January 3, 2013 7:57:45 PM UTC-8, dlypka wrote: > > But are you reconnecting to the same web2py session on each request? > > On Thursday, January 3, 2013 3:20:01 PM UTC-6, Mark Li wrote: >> >> I reviewed your code again and looked into the source code for web2py to >> see how web2py deals with session login cookies. >> >> For what I want to accomplish, I believe I have found a method which does >> not involved changing web2py source code. It's simpler and more straight >> forward for me to wrap my head around (also not having to worry about >> storing cookies in the app). Please let me know if there's anything >> important I am missing or security flaws that I should consider. >> >> >> 1. Embed webview into native Android app, using auth.login_bare to >> authenticate. >> 2. On login success, return a token of similar format to web2py's session >> cookies. >> 3. Store this token in the database (in a table named 'tokens'), and send >> back to Android app as a cookie >> 4. For every request to my web service that requires authentication, send >> the token as a cookie and have the receiving API controller function >> extract the cookie/token. If the token is currently in the db.tokens, then >> the user has been authenticated and the request returns the appropriate >> data. >> 5. On logout/password change, delete the issued tokens for this user from >> db.tokens, so the same token can't be used to authenticate for future api >> calls. >> >> On Tuesday, January 1, 2013 10:33:26 PM UTC-8, dlypka wrote: >>> >>> I was not precisely calling from a native Android or native IOS app. >>> I was using a PhoneGap client, which is different. It is looks like a >>> web browser but is not a browser client. >>> PhoneGap can only use HTML5 storage unless you write a native Android / >>> IOS PhoneGap extension/plugin. >>> So my technique will work from almost any client platform, even from a >>> Windows native client app for example >>> as long as it uses HTTP. >>> >>> Also, in my tracing of how web2py handles the client connection, I >>> believe I found a few wrinkles in the sequence of events >>> which needed to be handled specially in this case where the client is >>> not a web browser. >>> >>> In your particular case, if you have cookies in the native client, then >>> that is one less problem to solve, >>> You probably just have to mimic the HTTP messages that a browser would >>> send. >>> >>> On Tuesday, January 1, 2013 5:19:50 PM UTC-6, Mark Li wrote: >>>> >>>> Thanks for the responses, and Happy New Years to you guys too! >>>> >>>> dlypka, for your cookieless solution, it assumes that the client app >>>> can't store/extract tokens? In the Google Android link above, it says that >>>> both Android and iOS can read and extract the tokens/cookies. So when the >>>> Android app calls the Web2py app, wouldn't it just pass in the >>>> cookie/token >>>> and have Web2py verify it as it Web2py normally verifies session login >>>> cookies? >>>> >>>> >>>> >>>> On Tuesday, January 1, 2013 9:07:16 AM UTC-8, Massimo Di Pierro wrote: >>>>> >>>>> :-) >>>>> >>>>> >>>>> >>>>> On Tuesday, 1 January 2013 10:45:47 UTC-6, dlypka wrote: >>>>>> >>>>>> Yes it is my New Year's Resolution to make time to put it in a Slice. >>>>>> >>>>>> On Tuesday, January
[web2py] Re: Returning a token for Android app authentication
I reviewed your code again and looked into the source code for web2py to see how web2py deals with session login cookies. For what I want to accomplish, I believe I have found a method which does not involved changing web2py source code. It's simpler and more straight forward for me to wrap my head around (also not having to worry about storing cookies in the app). Please let me know if there's anything important I am missing or security flaws that I should consider. 1. Embed webview into native Android app, using auth.login_bare to authenticate. 2. On login success, return a token of similar format to web2py's session cookies. 3. Store this token in the database (in a table named 'tokens'), and send back to Android app as a cookie 4. For every request to my web service that requires authentication, send the token as a cookie and have the receiving API controller function extract the cookie/token. If the token is currently in the db.tokens, then the user has been authenticated and the request returns the appropriate data. 5. On logout/password change, delete the issued tokens for this user from db.tokens, so the same token can't be used to authenticate for future api calls. On Tuesday, January 1, 2013 10:33:26 PM UTC-8, dlypka wrote: > > I was not precisely calling from a native Android or native IOS app. > I was using a PhoneGap client, which is different. It is looks like a web > browser but is not a browser client. > PhoneGap can only use HTML5 storage unless you write a native Android / > IOS PhoneGap extension/plugin. > So my technique will work from almost any client platform, even from a > Windows native client app for example > as long as it uses HTTP. > > Also, in my tracing of how web2py handles the client connection, I believe > I found a few wrinkles in the sequence of events > which needed to be handled specially in this case where the client is not > a web browser. > > In your particular case, if you have cookies in the native client, then > that is one less problem to solve, > You probably just have to mimic the HTTP messages that a browser would > send. > > On Tuesday, January 1, 2013 5:19:50 PM UTC-6, Mark Li wrote: >> >> Thanks for the responses, and Happy New Years to you guys too! >> >> dlypka, for your cookieless solution, it assumes that the client app >> can't store/extract tokens? In the Google Android link above, it says that >> both Android and iOS can read and extract the tokens/cookies. So when the >> Android app calls the Web2py app, wouldn't it just pass in the cookie/token >> and have Web2py verify it as it Web2py normally verifies session login >> cookies? >> >> >> >> On Tuesday, January 1, 2013 9:07:16 AM UTC-8, Massimo Di Pierro wrote: >>> >>> :-) >>> >>> >>> >>> On Tuesday, 1 January 2013 10:45:47 UTC-6, dlypka wrote: >>>> >>>> Yes it is my New Year's Resolution to make time to put it in a Slice. >>>> >>>> On Tuesday, January 1, 2013 10:35:49 AM UTC-6, Massimo Di Pierro wrote: >>>>> >>>>> Perhaps this should go in a web2pyslice? >>>>> >>>>> On Monday, 31 December 2012 21:28:04 UTC-6, dlypka wrote: >>>>>> >>>>>> I developed a solution for this. >>>>>> I posted it here: >>>>>> https://groups.google.com/forum/?fromgroups=#!topic/web2py/YVYQHRJmcos >>>>>> >>>>>> Happy New Year! >>>>>> >>>>>> >>>>>> On Monday, December 31, 2012 4:38:40 PM UTC-6, Mark Li wrote: >>>>>>> >>>>>>> I am currently trying to authenticate users on an Android app to my >>>>>>> Web2py application. I am not comfortable implementing this on my own >>>>>>> without some guidance/advice, as I'm worried about the security of the >>>>>>> login information becoming jeopardized. >>>>>>> >>>>>>> >>>>>>> I am following the guideline for authentication outlined by Google >>>>>>> here: https://developers.google.com/accounts/docs/MobileApps >>>>>>> >>>>>>> Another outline of what how I'm trying to accomplish Authentication >>>>>>> outlined here: >>>>>>> http://stackoverflow.com/questions/7358715/authentication-model-for-android-application >>>>>>> >>>>>>> >>>>>>> The first step, and my question, is how I would generate a token to >>>>>>> return to the Android app after the user has successfully logged in. It >>>>>>> is >>>>>>> suggested that this token be in the same format to what Web2py uses for >>>>>>> session login cookies, except with a 'mobile' flag indicating the token >>>>>>> can >>>>>>> only be used for API calls, and doesn't have the short lifespan of a >>>>>>> browser session. >>>>>>> >>>>>>> Any help would be greatly appreciated, as I haven't read too much >>>>>>> about authentication to web2py from an Android app. >>>>>>> >>>>>> --
[web2py] Re: Returning a token for Android app authentication
Thanks for the responses, and Happy New Years to you guys too! dlypka, for your cookieless solution, it assumes that the client app can't store/extract tokens? In the Google Android link above, it says that both Android and iOS can read and extract the tokens/cookies. So when the Android app calls the Web2py app, wouldn't it just pass in the cookie/token and have Web2py verify it as it Web2py normally verifies session login cookies? On Tuesday, January 1, 2013 9:07:16 AM UTC-8, Massimo Di Pierro wrote: > > :-) > > > > On Tuesday, 1 January 2013 10:45:47 UTC-6, dlypka wrote: >> >> Yes it is my New Year's Resolution to make time to put it in a Slice. >> >> On Tuesday, January 1, 2013 10:35:49 AM UTC-6, Massimo Di Pierro wrote: >>> >>> Perhaps this should go in a web2pyslice? >>> >>> On Monday, 31 December 2012 21:28:04 UTC-6, dlypka wrote: >>>> >>>> I developed a solution for this. >>>> I posted it here: >>>> https://groups.google.com/forum/?fromgroups=#!topic/web2py/YVYQHRJmcos >>>> >>>> Happy New Year! >>>> >>>> >>>> On Monday, December 31, 2012 4:38:40 PM UTC-6, Mark Li wrote: >>>>> >>>>> I am currently trying to authenticate users on an Android app to my >>>>> Web2py application. I am not comfortable implementing this on my own >>>>> without some guidance/advice, as I'm worried about the security of the >>>>> login information becoming jeopardized. >>>>> >>>>> >>>>> I am following the guideline for authentication outlined by Google >>>>> here: https://developers.google.com/accounts/docs/MobileApps >>>>> >>>>> Another outline of what how I'm trying to accomplish Authentication >>>>> outlined here: >>>>> http://stackoverflow.com/questions/7358715/authentication-model-for-android-application >>>>> >>>>> >>>>> The first step, and my question, is how I would generate a token to >>>>> return to the Android app after the user has successfully logged in. It >>>>> is >>>>> suggested that this token be in the same format to what Web2py uses for >>>>> session login cookies, except with a 'mobile' flag indicating the token >>>>> can >>>>> only be used for API calls, and doesn't have the short lifespan of a >>>>> browser session. >>>>> >>>>> Any help would be greatly appreciated, as I haven't read too much >>>>> about authentication to web2py from an Android app. >>>>> >>>> --
[web2py] Returning a token for Android app authentication
I am currently trying to authenticate users on an Android app to my Web2py application. I am not comfortable implementing this on my own without some guidance/advice, as I'm worried about the security of the login information becoming jeopardized. I am following the guideline for authentication outlined by Google here: https://developers.google.com/accounts/docs/MobileApps Another outline of what how I'm trying to accomplish Authentication outlined here: http://stackoverflow.com/questions/7358715/authentication-model-for-android-application The first step, and my question, is how I would generate a token to return to the Android app after the user has successfully logged in. It is suggested that this token be in the same format to what Web2py uses for session login cookies, except with a 'mobile' flag indicating the token can only be used for API calls, and doesn't have the short lifespan of a browser session. Any help would be greatly appreciated, as I haven't read too much about authentication to web2py from an Android app. --
Re: [web2py] Standalone DAL fetching old/obsolete data (mysql)
Ah so simple! I assumed that since the button called a controller action in the web2py environment, that I would not need an explicit db.commit() (as I don't need it with the webapp). But yes, for a script outside of web2py using DAL, the db.commit() updated the value for the new fetched row. On Wednesday, November 28, 2012 10:02:57 PM UTC-8, rochacbruno wrote: > > You need to use > > *db.commit()* just after you update any value. > > db.table.update(field=0) > db.commit() > > *Bruno Cezar Rocha** - @rochacbruno* > rocha...@gmail.com | Mobile: +55 (11) 99210-8821 > www.CursoDePython.com.br | www.rochacbruno.com.br > Blog: Search form with > web2py<http://rochacbruno.com.br/search-form-with-web2py/> > Get a signature like this. > <http://r1.wisestamp.com/r/landing?promo=18&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18> > Click > here.<http://r1.wisestamp.com/r/landing?promo=18&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18> > > > > > On Thu, Nov 29, 2012 at 2:36 AM, Mark Li > > wrote: > >> For some functional tests I'm running, I am fetching a row, clicking on a >> button, and then fetching the same row to see if the button action worked. >> >> I have the following to establish a database connection (using DAL >> outside of web2py environment): >> path_to_database = path.join(path.curdir, "databases") >> db = DAL('mysql://username:password@localhost/test') >> db.import_table_definitions(path_to_database) >> >> I then run the following to fetch a row: >> >> row = db(db.likes.id>0).select().first() >> print row.like_score >> >> which prints "1" as expected >> >> Then I click a button (through Selenium webdriver), which sets the score >> back to "0" >> button.click() >> time.sleep(2) >> >> #checking the db, the score is already 0 before the row is fetched >> row2 = db(db.likes.id>0).select().first() >> print row2.like_score >> >> However, the printed score is still "1". >> >> This was not a problem using SQLite, and the score in the database is 0, >> which I confirmed by only fetching the row AFTER the button is clicked. The >> problem arises when fetching the same row more than once. >> >> When fetching the row a 2nd time, I am getting old/obsolete data, instead >> of getting the same row with new data. Any ideas as to how I can fix this? >> >> -- >> >> >> >> > > > --
[web2py] Standalone DAL fetching old/obsolete data (mysql)
For some functional tests I'm running, I am fetching a row, clicking on a button, and then fetching the same row to see if the button action worked. I have the following to establish a database connection (using DAL outside of web2py environment): path_to_database = path.join(path.curdir, "databases") db = DAL('mysql://username:password@localhost/test') db.import_table_definitions(path_to_database) I then run the following to fetch a row: row = db(db.likes.id>0).select().first() print row.like_score which prints "1" as expected Then I click a button (through Selenium webdriver), which sets the score back to "0" button.click() time.sleep(2) #checking the db, the score is already 0 before the row is fetched row2 = db(db.likes.id>0).select().first() print row2.like_score However, the printed score is still "1". This was not a problem using SQLite, and the score in the database is 0, which I confirmed by only fetching the row AFTER the button is clicked. The problem arises when fetching the same row more than once. When fetching the row a 2nd time, I am getting old/obsolete data, instead of getting the same row with new data. Any ideas as to how I can fix this? --
[web2py] Re: Changing auth validator error messages
db.auth_user.email.requires[1].error_message = T("The email you have entered has already been registered.") Try using the index of 1, not 0. On Wednesday, November 28, 2012 4:55:54 PM UTC, Daniele wrote: > > I'd also like to change that error message "value already in database or > empty" as I find it a pointless message. > But I tried with db.auth_user.email.requires[0].error_message = T("The > email you have entered has already been registered.") > and it doesn't seem to change anything. Am I misplacing this? I put it in > the db.py file after the > auth.define_tables(username=False, signature=False) > > Thanks > > On Monday, September 17, 2012 3:21:00 AM UTC+1, Mark Li wrote: >> >> Is it possible to change the validator error messages in for auth fields >> like "value already in database or empty," without having to redefine all >> the validators for that field? For example, I wanted to change the >> validator error message for IS_NOT_IN_DB for auth_user.email, and I wrote: >> >> db.auth_user.email.requires=IS_NOT_IN_DB(db, auth_user.email,error_message >> =T("Email already in use")) >> >> >> Would I have to define all the validators for auth_user.email now? Is >> there a less intrusive way of changing the error message without overriding >> the default validators for auth? >> > --
[web2py] Re: Orderby does not work field type 'double', sorts as if floats were strings
Ahh thanks Niphlod! On Thursday, November 22, 2012 2:49:28 PM UTC-8, Niphlod wrote: > > yep, support for decimal is kinda absent so it's treated "like a string". > > On Thursday, November 22, 2012 10:10:23 PM UTC+1, Mark Li wrote: >> >> Yes this is on SQLite, is this a problem unique to SQLite? >> >> On Thursday, November 22, 2012 1:58:41 AM UTC-8, Niphlod wrote: >>> >>> is this on SQLite ? >>> >>> On Thursday, November 22, 2012 3:44:38 AM UTC+1, Mark Li wrote: >>>> >>>> I currently have a table with 'scores' as one of the fields, with the >>>> field type 'double'. >>>> >>>> When I go to fetch a row (ordered by scores) and print the scores, they >>>> come back sorted as if they were strings. >>>> I use the following: >>>> >>>> rows = db(db.song_table).select(orderby = db.song_table.scores) >>>> for x in rows: >>>> print x.scores >>>> >>>> this prints out the following: >>>> >>>> -15.0 >>>> -16.0 >>>> -17.0 >>>> -2.0 >>>> -20.0 >>>> -34.0 >>>> 0.0 >>>> 0.0 >>>> 15.0 >>>> 2.0 >>>> 20.0 >>>> >>>> >>>> The scores are ordered as if they were strings, not numbers. However, >>>> when you fetch a score, it is still a float, not a string. >>>> >>>> Is this intended behavior, or a bug with field type 'double'? >>>> >>>> >>>> I am aware that for field type 'integer', the scores are sorted >>>> properly, but I will have decimals in my scores. >>>> >>>> >>>> >>>> --
[web2py] Re: Orderby does not work field type 'double', sorts as if floats were strings
Yes this is on SQLite, is this a problem unique to SQLite? On Thursday, November 22, 2012 1:58:41 AM UTC-8, Niphlod wrote: > > is this on SQLite ? > > On Thursday, November 22, 2012 3:44:38 AM UTC+1, Mark Li wrote: >> >> I currently have a table with 'scores' as one of the fields, with the >> field type 'double'. >> >> When I go to fetch a row (ordered by scores) and print the scores, they >> come back sorted as if they were strings. >> I use the following: >> >> rows = db(db.song_table).select(orderby = db.song_table.scores) >> for x in rows: >> print x.scores >> >> this prints out the following: >> >> -15.0 >> -16.0 >> -17.0 >> -2.0 >> -20.0 >> -34.0 >> 0.0 >> 0.0 >> 15.0 >> 2.0 >> 20.0 >> >> >> The scores are ordered as if they were strings, not numbers. However, >> when you fetch a score, it is still a float, not a string. >> >> Is this intended behavior, or a bug with field type 'double'? >> >> >> I am aware that for field type 'integer', the scores are sorted properly, >> but I will have decimals in my scores. >> >> >> >> --
[web2py] Orderby does not work field type 'double', sorts as if floats were strings
I currently have a table with 'scores' as one of the fields, with the field type 'double'. When I go to fetch a row (ordered by scores) and print the scores, they come back sorted as if they were strings. I use the following: rows = db(db.song_table).select(orderby = db.song_table.scores) for x in rows: print x.scores this prints out the following: -15.0 -16.0 -17.0 -2.0 -20.0 -34.0 0.0 0.0 15.0 2.0 20.0 The scores are ordered as if they were strings, not numbers. However, when you fetch a score, it is still a float, not a string. Is this intended behavior, or a bug with field type 'double'? I am aware that for field type 'integer', the scores are sorted properly, but I will have decimals in my scores. --
[web2py] Re: Updating profile does not update auth.user for computed field
Here's the link to the ticket: http://code.google.com/p/web2py/issues/detail?id=1164&thanks=1164&ts=1352926016 On Wednesday, November 14, 2012 6:21:03 AM UTC-8, Massimo Di Pierro wrote: > > Please open a ticket and well' fix this asap. Probably today at the web2py > sprint at PyCon Ar. > > On Monday, 12 November 2012 22:40:14 UTC-6, Mark Li wrote: >> >> I am currently using auth.profile() for a form where users can update >> their information. I have an 'upload' field for images, and a computed >> field that creates a thumbnail of the previous field. >> >> When the user hits 'save profile', auth.user is updated only for the >> original 'upload' field, not the computed field. Is there anyway to update >> the computed field for auth.user as well (while still using the form >> created by auth.profile)? >> > --
[web2py] Updating profile does not update auth.user for computed field
I am currently using auth.profile() for a form where users can update their information. I have an 'upload' field for images, and a computed field that creates a thumbnail of the previous field. When the user hits 'save profile', auth.user is updated only for the original 'upload' field, not the computed field. Is there anyway to update the computed field for auth.user as well (while still using the form created by auth.profile)? --
[web2py] Re: autodelete image computed field
Any success on getting the computed thumbnail image to autodelete? I'm having trouble with this too, where an update of a new thumbnail will not delete the old file. On Saturday, April 28, 2012 5:06:25 PM UTC-7, ctrlSoft wrote: > > > hi i have a resize function wich creates image thumbanils... > def THUMB(image, nx=120, ny=120): > from PIL import Image > import os > try: > img = Image.open(request.folder + 'static/img_folder/' + image) > img.thumbnail((nx,ny), Image.ANTIALIAS) > root,ext = os.path.splitext(image) > thumb='%s_thumb%s' %(root, ext) > img.save(request.folder + 'static/img_folder/' + thumb) > return thumb > except: > return None > > and this : > db.define_table("news", > Field('image', 'upload', requires=IS_EMPTY_OR(IS_IMAGE()), > uploadfolder=request.folder+'static/img_folder', autodelete=True), > Field('image_thumb', 'upload', compute=lambda r: THUMB(r['image']), > autodelete=True), > Field("title",label=T('Title'),requires=IS_NOT_EMPTY()), > Field("content" > ,type='text',label=T('Content'),requires=IS_NOT_EMPTY())) > > the problem is when i delete a row, image("big image") is deleteing from > disk but the image_thumb stil remains on disk. > any solutions are welcome :), thx > > ___ > Alex > > --
[web2py] Append to list:reference or list:string with update_record
Is it possible to append to a database list (like list:reference or list:string) with update_record, as opposed to explicitly stating the whole list for update_record? --
Re: [web2py] Re: Best Method to implement a "like" button
Thanks for the response guys! I'm going with rochabruno's method as it is the most straightfoward, I hadn't really looked into the compute capabilities. On Tuesday, September 11, 2012 3:55:21 PM UTC-7, rochacbruno wrote: > > The computation should be > > compute= lambda row: "%(username)s-%(songname)s-%(playlist_name)s" % row > --
[web2py] Re: Changing auth validator error messages
Awesome, that worked and I didn't have to redefine the other validators for auth_user.email On Monday, September 17, 2012 11:52:38 AM UTC-7, Massimo Di Pierro wrote: > > sorry. Try: > > db.auth_user.email.requires[0].error_message = T("") > > On Monday, 17 September 2012 11:40:24 UTC-5, Mark Li wrote: >> >> Ok that answers my question; I would still have to define all the >> validators for auth_user.email (assuming there is more than one). >> >> Also just for claficiation, using the following: >> db.auth_user.email.requires.error_message = T("") >> >> >> gives me the following error message: >> 'list' object has no attribute >> 'error_message' >> >> >> >> >> >> On Sunday, September 16, 2012 7:37:52 PM UTC-7, Massimo Di Pierro wrote: >>> >>> I think you can do: >>> >>> db.auth_user.email.requires.error_message = T() >>> >>> Unless they have more then one validator. >>> >>> On Sunday, 16 September 2012 21:21:00 UTC-5, Mark Li wrote: >>>> >>>> Is it possible to change the validator error messages in for auth >>>> fields like "value already in database or empty," without having to >>>> redefine all the validators for that field? For example, I wanted to >>>> change >>>> the validator error message for IS_NOT_IN_DB for auth_user.email, and I >>>> wrote: >>>> >>>> db.auth_user.email.requires=IS_NOT_IN_DB(db, auth_user.email,error_message >>>> =T("Email already in use")) >>>> >>>> >>>> Would I have to define all the validators for auth_user.email now? Is >>>> there a less intrusive way of changing the error message without >>>> overriding >>>> the default validators for auth? >>>> >>> --
[web2py] Re: Specify sender name in auth.settings.mailer
Yep here it is: http://code.google.com/p/web2py/issues/detail?id=1017 On Monday, September 17, 2012 12:05:40 PM UTC-7, Massimo Di Pierro wrote: > > Looks like there is not but there should be. Can you please open a ticket > about this? > > On Monday, 17 September 2012 12:57:10 UTC-5, Mark Li wrote: >> >> I am using 'myco...@gmail.com' as my email address for >> auth.settings.mailer.settings.sender >> >> and the sender name shows up as 'mycompany' in the received email. >> However, I would like to edit the sender name so it is different from >> 'mycompany'. Is there any way to accomplish this using the mailer from Auth? >> > --
[web2py] Specify sender name in auth.settings.mailer
I am using 'mycomp...@gmail.com' as my email address for auth.settings.mailer.settings.sender and the sender name shows up as 'mycompany' in the received email. However, I would like to edit the sender name so it is different from 'mycompany'. Is there any way to accomplish this using the mailer from Auth? --
[web2py] Re: Changing auth validator error messages
Ok that answers my question; I would still have to define all the validators for auth_user.email (assuming there is more than one). Also just for claficiation, using the following: db.auth_user.email.requires.error_message = T("") gives me the following error message: 'list' object has no attribute 'error_message' On Sunday, September 16, 2012 7:37:52 PM UTC-7, Massimo Di Pierro wrote: > > I think you can do: > > db.auth_user.email.requires.error_message = T() > > Unless they have more then one validator. > > On Sunday, 16 September 2012 21:21:00 UTC-5, Mark Li wrote: >> >> Is it possible to change the validator error messages in for auth fields >> like "value already in database or empty," without having to redefine all >> the validators for that field? For example, I wanted to change the >> validator error message for IS_NOT_IN_DB for auth_user.email, and I wrote: >> >> db.auth_user.email.requires=IS_NOT_IN_DB(db, auth_user.email,error_message >> =T("Email already in use")) >> >> >> Would I have to define all the validators for auth_user.email now? Is >> there a less intrusive way of changing the error message without overriding >> the default validators for auth? >> > --
[web2py] Changing auth validator error messages
Is it possible to change the validator error messages in for auth fields like "value already in database or empty," without having to redefine all the validators for that field? For example, I wanted to change the validator error message for IS_NOT_IN_DB for auth_user.email, and I wrote: db.auth_user.email.requires=IS_NOT_IN_DB(db, auth_user.email, error_message= T("Email already in use")) Would I have to define all the validators for auth_user.email now? Is there a less intrusive way of changing the error message without overriding the default validators for auth? --
[web2py] Resend email_verify like request_reset_password
I would like to know how I should go about adding a 'resend_email_verify' action to utilize the 'request_reset_password' action, but instead of sending a link to the reset_password view, it simply resends auth.message.verify_email . --