[web2py] how to disable field access if not authorized
I'm using crud and want to disable access to certain fields if user is not a member of the admin group. For instance, content can only be approved by admin. I want to register the id of the user who approved the content, too. So I'd like to say: if not auth.has_membership(auth.id_group('Admin'),auth.user.id): db.content.approved.writable=False db.content.signature.writable=False form = crud.update(db.content,...) so that even if the view has this: {{=form.custom.widget.approved}} {{=form.custom.widget.signature}} the fields shouldn't be fillable by an unauthorized user. Problem is, this doesn't work and I get this ticket: Traceback (most recent call last): File "C:\web2py\gluon\restricted.py", line 173, in restricted exec ccode in environment File "C:/web2py/applications/myapp/controllers/admin.py", line 187, in File "C:\web2py\gluon\globals.py", line 96, in self._caller = lambda f: f() File "C:\web2py\gluon\tools.py", line 1873, in f return action(*a, **b) File "C:/web2py/applications/myapp/controllers/admin.py", line 59, in marketing form = crud.update(db.content,request.args(2),message=T('Updated content')) File "C:\web2py\gluon\tools.py", line 2270, in update keepvalues=self.settings.keepvalues): File "C:\web2py\gluon\sqlhtml.py", line 755, in accepts onvalidation, File "C:\web2py\gluon\html.py", line 1267, in accepts status = self._traverse(status) File "C:\web2py\gluon\html.py", line 449, in _traverse newstatus = c._traverse(status) and newstatus File "C:\web2py\gluon\html.py", line 449, in _traverse newstatus = c._traverse(status) and newstatus File "C:\web2py\gluon\html.py", line 449, in _traverse newstatus = c._traverse(status) and newstatus File "C:\web2py\gluon\html.py", line 449, in _traverse newstatus = c._traverse(status) and newstatus TypeError: 'NoneType' object is not callable Anybody know what's going on here? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] how to disable field access if not authorized
It looks as if request.args(2) is empty. -Thadeus On Sun, Feb 7, 2010 at 2:02 AM, weheh wrote: > I'm using crud and want to disable access to certain fields if user is > not a member of the admin group. For instance, content can only be > approved by admin. I want to register the id of the user who approved > the content, too. So I'd like to say: > > if not auth.has_membership(auth.id_group('Admin'),auth.user.id): > db.content.approved.writable=False > db.content.signature.writable=False > form = crud.update(db.content,...) > > so that even if the view has this: > {{=form.custom.widget.approved}} > {{=form.custom.widget.signature}} > > the fields shouldn't be fillable by an unauthorized user. Problem is, > this doesn't work and I get this ticket: > > Traceback (most recent call last): > File "C:\web2py\gluon\restricted.py", line 173, in restricted > exec ccode in environment > File "C:/web2py/applications/myapp/controllers/admin.py", line 187, > in > File "C:\web2py\gluon\globals.py", line 96, in > self._caller = lambda f: f() > File "C:\web2py\gluon\tools.py", line 1873, in f > return action(*a, **b) > File "C:/web2py/applications/myapp/controllers/admin.py", line 59, > in marketing > form = crud.update(db.content,request.args(2),message=T('Updated > content')) > File "C:\web2py\gluon\tools.py", line 2270, in update > keepvalues=self.settings.keepvalues): > File "C:\web2py\gluon\sqlhtml.py", line 755, in accepts > onvalidation, > File "C:\web2py\gluon\html.py", line 1267, in accepts > status = self._traverse(status) > File "C:\web2py\gluon\html.py", line 449, in _traverse > newstatus = c._traverse(status) and newstatus > File "C:\web2py\gluon\html.py", line 449, in _traverse > newstatus = c._traverse(status) and newstatus > File "C:\web2py\gluon\html.py", line 449, in _traverse > newstatus = c._traverse(status) and newstatus > File "C:\web2py\gluon\html.py", line 449, in _traverse > newstatus = c._traverse(status) and newstatus > TypeError: 'NoneType' object is not callable > > Anybody know what's going on here? > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: how to disable field access if not authorized
It's possible, but according to MDB, that would result in crud.update turning into crud.create. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Login form
On item 2, you should be using css. give the "string" class a width in ems or %. Stylize the font by setting font-size: 85%; or you can set it to a certain number of ems or pt. On Feb 5, 12:20 pm, sveinh wrote: > Thanks Massimo > > Your hint pointed me in the right direction. It had a few topos, > which I correct below. > > {{if not auth.user and not request.function=='user':}} > {{form=auth.login(next=URL(r=request, > args=request.args))}} > {{pass}} > > This displays the default render of the login form. Great. > > However, I would like to customise the render of the form to display a > different layout of the form if the user is not logged in. I guess I > could use custom form for this. Example: > > {{form=auth.login(next=URL(r=request, > args=request.args))}} > {{=form.custom.begin}} > {{=form.custom.label.username}}: > {{=form.custom.widget.username}} > {{=form.custom.label.password}}: > {{=form.custom.widget.password}} > Remember me: name="remember" > id="auth_user_remember" class="checkbox" /> > {{=form.custom.submit}} > {{=form.custom.end}} > > My two questions are: > > 1) The "remember" checkbox are not part of the form.custom.widget, > thus in the example above, I wrote the standard html out instead of > using the =form.custom... function. Is this standard behaviour? Or > should I expect the "remember" widget to be present? > > 2) I would like to display smaller sized version of the username and > password fields as opposed to the standard size of the input fields. > Would this be possible using the custom.form.something='size="8"', or > would I have to make a custom version of the example above like this: > > {{form=auth.login(next=URL(r=request, > args=request.args))}} > {{=form.custom.begin}} > name="username" > type="text" size="8" value="" /> > id="auth_user_password" name="password" > type="password" size="8" value="" /> > Remember: name="remember" > id="auth_user_remember" class="checkbox" /> > {{=form.custom.submit}} > {{=form.custom.end}} > > Again, thanks for the swift replies by this group! > > -sveinh > > On Feb 5, 3:33 pm, mdipierro wrote: > > > in layout.html > > > {{if not auth.user and not request.function=='user':}} > > {{=atuh.login(next=URL(r=request,args=args))}} > > {{pass}} > > > On Feb 5, 3:40 am, sveinh wrote: > > > > Hi all > > > > I would like to include a username+pw field and login button on all > > > pages if the user is not already logged in. I would like to use the > > > built-in functions of web2py to validate the login. > > > > What would be the best approach for this? I tried to create the fields > > > (as default/user/login would produce) in template.html and set the > > > form post action to default/user/login. This did no work. I guess > > > there are some hidden fields which are not matched correctly in the > > > user/login action which does not compute, and the user/login is > > > displayed as if the user/login action was called for the first time. > > > > Thanks! > > > > -sveinh -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] for your info
http://www.reddit.com/r/Python/comments/ayqbu/thoughts_on_web2py/ -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: how to disable field access if not authorized
I am not sure non-writable fields have widgets. I will check. Most likely they do not if they are not writable and not readable. On Feb 7, 2:02 am, weheh wrote: > I'm using crud and want to disable access to certain fields if user is > not a member of the admin group. For instance, content can only be > approved by admin. I want to register the id of the user who approved > the content, too. So I'd like to say: > > if not auth.has_membership(auth.id_group('Admin'),auth.user.id): > db.content.approved.writable=False > db.content.signature.writable=False > form = crud.update(db.content,...) > > so that even if the view has this: > {{=form.custom.widget.approved}} > {{=form.custom.widget.signature}} > > the fields shouldn't be fillable by an unauthorized user. Problem is, > this doesn't work and I get this ticket: > > Traceback (most recent call last): > File "C:\web2py\gluon\restricted.py", line 173, in restricted > exec ccode in environment > File "C:/web2py/applications/myapp/controllers/admin.py", line 187, > in > File "C:\web2py\gluon\globals.py", line 96, in > self._caller = lambda f: f() > File "C:\web2py\gluon\tools.py", line 1873, in f > return action(*a, **b) > File "C:/web2py/applications/myapp/controllers/admin.py", line 59, > in marketing > form = crud.update(db.content,request.args(2),message=T('Updated > content')) > File "C:\web2py\gluon\tools.py", line 2270, in update > keepvalues=self.settings.keepvalues): > File "C:\web2py\gluon\sqlhtml.py", line 755, in accepts > onvalidation, > File "C:\web2py\gluon\html.py", line 1267, in accepts > status = self._traverse(status) > File "C:\web2py\gluon\html.py", line 449, in _traverse > newstatus = c._traverse(status) and newstatus > File "C:\web2py\gluon\html.py", line 449, in _traverse > newstatus = c._traverse(status) and newstatus > File "C:\web2py\gluon\html.py", line 449, in _traverse > newstatus = c._traverse(status) and newstatus > File "C:\web2py\gluon\html.py", line 449, in _traverse > newstatus = c._traverse(status) and newstatus > TypeError: 'NoneType' object is not callable > > Anybody know what's going on here? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] calling form through ajax fails even using formname=None
Hi I've this particular case : def governorate(): form = crud.create(db.governorate) return dict(governorates=governorates, form=form) def edit_governorate(): form = SQLFORM(db.governorate ,request.vars.gov_id) if form.accepts(request.vars, formname='name'):pass return dict(form=form) Now in governorate.html the returned table has an action on every record {{for governorate in governorates:}} {{=governorate.name}} -- {{=A(., _href=URL(r=request, ,c="controller",f="governorate")}} {{=form}} now func() should call edit_governorate , get the form into the governorate_form div Now the update form is not working, how exactly can I get it work ? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: immediate web2py job opening
weheh, only for U.S. residences? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: how to disable field access if not authorized
These are readable, but not writable. What I want is for widget to get "grayed-out" and not be usable when user doesn't have permission to fill in the field. On Feb 7, 4:24 am, mdipierro wrote: > I am not sure non-writable fields have widgets. I will check. Most > likely they do not if they are not writable and not readable. > > On Feb 7, 2:02 am, weheh wrote: > > > > > I'm using crud and want to disable access to certain fields if user is > > not a member of the admin group. For instance, content can only be > > approved by admin. I want to register the id of the user who approved > > the content, too. So I'd like to say: > > > if not auth.has_membership(auth.id_group('Admin'),auth.user.id): > > db.content.approved.writable=False > > db.content.signature.writable=False > > form = crud.update(db.content,...) > > > so that even if the view has this: > > {{=form.custom.widget.approved}} > > {{=form.custom.widget.signature}} > > > the fields shouldn't be fillable by an unauthorized user. Problem is, > > this doesn't work and I get this ticket: > > > Traceback (most recent call last): > > File "C:\web2py\gluon\restricted.py", line 173, in restricted > > exec ccode in environment > > File "C:/web2py/applications/myapp/controllers/admin.py", line 187, > > in > > File "C:\web2py\gluon\globals.py", line 96, in > > self._caller = lambda f: f() > > File "C:\web2py\gluon\tools.py", line 1873, in f > > return action(*a, **b) > > File "C:/web2py/applications/myapp/controllers/admin.py", line 59, > > in marketing > > form = crud.update(db.content,request.args(2),message=T('Updated > > content')) > > File "C:\web2py\gluon\tools.py", line 2270, in update > > keepvalues=self.settings.keepvalues): > > File "C:\web2py\gluon\sqlhtml.py", line 755, in accepts > > onvalidation, > > File "C:\web2py\gluon\html.py", line 1267, in accepts > > status = self._traverse(status) > > File "C:\web2py\gluon\html.py", line 449, in _traverse > > newstatus = c._traverse(status) and newstatus > > File "C:\web2py\gluon\html.py", line 449, in _traverse > > newstatus = c._traverse(status) and newstatus > > File "C:\web2py\gluon\html.py", line 449, in _traverse > > newstatus = c._traverse(status) and newstatus > > File "C:\web2py\gluon\html.py", line 449, in _traverse > > newstatus = c._traverse(status) and newstatus > > TypeError: 'NoneType' object is not callable > > > Anybody know what's going on here?- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: how to disable field access if not authorized
These are readable, but not writable. What I want is for widget to get "grayed-out" and not be usable when user doesn't have permission to fill in the field. Ideally, I think it would make sense to be able to do this as a requirement to a field, something like: requires=HAS_MEMBERSHIP(auth.id_group('admin'),auth.user.id), or requires=HAS_PERMISSION(...) or maybe clearer yet, have a permission authenticator: permission=HAS_MEMBERSHIP(...) or permission=HAS_PERMISSION(...) On Feb 7, 4:24 am, mdipierro wrote: > I am not sure non-writable fields have widgets. I will check. Most > likely they do not if they are not writable and not readable. > > On Feb 7, 2:02 am, weheh wrote: > > > > > I'm using crud and want to disable access to certain fields if user is > > not a member of the admin group. For instance, content can only be > > approved by admin. I want to register the id of the user who approved > > the content, too. So I'd like to say: > > > if not auth.has_membership(auth.id_group('Admin'),auth.user.id): > > db.content.approved.writable=False > > db.content.signature.writable=False > > form = crud.update(db.content,...) > > > so that even if the view has this: > > {{=form.custom.widget.approved}} > > {{=form.custom.widget.signature}} > > > the fields shouldn't be fillable by an unauthorized user. Problem is, > > this doesn't work and I get this ticket: > > > Traceback (most recent call last): > > File "C:\web2py\gluon\restricted.py", line 173, in restricted > > exec ccode in environment > > File "C:/web2py/applications/myapp/controllers/admin.py", line 187, > > in > > File "C:\web2py\gluon\globals.py", line 96, in > > self._caller = lambda f: f() > > File "C:\web2py\gluon\tools.py", line 1873, in f > > return action(*a, **b) > > File "C:/web2py/applications/myapp/controllers/admin.py", line 59, > > in marketing > > form = crud.update(db.content,request.args(2),message=T('Updated > > content')) > > File "C:\web2py\gluon\tools.py", line 2270, in update > > keepvalues=self.settings.keepvalues): > > File "C:\web2py\gluon\sqlhtml.py", line 755, in accepts > > onvalidation, > > File "C:\web2py\gluon\html.py", line 1267, in accepts > > status = self._traverse(status) > > File "C:\web2py\gluon\html.py", line 449, in _traverse > > newstatus = c._traverse(status) and newstatus > > File "C:\web2py\gluon\html.py", line 449, in _traverse > > newstatus = c._traverse(status) and newstatus > > File "C:\web2py\gluon\html.py", line 449, in _traverse > > newstatus = c._traverse(status) and newstatus > > File "C:\web2py\gluon\html.py", line 449, in _traverse > > newstatus = c._traverse(status) and newstatus > > TypeError: 'NoneType' object is not callable > > > Anybody know what's going on here?- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Cron errors on Windows
Let me know when to test. I'm still getting: Exception in thread Thread-4: Traceback (most recent call last): File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner self.run() File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line 55, in run s.run() File "C:\Python25\lib\sched.py", line 114, in run void = action(*argument) File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line 47, in launch crondance(self.path, 'hard', startup = self.startup) File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line 312, in crondance return tokenmaster(cron_path, action='release', startup=startup) File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line 92, in tokenmaster os.unlink(tokeninuse) WindowsError: [Error 2] The system cannot find the file specified: 'C:\ \Users\\nathan\\workspace\\web2py\\applications\\admin\\cron\ \cron.running' On Feb 7, 1:05 am, mdipierro wrote: > I will fix it in trunk > > On Feb 6, 11:58 pm, "mr.freeze" wrote: > > > I'm getting this when running the hg tip. > > > web2py Enterprise Web Framework > > Created by Massimo Di Pierro, Copyright 2007-2010 > > Version 1.74.11 (2010-02-03 10:53:34) > > Database drivers available: SQLite3, MySQL > > Starting cron... > > please visit: > > http://127.0.0.1:8000 > > use "kill -SIGTERM 5264" to shutdown the web2py server > > Exception in thread Thread-4: > > Traceback (most recent call last): > > File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner > > self.run() > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > 55, in run > > s.run() > > File "C:\Python25\lib\sched.py", line 114, in run > > void = action(*argument) > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > 47, in launch > > crondance(self.path, 'hard', startup = self.startup) > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > 241, in crondance > > cronmaster = tokenmaster(cron_path, action='claim', > > startup=startup) > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > 133, in tokenmaster > > os.rename(token, tokeninuse) > > WindowsError: [Error 183] Cannot create a file when that file already > > exists > > --- > > also getting this error occasionally: > > - > > Exception in thread Thread-4: > > Traceback (most recent call last): > > File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner > > self.run() > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > 55, in run > > s.run() > > File "C:\Python25\lib\sched.py", line 114, in run > > void = action(*argument) > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > 47, in launch > > crondance(self.path, 'hard', startup = self.startup) > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > 241, in crondance > > cronmaster = tokenmaster(cron_path, action='claim', > > startup=startup) > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > 133, in tokenmaster > > os.rename(token, tokeninuse) > > WindowsError: [Error 2] The system cannot find the file specified > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Plugin
hi, Many many thanks for the bit of info. Why can't make a wiki page about that. It's actually useful. Sorry for late reply. I was preparing for my MBA entrance test. On Feb 1, 10:50 pm, Thadeus Burgess wrote: > Create your models/controllers/views/static files etc everything as > you normally would, But append the word "plugin_" in front of it > > so > > models/plugin_test.py > controllers/plugin_test.py > views/plugin_test/index.html > static/plugin_test/logo.png > > But also follow the database/global def namespace convention so > > db.define_table('plugin_test_links', Field('link', requires=IS_URL), > Field('time', 'datetime', default=request.now)) > > def plugin_get_links(): > return db().select(db.plugin_test_links.ALL) > > Your plugin will show up as a different section (at the bottom) of > web2py admin, and you can go into it and then click "pack" and it will > make a plugin zipped file that can be unpacked. > > -Thadeus > > On Mon, Feb 1, 2010 at 11:25 AM, K.R.Arun wrote: > > Will some one tell me, how to make a plugin? > > > For example a layout plugin, or an OAuth plugin, or anything like > > that. > > > -- > > You received this message because you are subscribed to the Google Groups > > "web2py-users" group. > > To post to this group, send email to web...@googlegroups.com. > > To unsubscribe from this group, send email to > > web2py+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: calling form through ajax fails even using formname=None
Can you describe the symptoms as you go through the interface? Are you using the web2py_ajax.html function "web2py_ajax_page" to load the form and trap it into the page? On Feb 7, 6:37 am, "hamdy.a.farag" wrote: > Hi > > I've this particular case : > > def governorate(): > form = crud.create(db.governorate) > > > return dict(governorates=governorates, form=form) > > def edit_governorate(): > form = SQLFORM(db.governorate ,request.vars.gov_id) > if form.accepts(request.vars, formname='name'):pass > return dict(form=form) > > Now in governorate.html the returned table has an action on every > record > > {{for governorate in governorates:}} > > > "func('{{=governorate.id}}');">{{=governorate.name}} > > -- > > > {{=A(., > _href=URL(r=request, ,c="controller",f="governorate")}} > {{=form}} > > > now func() should call edit_governorate , get the form into the > governorate_form div > > Now the update form is not working, how exactly can I get it work ? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: how to disable field access if not authorized
On Feb 7, 2010, at 7:32 AM, weheh wrote: > These are readable, but not writable. What I want is for widget to > get > "grayed-out" and not be usable when user doesn't have permission to > fill in the field. > > Ideally, I think it would make sense to be able to do this as a > requirement to a field, something like: > requires=HAS_MEMBERSHIP(auth.id_group('admin'),auth.user.id), > or > requires=HAS_PERMISSION(...) > > or maybe clearer yet, have a permission authenticator: > permission=HAS_MEMBERSHIP(...) > or permission=HAS_PERMISSION(...) I like this a lot, at least as a general idea. Graying out would need to be done with the html disabled attribute. Using permissions seems quite natural. I'm not sure what the right logic would be, though. Perhaps 'disabled' is parallel to readable and writable, though that may not be the best way of putting it. At any rate, an input element would have four possible states: the three we have now (visible and enabled, text-only (what is now readable but not writable), and not visible), and visible but disabled. With the state a function of permissions of the current user. > > On Feb 7, 4:24 am, mdipierro wrote: >> I am not sure non-writable fields have widgets. I will check. Most >> likely they do not if they are not writable and not readable. >> >> On Feb 7, 2:02 am, weheh wrote: >> >> >> >>> I'm using crud and want to disable access to certain fields if user is >>> not a member of the admin group. For instance, content can only be >>> approved by admin. I want to register the id of the user who approved >>> the content, too. So I'd like to say: >> >>> if not auth.has_membership(auth.id_group('Admin'),auth.user.id): >>> db.content.approved.writable=False >>> db.content.signature.writable=False >>> form = crud.update(db.content,...) >> >>> so that even if the view has this: >>> {{=form.custom.widget.approved}} >>> {{=form.custom.widget.signature}} >> >>> the fields shouldn't be fillable by an unauthorized user. Problem is, >>> this doesn't work and I get this ticket: >> >>> Traceback (most recent call last): >>> File "C:\web2py\gluon\restricted.py", line 173, in restricted >>> exec ccode in environment >>> File "C:/web2py/applications/myapp/controllers/admin.py", line 187, >>> in >>> File "C:\web2py\gluon\globals.py", line 96, in >>> self._caller = lambda f: f() >>> File "C:\web2py\gluon\tools.py", line 1873, in f >>> return action(*a, **b) >>> File "C:/web2py/applications/myapp/controllers/admin.py", line 59, >>> in marketing >>> form = crud.update(db.content,request.args(2),message=T('Updated >>> content')) >>> File "C:\web2py\gluon\tools.py", line 2270, in update >>> keepvalues=self.settings.keepvalues): >>> File "C:\web2py\gluon\sqlhtml.py", line 755, in accepts >>> onvalidation, >>> File "C:\web2py\gluon\html.py", line 1267, in accepts >>> status = self._traverse(status) >>> File "C:\web2py\gluon\html.py", line 449, in _traverse >>> newstatus = c._traverse(status) and newstatus >>> File "C:\web2py\gluon\html.py", line 449, in _traverse >>> newstatus = c._traverse(status) and newstatus >>> File "C:\web2py\gluon\html.py", line 449, in _traverse >>> newstatus = c._traverse(status) and newstatus >>> File "C:\web2py\gluon\html.py", line 449, in _traverse >>> newstatus = c._traverse(status) and newstatus >>> TypeError: 'NoneType' object is not callable >> >>> Anybody know what's going on here?- Hide quoted text - >> >> - Show quoted text - > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Cron errors on Windows
please try again. On Feb 7, 10:23 am, "mr.freeze" wrote: > Let me know when to test. I'm still getting: > > Exception in thread Thread-4: > Traceback (most recent call last): > File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner > self.run() > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > 55, in run > s.run() > File "C:\Python25\lib\sched.py", line 114, in run > void = action(*argument) > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > 47, in launch > crondance(self.path, 'hard', startup = self.startup) > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > 312, in crondance > return tokenmaster(cron_path, action='release', startup=startup) > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > 92, in tokenmaster > os.unlink(tokeninuse) > WindowsError: [Error 2] The system cannot find the file specified: 'C:\ > \Users\\nathan\\workspace\\web2py\\applications\\admin\\cron\ > \cron.running' > > On Feb 7, 1:05 am, mdipierro wrote: > > > I will fix it in trunk > > > On Feb 6, 11:58 pm, "mr.freeze" wrote: > > > > I'm getting this when running the hg tip. > > > > web2py Enterprise Web Framework > > > Created by Massimo Di Pierro, Copyright 2007-2010 > > > Version 1.74.11 (2010-02-03 10:53:34) > > > Database drivers available: SQLite3, MySQL > > > Starting cron... > > > please visit: > > > http://127.0.0.1:8000 > > > use "kill -SIGTERM 5264" to shutdown the web2py server > > > Exception in thread Thread-4: > > > Traceback (most recent call last): > > > File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner > > > self.run() > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > 55, in run > > > s.run() > > > File "C:\Python25\lib\sched.py", line 114, in run > > > void = action(*argument) > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > 47, in launch > > > crondance(self.path, 'hard', startup = self.startup) > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > 241, in crondance > > > cronmaster = tokenmaster(cron_path, action='claim', > > > startup=startup) > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > 133, in tokenmaster > > > os.rename(token, tokeninuse) > > > WindowsError: [Error 183] Cannot create a file when that file already > > > exists > > > --- > > > also getting this error occasionally: > > > - > > > Exception in thread Thread-4: > > > Traceback (most recent call last): > > > File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner > > > self.run() > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > 55, in run > > > s.run() > > > File "C:\Python25\lib\sched.py", line 114, in run > > > void = action(*argument) > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > 47, in launch > > > crondance(self.path, 'hard', startup = self.startup) > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > 241, in crondance > > > cronmaster = tokenmaster(cron_path, action='claim', > > > startup=startup) > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > 133, in tokenmaster > > > os.rename(token, tokeninuse) > > > WindowsError: [Error 2] The system cannot find the file specified > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: how to disable field access if not authorized
You can do what you say Field(...,writable = auth.has_permission('whatever')) The problem seems to be that {{=form.custom.widget.field}} fails for you when db.table.field.writable is False. It seems to work for me: >>> db.define_table('test',Field('name')) >>> db.test.name.writable=False >>> form=SQLFORM(db.test) >>> print form.custom.widget.name None Can you make a simple test case so I can reproduce the problem? On Feb 7, 9:32 am, weheh wrote: > These are readable, but not writable. What I want is for widget to > get > "grayed-out" and not be usable when user doesn't have permission to > fill in the field. > > Ideally, I think it would make sense to be able to do this as a > requirement to a field, something like: > requires=HAS_MEMBERSHIP(auth.id_group('admin'),auth.user.id), > or > requires=HAS_PERMISSION(...) > > or maybe clearer yet, have a permission authenticator: > permission=HAS_MEMBERSHIP(...) > or permission=HAS_PERMISSION(...) > > On Feb 7, 4:24 am, mdipierro wrote: > > > I am not sure non-writable fields have widgets. I will check. Most > > likely they do not if they are not writable and not readable. > > > On Feb 7, 2:02 am, weheh wrote: > > > > I'm using crud and want to disable access to certain fields if user is > > > not a member of the admin group. For instance, content can only be > > > approved by admin. I want to register the id of the user who approved > > > the content, too. So I'd like to say: > > > > if not auth.has_membership(auth.id_group('Admin'),auth.user.id): > > > db.content.approved.writable=False > > > db.content.signature.writable=False > > > form = crud.update(db.content,...) > > > > so that even if the view has this: > > > {{=form.custom.widget.approved}} > > > {{=form.custom.widget.signature}} > > > > the fields shouldn't be fillable by an unauthorized user. Problem is, > > > this doesn't work and I get this ticket: > > > > Traceback (most recent call last): > > > File "C:\web2py\gluon\restricted.py", line 173, in restricted > > > exec ccode in environment > > > File "C:/web2py/applications/myapp/controllers/admin.py", line 187, > > > in > > > File "C:\web2py\gluon\globals.py", line 96, in > > > self._caller = lambda f: f() > > > File "C:\web2py\gluon\tools.py", line 1873, in f > > > return action(*a, **b) > > > File "C:/web2py/applications/myapp/controllers/admin.py", line 59, > > > in marketing > > > form = crud.update(db.content,request.args(2),message=T('Updated > > > content')) > > > File "C:\web2py\gluon\tools.py", line 2270, in update > > > keepvalues=self.settings.keepvalues): > > > File "C:\web2py\gluon\sqlhtml.py", line 755, in accepts > > > onvalidation, > > > File "C:\web2py\gluon\html.py", line 1267, in accepts > > > status = self._traverse(status) > > > File "C:\web2py\gluon\html.py", line 449, in _traverse > > > newstatus = c._traverse(status) and newstatus > > > File "C:\web2py\gluon\html.py", line 449, in _traverse > > > newstatus = c._traverse(status) and newstatus > > > File "C:\web2py\gluon\html.py", line 449, in _traverse > > > newstatus = c._traverse(status) and newstatus > > > File "C:\web2py\gluon\html.py", line 449, in _traverse > > > newstatus = c._traverse(status) and newstatus > > > TypeError: 'NoneType' object is not callable > > > > Anybody know what's going on here?- Hide quoted text - > > > - Show quoted text - > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Error with mail sending and T(...)
Thanks a lot! I am not on my computer now, but I will try that tomorrow. On Feb 5, 10:32 pm, mdipierro wrote: > for now > > message=str(T('mail message')) > > instead of > > message=T('mail message') > > On Feb 5, 3:16 pm, aure wrote: > > > I am using web2py Version 1.74.11 > > > But I upgraded today from source and copied my app to the applications > > folder. > > > On Feb 5, 8:43 pm, mdipierro wrote: > > > > which version of web2py are you using? This was fixed recently I > > > think. > > > > On Feb 5, 1:41 pm, aure wrote:> Hi > > > everyone, > > > > > I am trying to make my application send a mail. It works fine using: > > > > > mail.send(to=[mail_to], subject='myApp request', message='mail > > > > message') > > > > > But if I use T(...) in the message: > > > > > mail.send(to=[mail_to], subject='myApp request', message=T('mail > > > > message')) > > > > > I get this error: > > > > > mail.send(to=[mail_to], subject='LibresLivres email: book request', > > > > message=T('mail message')) > > > > File "/home/aurelien/Documents/web2py/gluon/tools.py", line 283, in > > > > send > > > > text = text.read().decode(encoding).encode('utf-8') > > > > AttributeError: 'lazyT' object has no attribute 'read' > > > > > Is there a simple reason why it does not work? > > > > > Thanks, > > > > Aurelien > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Cron errors on Windows
Seems happy now. Thanks. On Feb 7, 11:05 am, mdipierro wrote: > please try again. > > On Feb 7, 10:23 am, "mr.freeze" wrote: > > > Let me know when to test. I'm still getting: > > > Exception in thread Thread-4: > > Traceback (most recent call last): > > File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner > > self.run() > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > 55, in run > > s.run() > > File "C:\Python25\lib\sched.py", line 114, in run > > void = action(*argument) > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > 47, in launch > > crondance(self.path, 'hard', startup = self.startup) > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > 312, in crondance > > return tokenmaster(cron_path, action='release', startup=startup) > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > 92, in tokenmaster > > os.unlink(tokeninuse) > > WindowsError: [Error 2] The system cannot find the file specified: 'C:\ > > \Users\\nathan\\workspace\\web2py\\applications\\admin\\cron\ > > \cron.running' > > > On Feb 7, 1:05 am, mdipierro wrote: > > > > I will fix it in trunk > > > > On Feb 6, 11:58 pm, "mr.freeze" wrote: > > > > > I'm getting this when running the hg tip. > > > > > web2py Enterprise Web Framework > > > > Created by Massimo Di Pierro, Copyright 2007-2010 > > > > Version 1.74.11 (2010-02-03 10:53:34) > > > > Database drivers available: SQLite3, MySQL > > > > Starting cron... > > > > please visit: > > > > http://127.0.0.1:8000 > > > > use "kill -SIGTERM 5264" to shutdown the web2py server > > > > Exception in thread Thread-4: > > > > Traceback (most recent call last): > > > > File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner > > > > self.run() > > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > > 55, in run > > > > s.run() > > > > File "C:\Python25\lib\sched.py", line 114, in run > > > > void = action(*argument) > > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > > 47, in launch > > > > crondance(self.path, 'hard', startup = self.startup) > > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > > 241, in crondance > > > > cronmaster = tokenmaster(cron_path, action='claim', > > > > startup=startup) > > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > > 133, in tokenmaster > > > > os.rename(token, tokeninuse) > > > > WindowsError: [Error 183] Cannot create a file when that file already > > > > exists > > > > --- > > > > also getting this error occasionally: > > > > - > > > > Exception in thread Thread-4: > > > > Traceback (most recent call last): > > > > File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner > > > > self.run() > > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > > 55, in run > > > > s.run() > > > > File "C:\Python25\lib\sched.py", line 114, in run > > > > void = action(*argument) > > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > > 47, in launch > > > > crondance(self.path, 'hard', startup = self.startup) > > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > > 241, in crondance > > > > cronmaster = tokenmaster(cron_path, action='claim', > > > > startup=startup) > > > > File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line > > > > 133, in tokenmaster > > > > os.rename(token, tokeninuse) > > > > WindowsError: [Error 2] The system cannot find the file specified > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] web2py gae presentation
I am giving a presentation Wednesday on web2py running on GAE. I'm looking for ideas on a small app I could develop that would display the following web2py features. 1. Data centric, simplicity. 2. Generation of reports 3. Ease of deployment 4. Maintainability Most who are attending are engineers who use python for processing data, so I really want to show the strength of web2py being data-centric because it can fit their purposes more than say django which requires them to write a lot of filler code just to run some reports. The demo they talked about at the last meeting was of a running-distance tracker straight on the GAE, I was thinking about doing the same for web2py but would like to hear other opinions! -Thadeus -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] password hash problems
I've got this (where the key is a text string): from gluon.tools import * auth=Auth(globals(),db) # authentication/authorization auth.settings.hmac_key = vpepm_hmac_key auth.define_tables() # creates all needed tables # invoke IS_STRONG only for password creation, not password checking if "login" not in request.args: auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, upper=1, lower=1, number=1, special=1)] All my logins are failing with a bad password. I've got a sha512 hash in my user database (manually initialized), but the login form is returning an md5 hash, presumably because digest_alg is set to md5. The manual says, "If a key is specified it uses the HMAC+SHA512 with the provided key," but I don't see where digest_alg is ever set to sha512. Is there a bug, or am I doing something wrong? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] crud links to default, not the calling controller
I'm building an admin interface of my own, which mostly looks like the web2py admin interface. Therefore, in my admin controller, I have @auth.requires_membership('Admin') def groups(): form=crud.update(db.auth_group,request.args(2),deletable=True) groups=crud.select(db.auth_group) return dict(form=form,groups=groups) The groups-table id column, however, has the following link for id #1: http://127.0.0.1:8000/myapp/default/groups/read/auth_group/1 Since my controller is called admin, why doesn't it read? http://127.0.0.1:8000/myapp/admin/groups/read/auth_group/1 -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: crud links to default, not the calling controller
I think you need to set crud.settings.controller = 'admin' On Feb 7, 2:01 pm, weheh wrote: > I'm building an admin interface of my own, which mostly looks like the > web2py admin interface. Therefore, in my admin controller, I have > > @auth.requires_membership('Admin') > def groups(): > form=crud.update(db.auth_group,request.args(2),deletable=True) > groups=crud.select(db.auth_group) > return dict(form=form,groups=groups) > > The groups-table id column, however, has the following link for id #1: > http://127.0.0.1:8000/myapp/default/groups/read/auth_group/1 > > Since my controller is called admin, why doesn't it read? > http://127.0.0.1:8000/myapp/admin/groups/read/auth_group/1 -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: password hash problems
remember that validators are filters. You need to check that a password is strong BEFORE it is hashed. So instead of this: auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, upper=1, lower=1, number=1, special=1)] Do this auth.settings.table_user.password.insert(0,IS_STRONG(min=8, max=0, upper=1, lower=1, number=1, special=1)) Not sure this is your problem but try again after this fix. On Feb 7, 1:44 pm, Jonathan Lundell wrote: > I've got this (where the key is a text string): > > from gluon.tools import * > auth=Auth(globals(),db) # authentication/authorization > auth.settings.hmac_key = vpepm_hmac_key > auth.define_tables() # creates all needed tables > > # invoke IS_STRONG only for password creation, not password checking > if "login" not in request.args: > auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, > upper=1, lower=1, number=1, special=1)] > > All my logins are failing with a bad password. I've got a sha512 hash in my > user database (manually initialized), but the login form is returning an md5 > hash, presumably because digest_alg is set to md5. The manual says, "If a key > is specified it uses the HMAC+SHA512 with the provided key," but I don't see > where digest_alg is ever set to sha512. > > Is there a bug, or am I doing something wrong? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: AutocompleteWidget: experimental, magic, RFC
I fixed some problem with validators. Can somebody give this a try? I could use a second opinion. Massimo On Feb 7, 1:02 am, mdipierro wrote: > I do not know that. I am still playing with it... > > On Feb 6, 11:40 pm, Jason Brower wrote: > > > I have my current autocomplete but it doesn't do öäå in a search. Does > > this handle that? > > Best Regards, > > Jason > > > On Sat, 2010-02-06 at 12:30 -0800, mdipierro wrote: > > > People say there is some magic in web2py. > > > Here is some real magic now in trunk that I am sure you have never > > > seen. > > > > Caveats: > > > 0) requires latest trunk (bzr 1603, hg 175:e42b559254f6) > > > 1) this is an experiment, not sure it is a good idea > > > 2) this is the first function in web2py that REQUIRES jQuery > > > 3) works but I am not yet convinced it should stay there > > > 4) even if it stays, I am sure the API should stay > > > > Example: > > > > ### assume this model > > > db.define_table('target',Field('name')) > > > if not db(db.target.id>0).count(): > > > db.target.insert(name="Klingon") > > > db.target.insert(name="Romulans") > > > db.target.insert(name="Borg") > > > db.target.insert(name="Borg2") > > > db.define_table('photon_torpedo',Field('target',db.target)) > > > > ### assume this action in controller default.py > > > def launch(): > > > db.photon_torpedo.target.represent=lambda target: target.name > > > return dict(new_torpedo=crud.create(db.photon_torpedo), > > > launched_torpedos=db().select(db.photon_torpedo.ALL)) > > > > So far nothing new. > > > > Now append to the model or insert at top of controller the following: > > > > from gluon.sqlhtml import AutocompleteWidget > > > db.photon_torpedo.target.widget=AutocompleteWidget(request,db.target.name,db.target.id) > > > > No need to define any callback action (there is no callback action!) > > > No plugin required (perhaps some optional css to style). > > > No js coding required. > > > Applies to existing apps, including those that use custom forms. > > > > Let's see who can figure out how it works! > > > > Massimo > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: crud links to default, not the calling controller [SOLVED]
Right on Mr. Freeze. Works. Thx. On Feb 7, 3:05 pm, "mr.freeze" wrote: > I think you need to set crud.settings.controller = 'admin' > > On Feb 7, 2:01 pm, weheh wrote: > > > I'm building an admin interface of my own, which mostly looks like the > > web2py admin interface. Therefore, in my admin controller, I have > > > @auth.requires_membership('Admin') > > def groups(): > > form=crud.update(db.auth_group,request.args(2),deletable=True) > > groups=crud.select(db.auth_group) > > return dict(form=form,groups=groups) > > > The groups-table id column, however, has the following link for id #1: > > http://127.0.0.1:8000/myapp/default/groups/read/auth_group/1 > > > Since my controller is called admin, why doesn't it read? > > http://127.0.0.1:8000/myapp/admin/groups/read/auth_group/1 -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: password hash problems
Looking at CRYPT, if you provide a key but not a digest algorithm, it will try to get the digest alg by splitting the key between a colon. So you could say: auth.settings.hmac_key = 'sha512:%s' % vpepm_hmac_key On Feb 7, 1:44 pm, Jonathan Lundell wrote: > I've got this (where the key is a text string): > > from gluon.tools import * > auth=Auth(globals(),db) # authentication/authorization > auth.settings.hmac_key = vpepm_hmac_key > auth.define_tables() # creates all needed tables > > # invoke IS_STRONG only for password creation, not password checking > if "login" not in request.args: > auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, > upper=1, lower=1, number=1, special=1)] > > All my logins are failing with a bad password. I've got a sha512 hash in my > user database (manually initialized), but the login form is returning an md5 > hash, presumably because digest_alg is set to md5. The manual says, "If a key > is specified it uses the HMAC+SHA512 with the provided key," but I don't see > where digest_alg is ever set to sha512. > > Is there a bug, or am I doing something wrong? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: AutocompleteWidget: experimental, magic, RFC
How about we change IS_IN_DB so that, if the number of referenced records exceeds a maximum the auto complete widget is on by default? Massimo On Feb 7, 1:02 am, mdipierro wrote: > I do not know that. I am still playing with it... > > On Feb 6, 11:40 pm, Jason Brower wrote: > > > I have my current autocomplete but it doesn't do öäå in a search. Does > > this handle that? > > Best Regards, > > Jason > > > On Sat, 2010-02-06 at 12:30 -0800, mdipierro wrote: > > > People say there is some magic in web2py. > > > Here is some real magic now in trunk that I am sure you have never > > > seen. > > > > Caveats: > > > 0) requires latest trunk (bzr 1603, hg 175:e42b559254f6) > > > 1) this is an experiment, not sure it is a good idea > > > 2) this is the first function in web2py that REQUIRES jQuery > > > 3) works but I am not yet convinced it should stay there > > > 4) even if it stays, I am sure the API should stay > > > > Example: > > > > ### assume this model > > > db.define_table('target',Field('name')) > > > if not db(db.target.id>0).count(): > > > db.target.insert(name="Klingon") > > > db.target.insert(name="Romulans") > > > db.target.insert(name="Borg") > > > db.target.insert(name="Borg2") > > > db.define_table('photon_torpedo',Field('target',db.target)) > > > > ### assume this action in controller default.py > > > def launch(): > > > db.photon_torpedo.target.represent=lambda target: target.name > > > return dict(new_torpedo=crud.create(db.photon_torpedo), > > > launched_torpedos=db().select(db.photon_torpedo.ALL)) > > > > So far nothing new. > > > > Now append to the model or insert at top of controller the following: > > > > from gluon.sqlhtml import AutocompleteWidget > > > db.photon_torpedo.target.widget=AutocompleteWidget(request,db.target.name,db.target.id) > > > > No need to define any callback action (there is no callback action!) > > > No plugin required (perhaps some optional css to style). > > > No js coding required. > > > Applies to existing apps, including those that use custom forms. > > > > Let's see who can figure out how it works! > > > > Massimo > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: password hash problems
On Feb 7, 2010, at 12:10 PM, mr.freeze wrote: > Looking at CRYPT, if you provide a key but not a digest algorithm, it > will try to get the digest alg by splitting the key between a colon. > So you could say: > > auth.settings.hmac_key = 'sha512:%s' % vpepm_hmac_key That did the trick. Thanks, I hadn't noticed the split. Massimo, that's contrary to the documentation. > > On Feb 7, 1:44 pm, Jonathan Lundell wrote: >> I've got this (where the key is a text string): >> >> from gluon.tools import * >> auth=Auth(globals(),db) # authentication/authorization >> auth.settings.hmac_key = vpepm_hmac_key >> auth.define_tables() # creates all needed tables >> >> # invoke IS_STRONG only for password creation, not password checking >> if "login" not in request.args: >> auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, >> upper=1, lower=1, number=1, special=1)] >> >> All my logins are failing with a bad password. I've got a sha512 hash in my >> user database (manually initialized), but the login form is returning an md5 >> hash, presumably because digest_alg is set to md5. The manual says, "If a >> key is specified it uses the HMAC+SHA512 with the provided key," but I don't >> see where digest_alg is ever set to sha512. >> >> Is there a bug, or am I doing something wrong? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: web2py gae presentation
I have a few things I've written that you are welcome to use as an idea,jumping off point or clone: Mileage tracker - http://www.web2pyslices.com/main/slices/take_slice/15 Art gallery manager - email me web2pyslices - http://www.web2pyslices.com/main/static/share/web2py.app.web2pyslices.w2p Other ideas: Music library manager Bill reminder system (to show off cron) I.T. asset manager I've also seen these on the group: Wiki with versioning Health record system web2py CRM Survey app Conference manager On Feb 7, 1:01 pm, Thadeus Burgess wrote: > I am giving a presentation Wednesday on web2py running on GAE. I'm > looking for ideas on a small app I could develop that would display > the following web2py features. > > 1. Data centric, simplicity. > 2. Generation of reports > 3. Ease of deployment > 4. Maintainability > > Most who are attending are engineers who use python for processing > data, so I really want to show the strength of web2py being > data-centric because it can fit their purposes more than say django > which requires them to write a lot of filler code just to run some > reports. > > The demo they talked about at the last meeting was of a > running-distance tracker straight on the GAE, I was thinking about > doing the same for web2py but would like to hear other opinions! > > -Thadeus -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: password hash problems
On Feb 7, 2010, at 12:07 PM, mdipierro wrote: > remember that validators are filters. You need to check that a > password is strong BEFORE it is hashed. > So instead of this: > > auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, > upper=1, lower=1, number=1, special=1)] > > Do this > > auth.settings.table_user.password.insert(0,IS_STRONG(min=8, max=0, > upper=1, lower=1, number=1, special=1)) > > Not sure this is your problem but try again after this fix. Good point, thanks. But it wasn't my problem; the problem is that digest_alg defaults to md5, even in the presence of a key, which isn't what the manual says. I think that the best course of action might be to change the manual, since fixing the code now would break backward compatibility (I think). OTOH, if anyone is relying on the docs and expecting a sha512 hash, they're not getting one. The only reason I noticed the problem was that I was manually initializing the database with a sha512 hash, rather than relying on the form. > > On Feb 7, 1:44 pm, Jonathan Lundell wrote: >> I've got this (where the key is a text string): >> >> from gluon.tools import * >> auth=Auth(globals(),db) # authentication/authorization >> auth.settings.hmac_key = vpepm_hmac_key >> auth.define_tables() # creates all needed tables >> >> # invoke IS_STRONG only for password creation, not password checking >> if "login" not in request.args: >> auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, >> upper=1, lower=1, number=1, special=1)] >> >> All my logins are failing with a bad password. I've got a sha512 hash in my >> user database (manually initialized), but the login form is returning an md5 >> hash, presumably because digest_alg is set to md5. The manual says, "If a >> key is specified it uses the HMAC+SHA512 with the provided key," but I don't >> see where digest_alg is ever set to sha512. >> >> Is there a bug, or am I doing something wrong? > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: password hash problems
On Feb 7, 2010, at 12:07 PM, mdipierro wrote: > remember that validators are filters. You need to check that a > password is strong BEFORE it is hashed. > So instead of this: > > auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, > upper=1, lower=1, number=1, special=1)] > > Do this > > auth.settings.table_user.password.insert(0,IS_STRONG(min=8, max=0, > upper=1, lower=1, number=1, special=1)) > > Not sure this is your problem but try again after this fix. Shouldn't that be auth.settings.table_user.password.requires.insert(0,IS_STRONG(min=8, max=0, upper=1, lower=1, number=1, special=1)) ? > > On Feb 7, 1:44 pm, Jonathan Lundell wrote: >> I've got this (where the key is a text string): >> >> from gluon.tools import * >> auth=Auth(globals(),db) # authentication/authorization >> auth.settings.hmac_key = vpepm_hmac_key >> auth.define_tables() # creates all needed tables >> >> # invoke IS_STRONG only for password creation, not password checking >> if "login" not in request.args: >> auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, >> upper=1, lower=1, number=1, special=1)] >> >> All my logins are failing with a bad password. I've got a sha512 hash in my >> user database (manually initialized), but the login form is returning an md5 >> hash, presumably because digest_alg is set to md5. The manual says, "If a >> key is specified it uses the HMAC+SHA512 with the provided key," but I don't >> see where digest_alg is ever set to sha512. >> >> Is there a bug, or am I doing something wrong? > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: AutocompleteWidget: experimental, magic, RFC
Nice! I like this but I think it needs a few more tweaks. Can you modify it to allow the arrow keys to select an item? Also, when you clear the input after typing something, all of the options show. I personally think that javascript should be used more in the framework (with proper attention paid so that things degrade gracefully when it's off). On Feb 7, 2:11 pm, mdipierro wrote: > How about we change IS_IN_DB so that, if the number of referenced > records exceeds a maximum the auto complete widget is on by default? > > Massimo > > On Feb 7, 1:02 am, mdipierro wrote: > > > I do not know that. I am still playing with it... > > > On Feb 6, 11:40 pm, Jason Brower wrote: > > > > I have my current autocomplete but it doesn't do öäå in a search. Does > > > this handle that? > > > Best Regards, > > > Jason > > > > On Sat, 2010-02-06 at 12:30 -0800, mdipierro wrote: > > > > People say there is some magic in web2py. > > > > Here is some real magic now in trunk that I am sure you have never > > > > seen. > > > > > Caveats: > > > > 0) requires latest trunk (bzr 1603, hg 175:e42b559254f6) > > > > 1) this is an experiment, not sure it is a good idea > > > > 2) this is the first function in web2py that REQUIRES jQuery > > > > 3) works but I am not yet convinced it should stay there > > > > 4) even if it stays, I am sure the API should stay > > > > > Example: > > > > > ### assume this model > > > > db.define_table('target',Field('name')) > > > > if not db(db.target.id>0).count(): > > > > db.target.insert(name="Klingon") > > > > db.target.insert(name="Romulans") > > > > db.target.insert(name="Borg") > > > > db.target.insert(name="Borg2") > > > > db.define_table('photon_torpedo',Field('target',db.target)) > > > > > ### assume this action in controller default.py > > > > def launch(): > > > > db.photon_torpedo.target.represent=lambda target: target.name > > > > return dict(new_torpedo=crud.create(db.photon_torpedo), > > > > launched_torpedos=db().select(db.photon_torpedo.ALL)) > > > > > So far nothing new. > > > > > Now append to the model or insert at top of controller the following: > > > > > from gluon.sqlhtml import AutocompleteWidget > > > > db.photon_torpedo.target.widget=AutocompleteWidget(request,db.target.name,db.target.id) > > > > > No need to define any callback action (there is no callback action!) > > > > No plugin required (perhaps some optional css to style). > > > > No js coding required. > > > > Applies to existing apps, including those that use custom forms. > > > > > Let's see who can figure out how it works! > > > > > Massimo > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: cancel button
On Feb 6, 2010, at 9:33 PM, Iceberg wrote: > On Feb7, 8:01am, Jonathan Lundell wrote: >> On Feb 6, 2010, at 12:58 PM, Jonathan Lundell wrote: >> >>> On Feb 6, 2010, at 12:38 PM, mdipierro wrote: >> form[0][-1][1].append(BUTTON(_onclick="")) >> >>> Thanks. >> >>> Ideally, I'd like to return to the form.accepts call in such a way that the >>> accepts return test can recognize the cancelation and then redirect as >>> necessary. Somewhat parallel to testing form.error, I'd test (say) >>> form.cancel. >> >>> Does that make sense? It seems to me that it might be a useful general >>> capability for form processing. >> >>> One angle I was thinking of, but haven't investigated, is having multiple >>> submit buttons, with accepts() making available the name and/or value of >>> the button that was clicked. >> >>> That seems more in keeping with the self-submit philosophy, don't you think? > > > Yes, but be careful of multiple submit buttons. See this post: > https://groups.google.com/group/web2py/browse_frm/thread/f44b6f95b058df5 I'll need to look at that more closely. Thanks. Perhaps I can use and JavaScript. > >> >> I think I got it to work. >> >> form[0][-1][1].append(INPUT(_type="submit", _name="button", >> _value="Cancel")) >> >> and then after calling accepts: >> >> if request.vars.button == "Cancel": >> session.flash = 'edit canceled' >> else: >> session.flash = "edit accepted" >> redirect(URL(r=request, f='servers')) >> >> ...or something similar in the form.error case. > >> (I find that I'm a little fuzzy on the various return cases for accepts, >> though.) > > That is inevitable since you need to handle two different situations > in one action. So I would suggest just use a normal html reset button > at most. Reset doesn't do it for me; I need an actual cancel function that can do a specified page load. > > >> >> Question: what exactly is form[0][-1][1].append appending to? Can I append >> more than once to that same object? > > Yes. FORM is a container for many components. You can change it if you > want to. But a more readable style should be: > form = FORM( >... # all the normal stuff >INPUT(_type='submit'), >INPUT(_type='reset'), >) Except it's an SQLFORM, which won't accept INPUT arguments. The big problem with form[0][-1][1].append is that it "knows" too much about the internal structure of form. I can't expect the guarantee of backward compatibility to include constructs like that. So I'm left with two problems. The IE with multiple submits, and adding a button to the SQLFORM. Both are semi-solved, I think, but not in an ideal way. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: cancel button
I hate this too: form[0][-1][1]. I have a pending patch that will allow you to grab parent and sibling elements so you can do: >>> form = SQLFORM(db.whatever) >>> submit = form.element(_type='submit') >>> submit.parent.append(INPUT(_type='submit',_value='Cancel')) A little more verbose but human readable and appending the button will stay relative to where the submit button is. Massimo, have you had a chance to look at this? On Feb 7, 3:24 pm, Jonathan Lundell wrote: > On Feb 6, 2010, at 9:33 PM, Iceberg wrote: > > > > > On Feb7, 8:01am, Jonathan Lundell wrote: > >> On Feb 6, 2010, at 12:58 PM, Jonathan Lundell wrote: > > >>> On Feb 6, 2010, at 12:38 PM, mdipierro wrote: > > form[0][-1][1].append(BUTTON(_onclick="")) > > >>> Thanks. > > >>> Ideally, I'd like to return to the form.accepts call in such a way that > >>> the accepts return test can recognize the cancelation and then redirect > >>> as necessary. Somewhat parallel to testing form.error, I'd test (say) > >>> form.cancel. > > >>> Does that make sense? It seems to me that it might be a useful general > >>> capability for form processing. > > >>> One angle I was thinking of, but haven't investigated, is having multiple > >>> submit buttons, with accepts() making available the name and/or value of > >>> the button that was clicked. > > >>> That seems more in keeping with the self-submit philosophy, don't you > >>> think? > > > Yes, but be careful of multiple submit buttons. See this post: > > https://groups.google.com/group/web2py/browse_frm/thread/f44b6f95b058df5 > > I'll need to look at that more closely. Thanks. Perhaps I can use > and JavaScript. > > > > > > >> I think I got it to work. > > >> form[0][-1][1].append(INPUT(_type="submit", _name="button", > >> _value="Cancel")) > > >> and then after calling accepts: > > >> if request.vars.button == "Cancel": > >> session.flash = 'edit canceled' > >> else: > >> session.flash = "edit accepted" > >> redirect(URL(r=request, f='servers')) > > >> ...or something similar in the form.error case. > > >> (I find that I'm a little fuzzy on the various return cases for accepts, > >> though.) > > > That is inevitable since you need to handle two different situations > > in one action. So I would suggest just use a normal html reset button > > at most. > > Reset doesn't do it for me; I need an actual cancel function that can do a > specified page load. > > > > >> Question: what exactly is form[0][-1][1].append appending to? Can I append > >> more than once to that same object? > > > Yes. FORM is a container for many components. You can change it if you > > want to. But a more readable style should be: > > form = FORM( > > ... # all the normal stuff > > INPUT(_type='submit'), > > INPUT(_type='reset'), > > ) > > Except it's an SQLFORM, which won't accept INPUT arguments. > > The big problem with form[0][-1][1].append is that it "knows" too much about > the internal structure of form. I can't expect the guarantee of backward > compatibility to include constructs like that. > > So I'm left with two problems. The IE with multiple submits, and adding a > button to the SQLFORM. Both are semi-solved, I think, but not in an ideal way. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: cancel button
On Feb 7, 2010, at 2:06 PM, mr.freeze wrote: > I hate this too: form[0][-1][1]. I have a pending patch that will > allow you to grab parent and sibling elements so you can do: form = SQLFORM(db.whatever) submit = form.element(_type='submit') submit.parent.append(INPUT(_type='submit',_value='Cancel')) > > A little more verbose but human readable and appending the button will > stay relative to where the submit button is. > > Massimo, have you had a chance to look at this? That would be a big improvement, yes. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: password hash problems
oops. yes. On Feb 7, 2:35 pm, Jonathan Lundell wrote: > On Feb 7, 2010, at 12:07 PM, mdipierro wrote: > > > remember that validators are filters. You need to check that a > > password is strong BEFORE it is hashed. > > So instead of this: > > > auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, > > upper=1, lower=1, number=1, special=1)] > > > Do this > > > auth.settings.table_user.password.insert(0,IS_STRONG(min=8, max=0, > > upper=1, lower=1, number=1, special=1)) > > > Not sure this is your problem but try again after this fix. > > Shouldn't that be > auth.settings.table_user.password.requires.insert(0,IS_STRONG(min=8, max=0, > upper=1, lower=1, number=1, special=1)) ? > > > > > On Feb 7, 1:44 pm, Jonathan Lundell wrote: > >> I've got this (where the key is a text string): > > >> from gluon.tools import * > >> auth=Auth(globals(),db) # authentication/authorization > >> auth.settings.hmac_key = vpepm_hmac_key > >> auth.define_tables() # creates all needed tables > > >> # invoke IS_STRONG only for password creation, not password checking > >> if "login" not in request.args: > >> auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, > >> upper=1, lower=1, number=1, special=1)] > > >> All my logins are failing with a bad password. I've got a sha512 hash in > >> my user database (manually initialized), but the login form is returning > >> an md5 hash, presumably because digest_alg is set to md5. The manual says, > >> "If a key is specified it uses the HMAC+SHA512 with the provided key," but > >> I don't see where digest_alg is ever set to sha512. > > >> Is there a bug, or am I doing something wrong? > > > -- > > You received this message because you are subscribed to the Google Groups > > "web2py-users" group. > > To post to this group, send email to web...@googlegroups.com. > > To unsubscribe from this group, send email to > > web2py+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: AutocompleteWidget: experimental, magic, RFC
On Feb 7, 3:12 pm, "mr.freeze" wrote: > Nice! I like this but I think it needs a few more tweaks. Can you > modify it to allow the arrow keys to select an item? Also, when you > clear the input after typing something, all of the options show. Yes it can be done. It is on my to do list. > > I personally think that javascript should be used more in the > framework (with proper attention paid so that things degrade > gracefully when it's off). Something like auto-completion is just going to break if jQuery is not present. I am not sure if it is possible to make degrade gracefully. > > On Feb 7, 2:11 pm, mdipierro wrote: > > > How about we change IS_IN_DB so that, if the number of referenced > > records exceeds a maximum the auto complete widget is on by default? > > > Massimo > > > On Feb 7, 1:02 am, mdipierro wrote: > > > > I do not know that. I am still playing with it... > > > > On Feb 6, 11:40 pm, Jason Brower wrote: > > > > > I have my current autocomplete but it doesn't do öäå in a search. Does > > > > this handle that? > > > > Best Regards, > > > > Jason > > > > > On Sat, 2010-02-06 at 12:30 -0800, mdipierro wrote: > > > > > People say there is some magic in web2py. > > > > > Here is some real magic now in trunk that I am sure you have never > > > > > seen. > > > > > > Caveats: > > > > > 0) requires latest trunk (bzr 1603, hg 175:e42b559254f6) > > > > > 1) this is an experiment, not sure it is a good idea > > > > > 2) this is the first function in web2py that REQUIRES jQuery > > > > > 3) works but I am not yet convinced it should stay there > > > > > 4) even if it stays, I am sure the API should stay > > > > > > Example: > > > > > > ### assume this model > > > > > db.define_table('target',Field('name')) > > > > > if not db(db.target.id>0).count(): > > > > > db.target.insert(name="Klingon") > > > > > db.target.insert(name="Romulans") > > > > > db.target.insert(name="Borg") > > > > > db.target.insert(name="Borg2") > > > > > db.define_table('photon_torpedo',Field('target',db.target)) > > > > > > ### assume this action in controller default.py > > > > > def launch(): > > > > > db.photon_torpedo.target.represent=lambda target: target.name > > > > > return dict(new_torpedo=crud.create(db.photon_torpedo), > > > > > launched_torpedos=db().select(db.photon_torpedo.ALL)) > > > > > > So far nothing new. > > > > > > Now append to the model or insert at top of controller the following: > > > > > > from gluon.sqlhtml import AutocompleteWidget > > > > > db.photon_torpedo.target.widget=AutocompleteWidget(request,db.target.name,db.target.id) > > > > > > No need to define any callback action (there is no callback action!) > > > > > No plugin required (perhaps some optional css to style). > > > > > No js coding required. > > > > > Applies to existing apps, including those that use custom forms. > > > > > > Let's see who can figure out how it works! > > > > > > Massimo > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: cancel button
The patch will be in soon. ;-) On Feb 7, 4:18 pm, Jonathan Lundell wrote: > On Feb 7, 2010, at 2:06 PM, mr.freeze wrote: > > > I hate this too: form[0][-1][1]. I have a pending patch that will > > allow you to grab parent and sibling elements so you can do: > form = SQLFORM(db.whatever) > submit = form.element(_type='submit') > submit.parent.append(INPUT(_type='submit',_value='Cancel')) > > > A little more verbose but human readable and appending the button will > > stay relative to where the submit button is. > > > Massimo, have you had a chance to look at this? > > That would be a big improvement, yes. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] wiki formatting
While adding a note to the book errata about hash selection, I noticed that the vertical white space (line to line, graf to graf) on that page appears to be mostly random. Or if there's a method to it, I can't tell what it is. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] UnicodeDecodeError sending email
Hi, Upgraded from 1.71 to 1.74.11. This works on 1.71: message = response.render(email_template, email_fields) if not mail.send(to=[form.vars.email], subject=message_title, message=message): raise RuntimeError('Unable to send email') But I get this on 1.74.11: UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 431: unexpected code byte File "c:\web2py\applications\main\controllers\start.py", line 160, in send_status if not mail.send(to=[form.vars.email], subject=message_title, message=message): File "c:\web2py\gluon\tools.py", line 281, in send text = text.decode(encoding).encode('utf-8') File "c:\Python25\Lib\encodings\utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) What's changed? Thanks Russell -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Soaplib problem.
Hi there, I'm trying to install soaplib as per the following: http://www.web2py.com/AlterEgo/default/show/165 I've downloaded soaplib 0.8.1 from http://github.com/jkp/soaplib/downloads Now the one step _crucial_ that is missing from the AlterEgo example is where to place the untared soaplib files. I've tried both putting it under site-packages and my applications module directory but i still get errors: Traceback (most recent call last): File "/Apps/web2py/gluon/restricted.py", line 173, in restricted exec ccode in environment File "/Apps/web2py/applications/testing/controllers/ default.py:index", line 3, in ImportError: No module named soaplib.client [I'm running this with the GAE launcher] Any suggestions? Thanks in advance, Matt PS: Really impressed with what I've seen in web2py. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: cancel button
On Feb 6, 2010, at 9:33 PM, Iceberg wrote: > Yes, but be careful of multiple submit buttons. See this post: > https://groups.google.com/group/web2py/browse_frm/thread/f44b6f95b058df5 I think I've solved the multiple-submit problem, at the cost of a bit of scripting (but not much): form[0][-1][1].append(INPUT(_type="button", _value="Cancel", _onclick="location='%s';"%URL(r=request, f='addserver', vars=dict(button='Cancel' -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: wrong decisions and backward compatibility
But in this case (provided that we really change IS_UPPER() as Pihentagy suggested), you can rely on the human, because they can not input lower case. Your app still need not to edit a single line. :) Well, sounds like I support changing IS_UPPER() 's behavior. But actually I am neutral to this proposal. On Feb7, 3:24pm, Thadeus Burgess wrote: > It will break backwards compatibility. > > I have apps that rely on the functionality of IS_UPPER applying > .upper() to the incoming variables. Anything that requires me to edit > a single line of code on my app to just upgrade web2py breaks > backwards compatibility, unless it was a bug to begin with. > > -Thadeus > > > > On Sat, Feb 6, 2010 at 11:33 PM, Iceberg wrote: > > @Pihentagy: > > > Besides, the current IS_UPPER() (and IS_LOWER()) is not that bad, > > IMHO. What is the real difference between alarm end user to change his > > input into upper case, or just silently change his input into upper > > case? > > > To say the least, we can really change IS_UPPER() to just warning, and > > perhaps another UPPERCASE() to uppercase. As long as the old apps do > > not really break, but just sightly change its behavior in acceptable > > range, I consider web2py is still backward compatible. > > > About web3py, Renato says all. :) > > > On Feb6, 8:24pm, Renato-ES-Brazil wrote: > >> Web3py is an alternative, check this: > > >> > When GAE moves to 3.0 and the database drivers for all supported > >> > backends become available we will release something like web3py (TM). > >> > Since we are going to break language backward compatibility that will > >> > also be a good time to include other non-backward compatible changes. > >> > 2010-2011 are reasonable dates but just a guess. > > >> URL:http://www.mail-archive.com/web2py@googlegroups.com/msg09344.html > > >> On 6 fev, 08:12, pihentagy wrote: > > >> > Hi! > > >> > Looking into the code of IS_UPPER I realized, that this function does > >> > not do, what I expect to do. > >> > I thought it only allows strings, which does not have lowercase > >> > letters, but it actually converts the string to uppercase. > > >> > Since web2py promises backwards compatibility, and here IMHO this > >> > method is mis-named, how would you solve the situation? > > >> > BTW when I come across the fact, that web2py will be always backwards > >> > compatible, a loud alarm began to horn in my head: then how would you > >> > maintain the code in 2, 3, 10 years? It will blow up. > > >> > Or, when it becomes hard to maintain, you began a new project named > >> > web3py? :) > > >> > Gergo > > > -- > > You received this message because you are subscribed to the Google Groups > > "web2py-users" group. > > To post to this group, send email to web...@googlegroups.com. > > To unsubscribe from this group, send email to > > web2py+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: cancel button
The patch by Mr Freeze is in. On Feb 7, 4:27 pm, mdipierro wrote: > The patch will be in soon. ;-) > > On Feb 7, 4:18 pm, Jonathan Lundell wrote: > > > On Feb 7, 2010, at 2:06 PM, mr.freeze wrote: > > > > I hate this too: form[0][-1][1]. I have a pending patch that will > > > allow you to grab parent and sibling elements so you can do: > > form = SQLFORM(db.whatever) > > submit = form.element(_type='submit') > > submit.parent.append(INPUT(_type='submit',_value='Cancel')) > > > > A little more verbose but human readable and appending the button will > > > stay relative to where the submit button is. > > > > Massimo, have you had a chance to look at this? > > > That would be a big improvement, yes. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: wrong decisions and backward compatibility
We could add an option like "strict=False" that if true does what you ask. On Feb 7, 8:22 pm, Iceberg wrote: > But in this case (provided that we really change IS_UPPER() as > Pihentagy suggested), you can rely on the human, because they can not > input lower case. Your app still need not to edit a single line. :) > > Well, sounds like I support changing IS_UPPER() 's behavior. But > actually I am neutral to this proposal. > > On Feb7, 3:24pm, Thadeus Burgess wrote: > > > It will break backwards compatibility. > > > I have apps that rely on the functionality of IS_UPPER applying > > .upper() to the incoming variables. Anything that requires me to edit > > a single line of code on my app to just upgrade web2py breaks > > backwards compatibility, unless it was a bug to begin with. > > > -Thadeus > > > On Sat, Feb 6, 2010 at 11:33 PM, Iceberg wrote: > > > @Pihentagy: > > > > Besides, the current IS_UPPER() (and IS_LOWER()) is not that bad, > > > IMHO. What is the real difference between alarm end user to change his > > > input into upper case, or just silently change his input into upper > > > case? > > > > To say the least, we can really change IS_UPPER() to just warning, and > > > perhaps another UPPERCASE() to uppercase. As long as the old apps do > > > not really break, but just sightly change its behavior in acceptable > > > range, I consider web2py is still backward compatible. > > > > About web3py, Renato says all. :) > > > > On Feb6, 8:24pm, Renato-ES-Brazil wrote: > > >> Web3py is an alternative, check this: > > > >> > When GAE moves to 3.0 and the database drivers for all supported > > >> > backends become available we will release something like web3py (TM). > > >> > Since we are going to break language backward compatibility that will > > >> > also be a good time to include other non-backward compatible changes. > > >> > 2010-2011 are reasonable dates but just a guess. > > > >> URL:http://www.mail-archive.com/web2py@googlegroups.com/msg09344.html > > > >> On 6 fev, 08:12, pihentagy wrote: > > > >> > Hi! > > > >> > Looking into the code of IS_UPPER I realized, that this function does > > >> > not do, what I expect to do. > > >> > I thought it only allows strings, which does not have lowercase > > >> > letters, but it actually converts the string to uppercase. > > > >> > Since web2py promises backwards compatibility, and here IMHO this > > >> > method is mis-named, how would you solve the situation? > > > >> > BTW when I come across the fact, that web2py will be always backwards > > >> > compatible, a loud alarm began to horn in my head: then how would you > > >> > maintain the code in 2, 3, 10 years? It will blow up. > > > >> > Or, when it becomes hard to maintain, you began a new project named > > >> > web3py? :) > > > >> > Gergo > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "web2py-users" group. > > > To post to this group, send email to web...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > web2py+unsubscr...@googlegroups.com. > > > For more options, visit this group > > > athttp://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: AutocompleteWidget: experimental, magic, RFC
Now it is very customizable and works well, including right, up, down arrows. It requires at least two chars to start the ajax calls. just do db.table.field.widget=AutocompleteWidget(request,db.othertable.name,db.othertable.id) it looks up in field "name" for the value of "id". On Feb 7, 3:12 pm, "mr.freeze" wrote: > Nice! I like this but I think it needs a few more tweaks. Can you > modify it to allow the arrow keys to select an item? Also, when you > clear the input after typing something, all of the options show. > > I personally think that javascript should be used more in the > framework (with proper attention paid so that things degrade > gracefully when it's off). > > On Feb 7, 2:11 pm, mdipierro wrote: > > > How about we change IS_IN_DB so that, if the number of referenced > > records exceeds a maximum the auto complete widget is on by default? > > > Massimo > > > On Feb 7, 1:02 am, mdipierro wrote: > > > > I do not know that. I am still playing with it... > > > > On Feb 6, 11:40 pm, Jason Brower wrote: > > > > > I have my current autocomplete but it doesn't do öäå in a search. Does > > > > this handle that? > > > > Best Regards, > > > > Jason > > > > > On Sat, 2010-02-06 at 12:30 -0800, mdipierro wrote: > > > > > People say there is some magic in web2py. > > > > > Here is some real magic now in trunk that I am sure you have never > > > > > seen. > > > > > > Caveats: > > > > > 0) requires latest trunk (bzr 1603, hg 175:e42b559254f6) > > > > > 1) this is an experiment, not sure it is a good idea > > > > > 2) this is the first function in web2py that REQUIRES jQuery > > > > > 3) works but I am not yet convinced it should stay there > > > > > 4) even if it stays, I am sure the API should stay > > > > > > Example: > > > > > > ### assume this model > > > > > db.define_table('target',Field('name')) > > > > > if not db(db.target.id>0).count(): > > > > > db.target.insert(name="Klingon") > > > > > db.target.insert(name="Romulans") > > > > > db.target.insert(name="Borg") > > > > > db.target.insert(name="Borg2") > > > > > db.define_table('photon_torpedo',Field('target',db.target)) > > > > > > ### assume this action in controller default.py > > > > > def launch(): > > > > > db.photon_torpedo.target.represent=lambda target: target.name > > > > > return dict(new_torpedo=crud.create(db.photon_torpedo), > > > > > launched_torpedos=db().select(db.photon_torpedo.ALL)) > > > > > > So far nothing new. > > > > > > Now append to the model or insert at top of controller the following: > > > > > > from gluon.sqlhtml import AutocompleteWidget > > > > > db.photon_torpedo.target.widget=AutocompleteWidget(request,db.target.name,db.target.id) > > > > > > No need to define any callback action (there is no callback action!) > > > > > No plugin required (perhaps some optional css to style). > > > > > No js coding required. > > > > > Applies to existing apps, including those that use custom forms. > > > > > > Let's see who can figure out how it works! > > > > > > Massimo > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Soaplib problem.
I just tried. wget http:///...soaplib-0.8.1 -o ~/Downloads/soaplib-0.8.1.tar cd ~/Downloads/ tar zxvf soaplib-0.8.1.tar cd ~/web2py cp -r ~/Downloads/soaplib-0.8.1/soaplib site-packages It works but requires import lxml.etree as ElementTree and I think that is a binary package that does not work on GAE. I do not know if it is already there. unzipping it into web2py/site-packages should be the way to go. On Feb 7, 6:38 pm, Matt wrote: > Hi there, > > I'm trying to install soaplib as per the following: > > http://www.web2py.com/AlterEgo/default/show/165 > > I've downloaded soaplib 0.8.1 from > > http://github.com/jkp/soaplib/downloads > > Now the one step _crucial_ that is missing from the AlterEgo example > is where to place the untared soaplib files. > > I've tried both putting it under site-packages and my applications > module directory but i still get errors: > > Traceback (most recent call last): > File "/Apps/web2py/gluon/restricted.py", line 173, in restricted > exec ccode in environment > File "/Apps/web2py/applications/testing/controllers/ > default.py:index", line 3, in > ImportError: No module named soaplib.client > > [I'm running this with the GAE launcher] > > Any suggestions? > > Thanks in advance, > Matt > > PS: Really impressed with what I've seen in web2py. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: AutocompleteWidget: experimental, magic, RFC
Looking good but now I can't select an unselected option by clicking. I can only select the currently selected option with a mouse click. On Feb 7, 8:34 pm, mdipierro wrote: > Now it is very customizable and works well, including right, up, down > arrows. It requires at least two chars to start the ajax calls. > > just do > > db.table.field.widget=AutocompleteWidget(request,db.othertable.name,db.othertable.id) > > it looks up in field "name" for the value of "id". > > On Feb 7, 3:12 pm, "mr.freeze" wrote: > > > Nice! I like this but I think it needs a few more tweaks. Can you > > modify it to allow the arrow keys to select an item? Also, when you > > clear the input after typing something, all of the options show. > > > I personally think that javascript should be used more in the > > framework (with proper attention paid so that things degrade > > gracefully when it's off). > > > On Feb 7, 2:11 pm, mdipierro wrote: > > > > How about we change IS_IN_DB so that, if the number of referenced > > > records exceeds a maximum the auto complete widget is on by default? > > > > Massimo > > > > On Feb 7, 1:02 am, mdipierro wrote: > > > > > I do not know that. I am still playing with it... > > > > > On Feb 6, 11:40 pm, Jason Brower wrote: > > > > > > I have my current autocomplete but it doesn't do öäå in a search. > > > > > Does > > > > > this handle that? > > > > > Best Regards, > > > > > Jason > > > > > > On Sat, 2010-02-06 at 12:30 -0800, mdipierro wrote: > > > > > > People say there is some magic in web2py. > > > > > > Here is some real magic now in trunk that I am sure you have never > > > > > > seen. > > > > > > > Caveats: > > > > > > 0) requires latest trunk (bzr 1603, hg 175:e42b559254f6) > > > > > > 1) this is an experiment, not sure it is a good idea > > > > > > 2) this is the first function in web2py that REQUIRES jQuery > > > > > > 3) works but I am not yet convinced it should stay there > > > > > > 4) even if it stays, I am sure the API should stay > > > > > > > Example: > > > > > > > ### assume this model > > > > > > db.define_table('target',Field('name')) > > > > > > if not db(db.target.id>0).count(): > > > > > > db.target.insert(name="Klingon") > > > > > > db.target.insert(name="Romulans") > > > > > > db.target.insert(name="Borg") > > > > > > db.target.insert(name="Borg2") > > > > > > db.define_table('photon_torpedo',Field('target',db.target)) > > > > > > > ### assume this action in controller default.py > > > > > > def launch(): > > > > > > db.photon_torpedo.target.represent=lambda target: target.name > > > > > > return dict(new_torpedo=crud.create(db.photon_torpedo), > > > > > > > > > > > > launched_torpedos=db().select(db.photon_torpedo.ALL)) > > > > > > > So far nothing new. > > > > > > > Now append to the model or insert at top of controller the > > > > > > following: > > > > > > > from gluon.sqlhtml import AutocompleteWidget > > > > > > db.photon_torpedo.target.widget=AutocompleteWidget(request,db.target.name,db.target.id) > > > > > > > No need to define any callback action (there is no callback action!) > > > > > > No plugin required (perhaps some optional css to style). > > > > > > No js coding required. > > > > > > Applies to existing apps, including those that use custom forms. > > > > > > > Let's see who can figure out how it works! > > > > > > > Massimo > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Soaplib problem.
So realistically the soaplib package won't work on GAE due to the lxml dependency. Do you know of any other products that I should consider? I only need to consume web services. Potentially I could hack soaplib but that seems a little extreme. Thanks, Matt On Feb 8, 3:42 pm, mdipierro wrote: > I just tried. > wget http:///...soaplib-0.8.1 -o ~/Downloads/soaplib-0.8.1.tar > cd ~/Downloads/ > tar zxvf soaplib-0.8.1.tar > cd ~/web2py > cp -r ~/Downloads/soaplib-0.8.1/soaplib site-packages > > It works but requires > import lxml.etree as ElementTree > > and I think that is a binary package that does not work on GAE. I do > not know if it is already there. > > unzipping it into web2py/site-packages should be the way to go. > > On Feb 7, 6:38 pm, Matt wrote: > > > Hi there, > > > I'm trying to install soaplib as per the following: > > >http://www.web2py.com/AlterEgo/default/show/165 > > > I've downloaded soaplib 0.8.1 from > > >http://github.com/jkp/soaplib/downloads > > > Now the one step _crucial_ that is missing from the AlterEgo example > > is where to place the untared soaplib files. > > > I've tried both putting it under site-packages and my applications > > module directory but i still get errors: > > > Traceback (most recent call last): > > File "/Apps/web2py/gluon/restricted.py", line 173, in restricted > > exec ccode in environment > > File "/Apps/web2py/applications/testing/controllers/ > > default.py:index", line 3, in > > ImportError: No module named soaplib.client > > > [I'm running this with the GAE launcher] > > > Any suggestions? > > > Thanks in advance, > > Matt > > > PS: Really impressed with what I've seen in web2py. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: wrong decisions and backward compatibility
No, you cannot rely on the user. Users are stupid. The system needs to be as simple as possible for the users to use the system to get their work done. There is no need to bother the user with "Form errors: Value must be uppercase". This wastes the users time to have to remember to input in upper case. You could also argue that there are lots of functions in django that don't do what you "expect" them to do. We can't change documented functionality of web2py just because one user does not "expect" it to work the way it does. The keyword here is documented, IS_UPPER is documented to act this way. using strict=True is good. but how can we assure this change does not get lost in the google group never to arise again until you look at the source code and realize its there. -Thadeus On Sun, Feb 7, 2010 at 8:32 PM, mdipierro wrote: > We could add an option like "strict=False" that if true does what you > ask. > > On Feb 7, 8:22 pm, Iceberg wrote: >> But in this case (provided that we really change IS_UPPER() as >> Pihentagy suggested), you can rely on the human, because they can not >> input lower case. Your app still need not to edit a single line. :) >> >> Well, sounds like I support changing IS_UPPER() 's behavior. But >> actually I am neutral to this proposal. >> >> On Feb7, 3:24pm, Thadeus Burgess wrote: >> >> > It will break backwards compatibility. >> >> > I have apps that rely on the functionality of IS_UPPER applying >> > .upper() to the incoming variables. Anything that requires me to edit >> > a single line of code on my app to just upgrade web2py breaks >> > backwards compatibility, unless it was a bug to begin with. >> >> > -Thadeus >> >> > On Sat, Feb 6, 2010 at 11:33 PM, Iceberg wrote: >> > > @Pihentagy: >> >> > > Besides, the current IS_UPPER() (and IS_LOWER()) is not that bad, >> > > IMHO. What is the real difference between alarm end user to change his >> > > input into upper case, or just silently change his input into upper >> > > case? >> >> > > To say the least, we can really change IS_UPPER() to just warning, and >> > > perhaps another UPPERCASE() to uppercase. As long as the old apps do >> > > not really break, but just sightly change its behavior in acceptable >> > > range, I consider web2py is still backward compatible. >> >> > > About web3py, Renato says all. :) >> >> > > On Feb6, 8:24pm, Renato-ES-Brazil wrote: >> > >> Web3py is an alternative, check this: >> >> > >> > When GAE moves to 3.0 and the database drivers for all supported >> > >> > backends become available we will release something like web3py (TM). >> > >> > Since we are going to break language backward compatibility that will >> > >> > also be a good time to include other non-backward compatible changes. >> > >> > 2010-2011 are reasonable dates but just a guess. >> >> > >> URL:http://www.mail-archive.com/web2py@googlegroups.com/msg09344.html >> >> > >> On 6 fev, 08:12, pihentagy wrote: >> >> > >> > Hi! >> >> > >> > Looking into the code of IS_UPPER I realized, that this function does >> > >> > not do, what I expect to do. >> > >> > I thought it only allows strings, which does not have lowercase >> > >> > letters, but it actually converts the string to uppercase. >> >> > >> > Since web2py promises backwards compatibility, and here IMHO this >> > >> > method is mis-named, how would you solve the situation? >> >> > >> > BTW when I come across the fact, that web2py will be always backwards >> > >> > compatible, a loud alarm began to horn in my head: then how would you >> > >> > maintain the code in 2, 3, 10 years? It will blow up. >> >> > >> > Or, when it becomes hard to maintain, you began a new project named >> > >> > web3py? :) >> >> > >> > Gergo >> >> > > -- >> > > You received this message because you are subscribed to the Google >> > > Groups "web2py-users" group. >> > > To post to this group, send email to web...@googlegroups.com. >> > > To unsubscribe from this group, send email to >> > > web2py+unsubscr...@googlegroups.com. >> > > For more options, visit this group >> > > athttp://groups.google.com/group/web2py?hl=en. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: wrong decisions and backward compatibility
On Feb 7, 2010, at 6:32 PM, mdipierro wrote: > We could add an option like "strict=False" that if true does what you > ask. What's the use case? I'm having trouble seeing what such an option would do for you. Sure, IS_UPPER() should probably have been named TO_UPPER(). But at this point > > On Feb 7, 8:22 pm, Iceberg wrote: >> But in this case (provided that we really change IS_UPPER() as >> Pihentagy suggested), you can rely on the human, because they can not >> input lower case. Your app still need not to edit a single line. :) >> >> Well, sounds like I support changing IS_UPPER() 's behavior. But >> actually I am neutral to this proposal. >> >> On Feb7, 3:24pm, Thadeus Burgess wrote: >> >>> It will break backwards compatibility. >> >>> I have apps that rely on the functionality of IS_UPPER applying >>> .upper() to the incoming variables. Anything that requires me to edit >>> a single line of code on my app to just upgrade web2py breaks >>> backwards compatibility, unless it was a bug to begin with. >> >>> -Thadeus >> >>> On Sat, Feb 6, 2010 at 11:33 PM, Iceberg wrote: @Pihentagy: >> Besides, the current IS_UPPER() (and IS_LOWER()) is not that bad, IMHO. What is the real difference between alarm end user to change his input into upper case, or just silently change his input into upper case? >> To say the least, we can really change IS_UPPER() to just warning, and perhaps another UPPERCASE() to uppercase. As long as the old apps do not really break, but just sightly change its behavior in acceptable range, I consider web2py is still backward compatible. >> About web3py, Renato says all. :) >> On Feb6, 8:24pm, Renato-ES-Brazil wrote: > Web3py is an alternative, check this: >> >> When GAE moves to 3.0 and the database drivers for all supported >> backends become available we will release something like web3py (TM). >> Since we are going to break language backward compatibility that will >> also be a good time to include other non-backward compatible changes. >> 2010-2011 are reasonable dates but just a guess. >> > URL:http://www.mail-archive.com/web2py@googlegroups.com/msg09344.html >> > On 6 fev, 08:12, pihentagy wrote: >> >> Hi! >> >> Looking into the code of IS_UPPER I realized, that this function does >> not do, what I expect to do. >> I thought it only allows strings, which does not have lowercase >> letters, but it actually converts the string to uppercase. >> >> Since web2py promises backwards compatibility, and here IMHO this >> method is mis-named, how would you solve the situation? >> >> BTW when I come across the fact, that web2py will be always backwards >> compatible, a loud alarm began to horn in my head: then how would you >> maintain the code in 2, 3, 10 years? It will blow up. >> >> Or, when it becomes hard to maintain, you began a new project named >> web3py? :) >> >> Gergo >> -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
Re: [web2py] Re: cancel button
On Feb 7, 2010, at 6:31 PM, mdipierro wrote: > The patch by Mr Freeze is in. Thanks. I'll wait for a stable release, but I'll definitely use it. Some documentary comments would be nice. (BTW, the patch added trailing white space to a few lines. Bogus, I assume.) > > On Feb 7, 4:27 pm, mdipierro wrote: >> The patch will be in soon. ;-) >> >> On Feb 7, 4:18 pm, Jonathan Lundell wrote: >> >>> On Feb 7, 2010, at 2:06 PM, mr.freeze wrote: >> I hate this too: form[0][-1][1]. I have a pending patch that will allow you to grab parent and sibling elements so you can do: >>> form = SQLFORM(db.whatever) >>> submit = form.element(_type='submit') >>> submit.parent.append(INPUT(_type='submit',_value='Cancel')) >> A little more verbose but human readable and appending the button will stay relative to where the submit button is. >> Massimo, have you had a chance to look at this? >> >>> That would be a big improvement, yes. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: AutocompleteWidget: experimental, magic, RFC
Please give it a try. It seems some time requires double click instead of single click but cannot figure out why. On Feb 7, 8:52 pm, "mr.freeze" wrote: > Looking good but now I can't select an unselected option by clicking. > I can only select the currently selected option with a mouse click. > > On Feb 7, 8:34 pm, mdipierro wrote: > > > Now it is very customizable and works well, including right, up, down > > arrows. It requires at least two chars to start the ajax calls. > > > just do > > > db.table.field.widget=AutocompleteWidget(request,db.othertable.name,db.othertable.id) > > > it looks up in field "name" for the value of "id". > > > On Feb 7, 3:12 pm, "mr.freeze" wrote: > > > > Nice! I like this but I think it needs a few more tweaks. Can you > > > modify it to allow the arrow keys to select an item? Also, when you > > > clear the input after typing something, all of the options show. > > > > I personally think that javascript should be used more in the > > > framework (with proper attention paid so that things degrade > > > gracefully when it's off). > > > > On Feb 7, 2:11 pm, mdipierro wrote: > > > > > How about we change IS_IN_DB so that, if the number of referenced > > > > records exceeds a maximum the auto complete widget is on by default? > > > > > Massimo > > > > > On Feb 7, 1:02 am, mdipierro wrote: > > > > > > I do not know that. I am still playing with it... > > > > > > On Feb 6, 11:40 pm, Jason Brower wrote: > > > > > > > I have my current autocomplete but it doesn't do öäå in a search. > > > > > > Does > > > > > > this handle that? > > > > > > Best Regards, > > > > > > Jason > > > > > > > On Sat, 2010-02-06 at 12:30 -0800, mdipierro wrote: > > > > > > > People say there is some magic in web2py. > > > > > > > Here is some real magic now in trunk that I am sure you have never > > > > > > > seen. > > > > > > > > Caveats: > > > > > > > 0) requires latest trunk (bzr 1603, hg 175:e42b559254f6) > > > > > > > 1) this is an experiment, not sure it is a good idea > > > > > > > 2) this is the first function in web2py that REQUIRES jQuery > > > > > > > 3) works but I am not yet convinced it should stay there > > > > > > > 4) even if it stays, I am sure the API should stay > > > > > > > > Example: > > > > > > > > ### assume this model > > > > > > > db.define_table('target',Field('name')) > > > > > > > if not db(db.target.id>0).count(): > > > > > > > db.target.insert(name="Klingon") > > > > > > > db.target.insert(name="Romulans") > > > > > > > db.target.insert(name="Borg") > > > > > > > db.target.insert(name="Borg2") > > > > > > > db.define_table('photon_torpedo',Field('target',db.target)) > > > > > > > > ### assume this action in controller default.py > > > > > > > def launch(): > > > > > > > db.photon_torpedo.target.represent=lambda target: target.name > > > > > > > return dict(new_torpedo=crud.create(db.photon_torpedo), > > > > > > > > > > > > > > launched_torpedos=db().select(db.photon_torpedo.ALL)) > > > > > > > > So far nothing new. > > > > > > > > Now append to the model or insert at top of controller the > > > > > > > following: > > > > > > > > from gluon.sqlhtml import AutocompleteWidget > > > > > > > db.photon_torpedo.target.widget=AutocompleteWidget(request,db.target.name,db.target.id) > > > > > > > > No need to define any callback action (there is no callback > > > > > > > action!) > > > > > > > No plugin required (perhaps some optional css to style). > > > > > > > No js coding required. > > > > > > > Applies to existing apps, including those that use custom forms. > > > > > > > > Let's see who can figure out how it works! > > > > > > > > Massimo > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Soaplib problem.
What do you need specifically? client or server? On Feb 7, 9:07 pm, Matt wrote: > So realistically the soaplib package won't work on GAE due to the lxml > dependency. > > Do you know of any other products that I should consider? I only need > to consume web services. > > Potentially I could hack soaplib but that seems a little extreme. > > Thanks, > Matt > > On Feb 8, 3:42 pm, mdipierro wrote: > > > I just tried. > > wget http:///...soaplib-0.8.1 -o ~/Downloads/soaplib-0.8.1.tar > > cd ~/Downloads/ > > tar zxvf soaplib-0.8.1.tar > > cd ~/web2py > > cp -r ~/Downloads/soaplib-0.8.1/soaplib site-packages > > > It works but requires > > import lxml.etree as ElementTree > > > and I think that is a binary package that does not work on GAE. I do > > not know if it is already there. > > > unzipping it into web2py/site-packages should be the way to go. > > > On Feb 7, 6:38 pm, Matt wrote: > > > > Hi there, > > > > I'm trying to install soaplib as per the following: > > > >http://www.web2py.com/AlterEgo/default/show/165 > > > > I've downloaded soaplib 0.8.1 from > > > >http://github.com/jkp/soaplib/downloads > > > > Now the one step _crucial_ that is missing from the AlterEgo example > > > is where to place the untared soaplib files. > > > > I've tried both putting it under site-packages and my applications > > > module directory but i still get errors: > > > > Traceback (most recent call last): > > > File "/Apps/web2py/gluon/restricted.py", line 173, in restricted > > > exec ccode in environment > > > File "/Apps/web2py/applications/testing/controllers/ > > > default.py:index", line 3, in > > > ImportError: No module named soaplib.client > > > > [I'm running this with the GAE launcher] > > > > Any suggestions? > > > > Thanks in advance, > > > Matt > > > > PS: Really impressed with what I've seen in web2py. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Soaplib problem.
client. On Feb 8, 5:35 pm, mdipierro wrote: > What do you need specifically? client or server? > > On Feb 7, 9:07 pm, Matt wrote: > > > So realistically the soaplib package won't work on GAE due to the lxml > > dependency. > > > Do you know of any other products that I should consider? I only need > > to consume web services. > > > Potentially I could hack soaplib but that seems a little extreme. > > > Thanks, > > Matt > > > On Feb 8, 3:42 pm, mdipierro wrote: > > > > I just tried. > > > wget http:///...soaplib-0.8.1 -o ~/Downloads/soaplib-0.8.1.tar > > > cd ~/Downloads/ > > > tar zxvf soaplib-0.8.1.tar > > > cd ~/web2py > > > cp -r ~/Downloads/soaplib-0.8.1/soaplib site-packages > > > > It works but requires > > > import lxml.etree as ElementTree > > > > and I think that is a binary package that does not work on GAE. I do > > > not know if it is already there. > > > > unzipping it into web2py/site-packages should be the way to go. > > > > On Feb 7, 6:38 pm, Matt wrote: > > > > > Hi there, > > > > > I'm trying to install soaplib as per the following: > > > > >http://www.web2py.com/AlterEgo/default/show/165 > > > > > I've downloaded soaplib 0.8.1 from > > > > >http://github.com/jkp/soaplib/downloads > > > > > Now the one step _crucial_ that is missing from the AlterEgo example > > > > is where to place the untared soaplib files. > > > > > I've tried both putting it under site-packages and my applications > > > > module directory but i still get errors: > > > > > Traceback (most recent call last): > > > > File "/Apps/web2py/gluon/restricted.py", line 173, in restricted > > > > exec ccode in environment > > > > File "/Apps/web2py/applications/testing/controllers/ > > > > default.py:index", line 3, in > > > > ImportError: No module named soaplib.client > > > > > [I'm running this with the GAE launcher] > > > > > Any suggestions? > > > > > Thanks in advance, > > > > Matt > > > > > PS: Really impressed with what I've seen in web2py. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: AutocompleteWidget: experimental, magic, RFC
It is doing two callbacks, one to get autocomplete options and one when you click an item. It seems like it shouldn't do the second one. Also, it probably shouldn't submit the form if you hit the enter key while selecting an option. You might try breaking that huge js code on attr['_onkeyup'] into smaller more digestible pieces to see what's going on :) There should really be a widget script resource section in web2py_ajax.html so that widget makers can include global functions and styles that multiple instances of a widget can use. Kind of like response.files but raw code instead of file includes. Maybe just a blank jQuery(document).ready function at the end of web2py_ajax.html that renders a list called response.ready. Putting it at the end will keep user code from breaking necessary framework code. Thoughts? On Feb 7, 10:34 pm, mdipierro wrote: > Please give it a try. It seems some time requires double click instead > of single click but cannot figure out why. > > On Feb 7, 8:52 pm, "mr.freeze" wrote: > > > Looking good but now I can't select an unselected option by clicking. > > I can only select the currently selected option with a mouse click. > > > On Feb 7, 8:34 pm, mdipierro wrote: > > > > Now it is very customizable and works well, including right, up, down > > > arrows. It requires at least two chars to start the ajax calls. > > > > just do > > > > db.table.field.widget=AutocompleteWidget(request,db.othertable.name,db.othertable.id) > > > > it looks up in field "name" for the value of "id". > > > > On Feb 7, 3:12 pm, "mr.freeze" wrote: > > > > > Nice! I like this but I think it needs a few more tweaks. Can you > > > > modify it to allow the arrow keys to select an item? Also, when you > > > > clear the input after typing something, all of the options show. > > > > > I personally think that javascript should be used more in the > > > > framework (with proper attention paid so that things degrade > > > > gracefully when it's off). > > > > > On Feb 7, 2:11 pm, mdipierro wrote: > > > > > > How about we change IS_IN_DB so that, if the number of referenced > > > > > records exceeds a maximum the auto complete widget is on by default? > > > > > > Massimo > > > > > > On Feb 7, 1:02 am, mdipierro wrote: > > > > > > > I do not know that. I am still playing with it... > > > > > > > On Feb 6, 11:40 pm, Jason Brower wrote: > > > > > > > > I have my current autocomplete but it doesn't do öäå in a search. > > > > > > > Does > > > > > > > this handle that? > > > > > > > Best Regards, > > > > > > > Jason > > > > > > > > On Sat, 2010-02-06 at 12:30 -0800, mdipierro wrote: > > > > > > > > People say there is some magic in web2py. > > > > > > > > Here is some real magic now in trunk that I am sure you have > > > > > > > > never > > > > > > > > seen. > > > > > > > > > Caveats: > > > > > > > > 0) requires latest trunk (bzr 1603, hg 175:e42b559254f6) > > > > > > > > 1) this is an experiment, not sure it is a good idea > > > > > > > > 2) this is the first function in web2py that REQUIRES jQuery > > > > > > > > 3) works but I am not yet convinced it should stay there > > > > > > > > 4) even if it stays, I am sure the API should stay > > > > > > > > > Example: > > > > > > > > > ### assume this model > > > > > > > > db.define_table('target',Field('name')) > > > > > > > > if not db(db.target.id>0).count(): > > > > > > > > db.target.insert(name="Klingon") > > > > > > > > db.target.insert(name="Romulans") > > > > > > > > db.target.insert(name="Borg") > > > > > > > > db.target.insert(name="Borg2") > > > > > > > > db.define_table('photon_torpedo',Field('target',db.target)) > > > > > > > > > ### assume this action in controller default.py > > > > > > > > def launch(): > > > > > > > > db.photon_torpedo.target.represent=lambda target: > > > > > > > > target.name > > > > > > > > return dict(new_torpedo=crud.create(db.photon_torpedo), > > > > > > > > > > > > > > > > launched_torpedos=db().select(db.photon_torpedo.ALL)) > > > > > > > > > So far nothing new. > > > > > > > > > Now append to the model or insert at top of controller the > > > > > > > > following: > > > > > > > > > from gluon.sqlhtml import AutocompleteWidget > > > > > > > > db.photon_torpedo.target.widget=AutocompleteWidget(request,db.target.name,db.target.id) > > > > > > > > > No need to define any callback action (there is no callback > > > > > > > > action!) > > > > > > > > No plugin required (perhaps some optional css to style). > > > > > > > > No js coding required. > > > > > > > > Applies to existing apps, including those that use custom forms. > > > > > > > > > Let's see who can figure out how it works! > > > > > > > > > Massimo > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this g
[web2py] Re: Soaplib problem.
I've heard good things about SUDS: https://fedorahosted.org/suds/ I've never used it and I don't know if it works on GAE but might be worth a shot. On Feb 7, 9:07 pm, Matt wrote: > So realistically the soaplib package won't work on GAE due to the lxml > dependency. > > Do you know of any other products that I should consider? I only need > to consume web services. > > Potentially I could hack soaplib but that seems a little extreme. > > Thanks, > Matt > > On Feb 8, 3:42 pm, mdipierro wrote: > > > I just tried. > > wget http:///...soaplib-0.8.1 -o ~/Downloads/soaplib-0.8.1.tar > > cd ~/Downloads/ > > tar zxvf soaplib-0.8.1.tar > > cd ~/web2py > > cp -r ~/Downloads/soaplib-0.8.1/soaplib site-packages > > > It works but requires > > import lxml.etree as ElementTree > > > and I think that is a binary package that does not work on GAE. I do > > not know if it is already there. > > > unzipping it into web2py/site-packages should be the way to go. > > > On Feb 7, 6:38 pm, Matt wrote: > > > > Hi there, > > > > I'm trying to install soaplib as per the following: > > > >http://www.web2py.com/AlterEgo/default/show/165 > > > > I've downloaded soaplib 0.8.1 from > > > >http://github.com/jkp/soaplib/downloads > > > > Now the one step _crucial_ that is missing from the AlterEgo example > > > is where to place the untared soaplib files. > > > > I've tried both putting it under site-packages and my applications > > > module directory but i still get errors: > > > > Traceback (most recent call last): > > > File "/Apps/web2py/gluon/restricted.py", line 173, in restricted > > > exec ccode in environment > > > File "/Apps/web2py/applications/testing/controllers/ > > > default.py:index", line 3, in > > > ImportError: No module named soaplib.client > > > > [I'm running this with the GAE launcher] > > > > Any suggestions? > > > > Thanks in advance, > > > Matt > > > > PS: Really impressed with what I've seen in web2py. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: Soaplib problem.
It may work. Seems to use only basic libraries. On Feb 7, 11:34 pm, "mr.freeze" wrote: > I've heard good things about SUDS:https://fedorahosted.org/suds/ > > I've never used it and I don't know if it works on GAE but might be > worth a shot. > > On Feb 7, 9:07 pm, Matt wrote: > > > So realistically the soaplib package won't work on GAE due to the lxml > > dependency. > > > Do you know of any other products that I should consider? I only need > > to consume web services. > > > Potentially I could hack soaplib but that seems a little extreme. > > > Thanks, > > Matt > > > On Feb 8, 3:42 pm, mdipierro wrote: > > > > I just tried. > > > wget http:///...soaplib-0.8.1 -o ~/Downloads/soaplib-0.8.1.tar > > > cd ~/Downloads/ > > > tar zxvf soaplib-0.8.1.tar > > > cd ~/web2py > > > cp -r ~/Downloads/soaplib-0.8.1/soaplib site-packages > > > > It works but requires > > > import lxml.etree as ElementTree > > > > and I think that is a binary package that does not work on GAE. I do > > > not know if it is already there. > > > > unzipping it into web2py/site-packages should be the way to go. > > > > On Feb 7, 6:38 pm, Matt wrote: > > > > > Hi there, > > > > > I'm trying to install soaplib as per the following: > > > > >http://www.web2py.com/AlterEgo/default/show/165 > > > > > I've downloaded soaplib 0.8.1 from > > > > >http://github.com/jkp/soaplib/downloads > > > > > Now the one step _crucial_ that is missing from the AlterEgo example > > > > is where to place the untared soaplib files. > > > > > I've tried both putting it under site-packages and my applications > > > > module directory but i still get errors: > > > > > Traceback (most recent call last): > > > > File "/Apps/web2py/gluon/restricted.py", line 173, in restricted > > > > exec ccode in environment > > > > File "/Apps/web2py/applications/testing/controllers/ > > > > default.py:index", line 3, in > > > > ImportError: No module named soaplib.client > > > > > [I'm running this with the GAE launcher] > > > > > Any suggestions? > > > > > Thanks in advance, > > > > Matt > > > > > PS: Really impressed with what I've seen in web2py. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: UnicodeDecodeError sending email
It looks like your massage contains non utf8 characters. It may have worked before but may have sent garbage to the recipient. Try mail=Mail(encoding='latin1') On Feb 7, 5:58 pm, Russell wrote: > Hi, > > Upgraded from 1.71 to 1.74.11. This works on 1.71: > > message = response.render(email_template, email_fields) > if not mail.send(to=[form.vars.email], subject=message_title, > message=message): > raise RuntimeError('Unable to send email') > > But I get this on 1.74.11: > > UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position > 431: unexpected code byte > File "c:\web2py\applications\main\controllers\start.py", line 160, in > send_status > if not mail.send(to=[form.vars.email], subject=message_title, > message=message): > File "c:\web2py\gluon\tools.py", line 281, in send > text = text.decode(encoding).encode('utf-8') > File "c:\Python25\Lib\encodings\utf_8.py", line 16, in decode > return codecs.utf_8_decode(input, errors, True) > > What's changed? > > Thanks > Russell -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Can crud update more than one table at a time?
Can I do this? form=crud.update(db.table1,db.table2,db.table3,request.args(2)) or is SQLFORM.factory the only way to do that? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: calling form through ajax fails even using formname=None
ok 1st of all, I don't use "web2py_ajax_page" functions and the particular code looks like : def governorate(): form = crud.create(db.governorate) query = auth.accessible_query('CAN_VIEW', db.governorate, auth.user.id) governorates=db(query).select(orderby=db.governorate.name) return dict(governorates=governorates, form=form) def edit_governorate(): if not auth.has_permission('CAN_VIEW', db.governorate, 0, auth.user.id): raise HTTP(403) form = SQLFORM(db.governorate ,request.vars.gov_id) #crud.update(db.governorate ,request.vars.gov_id) if form.accepts(request.vars, formname=None):pass return dict(form=form) the view looks like : governorate.html - function func(id) { var url = "{{=URL(request.application, 'admin', 'edit_governorate')}}"+ "?gov_id=" + id; ajax(url, [], 'governorate_form'); }; {{=T("New Governorate")}} {{=make_clickable("New Governorate","admin","governorate")}} {{=form}} {{=T("Governorate Name")}} {{for governorate in governorates:}} {{=governorate.name}} {{pass}} in the edit_governorate.html - {{=A(T("Add New Governorate"), _href=URL(request.application, 'admin', 'governorate'))}} {{=form}} Now is the symbtoms are as follows : I can add new governorate using an add form and record does appear immediately in my table below the form in the same page when clicking a table record which is a governorate, the update form does appear correctly in the same place that "the add new form" appears , and the "add new" does disappear The problem is thst I ca't update/delete the update form , when clicking submit button, the update form does disaapear and the other form [add new] does appear, but records are not updated -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.