[web2py] Re: alias field names
Hi all, My situation is that I have to work with already defined tables. There is a field name 'pass', this is keyword of Python, I don't how to solve this. So I think alias for table field is necessary. Anyone can suggest for this situation? Thanks in advance! Regards, Tuan. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Nginx proxy for Apache error
Hi Leonel, I want nginx will stand as proxy server. Note : when I add more node in upstream, it works normally! On 18 September 2015 at 14:40, Leonel Câmarawrote: > Why don't you setup web2py with nginx directly using uwsgi-emperor? > There's no need to have apache involved. > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/MjovH5XnKVk/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Nginx proxy for Apache error
Hi, I setup Web2py with Apache successfully, but when I setup a Nginx proxy for Apache server I get error : --- (getattr(): attribute name must be string) Traceback (most recent call last): File "C:\web2py\gluon\main.py", line 436, in wsgibase session.connect(request, response) File "C:\web2py\gluon\globals.py", line 960, in connect session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL) File "C:\web2py\gluon\storage.py", line 56, in getnewargs = lambda self: getattr(dict,self).__getnewargs__(self) TypeError: getattr(): attribute name must be string --- Environment : - Web2py 2.11.2 - Apache 2.2.25 - Nginx 1.0.15 Nginx proxy setting : upstream qlkh { ip_hash; server 192.168.128.4:8080; } server { listen80; location / { if ($request_uri ~* ".(jpg|jpeg|gif|gz|zip|flv|rar|wmv|avi|css|swf|png|htc|ico|mpeg|mpg|txt|mp3|mov|js)(\?v=[0-9.]+)?$") { expires 30d; break; } proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; add_header X-Cache-Status $upstream_cache_status; proxy_pass http://qlkh; } } Does anyone got this error? please help! Thanks in advance! Tuan. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: tip of the day. The power of routes
Hi Lyn2py, can you send your script? On 5 July 2014 14:33, lyn2py lyn...@gmail.com wrote: Hi Tuan, I tried the change (line in red) but it couldn't route to my app properly. I'm not familiar with the regex routes, so I'm using it as-is. I don't know how to troubleshoot this. On Friday, July 4, 2014 9:59:37 AM UTC+8, Nguyen Minh Tuan wrote: Hi Massimo, Lyn2py posted above is that issue I met, I post complete script : (I mark the only one line I changed with red color) -- routes.py --- config = ''' site1.com.vn /hhp/default site2.com.vn /welcome/default ''' def auto_in(apps): routes = [ ('/admin$anything', '/admin$anything'), ] for domain, path in [x.strip().split() for x in apps.split('\n') if x.strip() and not x.strip().startswith('#')]: if not path.startswith('/'): path = '/' + path if path.endswith('/'): path = path[:-1] app = path.split('/')[1] routes += [ ('.*:https?://(.*\.)?%s:$method /' % domain, '%s' % path), ('.*:https?://(.*\.)?%s:$method /static/$anything' % domain, '/%s/static/$anything' % app), ('.*:https?://(.*\.)?%s:$method /appadmin/$anything' % domain, '/%s/appadmin/$anything' % app), ('.*:https?://(.*\.)?%s:$method /%s/$anything' % (domain, app), '/%s/$anything' % app) ] return routes def auto_out(apps): routes = [] for domain, path in [x.strip().split() for x in apps.split('\n') if x.strip() and not x.strip().startswith('#')]: if not path.startswith('/'): path = '/' + path if path.endswith('/'): path = path[:-1] app = path.split('/')[1] routes += [ ('/%s/static/$anything' % app, '/static/$anything'), ('/%s/appadmin/$anything' % app, '/appadmin/$anything'), ('/%s/$anything' % path, '/$anything') ] return routes routes_in = auto_in(config) routes_out = auto_out(config) --- Regards, Tuan. On 3 July 2014 21:51, Massimo Di Pierro massimo@gmail.com wrote: There is nothing default specific in the script. Something else must be the problem. On Thursday, 3 July 2014 07:04:44 UTC-5, lyn2py wrote: I have a question for anyone using this… I realized that it only works for redirects to the functions within default.py. If I setup another controller, it can't route to that controller. Is this the intended behaviour? How can I include other controllers without having to add one controller for every line? Thanks :) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/ topic/web2py/8KxcHTRIBWU/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/8KxcHTRIBWU/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: tip of the day. The power of routes
Hi Massimo, Lyn2py posted above is that issue I met, I post complete script : (I mark the only one line I changed with red color) -- routes.py --- config = ''' site1.com.vn /hhp/default site2.com.vn /welcome/default ''' def auto_in(apps): routes = [ ('/admin$anything', '/admin$anything'), ] for domain, path in [x.strip().split() for x in apps.split('\n') if x.strip() and not x.strip().startswith('#')]: if not path.startswith('/'): path = '/' + path if path.endswith('/'): path = path[:-1] app = path.split('/')[1] routes += [ ('.*:https?://(.*\.)?%s:$method /' % domain, '%s' % path), ('.*:https?://(.*\.)?%s:$method /static/$anything' % domain, '/%s/static/$anything' % app), ('.*:https?://(.*\.)?%s:$method /appadmin/$anything' % domain, '/%s/appadmin/$anything' % app), ('.*:https?://(.*\.)?%s:$method /%s/$anything' % (domain, app), '/%s/$anything' % app) ] return routes def auto_out(apps): routes = [] for domain, path in [x.strip().split() for x in apps.split('\n') if x.strip() and not x.strip().startswith('#')]: if not path.startswith('/'): path = '/' + path if path.endswith('/'): path = path[:-1] app = path.split('/')[1] routes += [ ('/%s/static/$anything' % app, '/static/$anything'), ('/%s/appadmin/$anything' % app, '/appadmin/$anything'), ('/%s/$anything' % path, '/$anything') ] return routes routes_in = auto_in(config) routes_out = auto_out(config) --- Regards, Tuan. On 3 July 2014 21:51, Massimo Di Pierro massimo.dipie...@gmail.com wrote: There is nothing default specific in the script. Something else must be the problem. On Thursday, 3 July 2014 07:04:44 UTC-5, lyn2py wrote: I have a question for anyone using this… I realized that it only works for redirects to the functions within default.py. If I setup another controller, it can't route to that controller. Is this the intended behaviour? How can I include other controllers without having to add one controller for every line? Thanks :) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/8KxcHTRIBWU/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: tip of the day. The power of routes
Hi Massimo, I think there is error in your script : CURRENT line 69 : ('.*:https?://(.*\.)?%s:$method /$anything' % domain, '%s/$anything' % path) should be : ('.*:https?://(.*\.)?%s:$method /%s/$anything' % (domain, app), '/%s/$anything' % app) Regards, Tuan On Monday, October 25, 2010 11:04:57 AM UTC+7, mdipierro wrote: Aha! My mistake. $a should have been $anything everywhere in the code. I fixed is and re-posted in trunk now under scripts/autoroutes.py Massimo On Oct 24, 10:51 pm, VP vtp2...@gmail.com wrote: Update: if the function has no arguments, it works. I.e. http://domain.com/app/default/f gets mapped correctly tohttp://domain.com/f But if the function has arguments, it did not work for me. I.ehttp:// domain.com/app/default/g/a/bdoes not get mapped tohttp://domain.com/g/a/b PS: I got the script from here: http://web2py.googlecode.com/hg/scripts/autoroutes.py as far as I can tell, it's the same as the one in this this thread. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Is there an issue with my web2py install? can't pickle function objects
I am having this issue too! Server : CentOS 6.5 Apache : 2.2 Python : 2.6.6 Web2py : 2.95 So, I think this error caused by Apache config. Look into error log file, I found msg like : ...*client denied by server configuration*: /var/www/web2py/wsgihandler.py ... I've changed in httpd.conf file : Directory /var/www/web2py AllowOverride None Order Allow,Deny Deny from all Files wsgihandler.py Allow from all /Files /Directory to : Directory /var/www/web2py AllowOverride AuthConfig FileInfo Order Allow,Deny Deny from all Files wsgihandler.py Allow from all /Files /Directory ... and this error do not happen any more. I don't fully understand about Apache config, but hope this may help. Can anyone tell me there are risks if I set Apache config file like this? Regards, Tuan. On Thursday, April 3, 2014 12:14:14 AM UTC+7, Carlos Alba wrote: Is this still a issue? I am receiving this error. On Tuesday, July 16, 2013 9:44:46 PM UTC-5, Joe Magaro wrote: Hi, Lately when I'm in the admin section, when I perform an action such as installing a new app, or deleting a view I keep getting the error below. Im not sure what changed to affect this, please help! raceback (most recent call last): File /home/www-data/web2py/gluon/main.py, line 606, in wsgibase session._try_store_in_cookie_or_file(request, response) File /home/www-data/web2py/gluon/globals.py, line 757, in _try_store_in_cookie_or_file self._try_store_in_file(request, response) File /home/www-data/web2py/gluon/globals.py, line 763, in _try_store_in_file if not response.session_id or self._forget or self._unchanged(): File /home/www-data/web2py/gluon/globals.py, line 719, in _unchanged session_pickled = cPickle.dumps(dict(self)) File /usr/lib/python2.7/copy_reg.py, line 70, in _reduce_ex raise TypeError, can't pickle %s objects % base.__name__ TypeError: can't pickle function objects Error snapshot [image: help] https://www.mywebsonic.com/admin/default/ticket/admin/65.94.90.186.2013-07-17.06-41-06.14386b00-ff0d-47ad-bf32-de51a08fda61# type 'exceptions.TypeError'(can't pickle function objects) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: There were changes in MS SQLServer driver?
Thanks Derek! On 24 May 2014 00:55, Derek sp1d...@gmail.com wrote: if you read the whole thing, he changed the way it works. db = DAL('mssql://dsn=192.168.0.52;user=usr1;password=pwd1;') hint: You have to use DBAPI 2.0 connection strings. http://legacy.python.org/dev/peps/pep-0249/#footnotes On Tuesday, May 20, 2014 10:17:09 PM UTC-7, Nguyen Minh Tuan wrote: Hi Jose, I'm now have the same error with you. and cannot connect to MSSQL server, I've read your self answer but can not understand. Can you help me? db = DAL('mssql://usr1:pwd1@192.168.0.52/database_1') environment : - CentOS 6.4, Nginx, uWSGI - Python 2.7.6 - Web2py 2.9.5 Thanks, Tuan. On Saturday, October 20, 2012 3:26:03 AM UTC+7, Jose wrote: El viernes, 19 de octubre de 2012 15:48:26 UTC-3, Massimo Di Pierro escribió: So, is the issue closed? Yes. Jose -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/ISrawjvuWf0/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: There were changes in MS SQLServer driver?
Hi Jose, I'm now have the same error with you. and cannot connect to MSSQL server, I've read your self answer but can not understand. Can you help me? db = DAL('mssql://usr1:pwd1@192.168.0.52/database_1') environment : - CentOS 6.4 - Python 2.7.6 - Web2py 2.9.5 Thanks, Tuan. On Saturday, October 20, 2012 3:26:03 AM UTC+7, Jose wrote: El viernes, 19 de octubre de 2012 15:48:26 UTC-3, Massimo Di Pierro escribió: So, is the issue closed? Yes. Jose -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: new feature in trunk
I tried to use with MS SQL but this function seem error! On Thursday, October 24, 2013 3:35:38 PM UTC+7, Arnon Marcus wrote: How would this work internally? What queries would be generated? How many queries would be generated? At what points in time would queries be executed? Would that be a lazy execution? We have many such tables in our project, so this is a big interest of ours to have this work as best it can. The straight forward way of querying hierarchical queries is horribly inefficient. We already have a case that ends-up generating over 7K queries for a single view... Even with connection-pooling it takes almost 30 seconds. After moving postgres to a ramdisk, and adding a local PGBouncer server, that dropped to 14s. But obviously this is not a solution. The way we thought of solving that, is have other field(s) against which a single query could be issued, and then have the tree-structuring done in python. Is this the approach this solution is taking? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid and export; some proposals
Hi, I want to use export feature in SQLFORM.grid, but it doesn't work when query in self reference table. db.py : auth.settings.extra_fields['auth_user'] = [ Field('LineManager', 'reference auth_user'), . controller.py : lineMng = db.auth_user.with_alias('lineMng') query = ((db.auth_user.id = 1) (db.auth_user.LineManager == lineMng.id)) fields = [db.auth_user.id, db.auth_user.FullName, .. lineMng.FullName ] grid = SQLFORM.grid( query = query, field_id = db.auth_user.id, fields=fields, csv=True) In view, export part is not displayed. How can I solve this? Thanks in advance, Regards, -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: how to display the value of a reference field, instead of the id in sqlform.grid
Hi Anthony, This is seem not work in case self reference. Ex : Field('boss', 'reference auth_user') How can I solve in this situation? Thanks, On Monday, October 8, 2012 9:17:49 AM UTC+7, dave wrote: Thank you very much, I did not see this in the documentation and yes it would be nice if it is consistent with your expectation On Sunday, October 7, 2012 6:25:09 PM UTC-7, Anthony wrote: If you do: Field('test1', 'reference ranking') and then make sure the format attribute of the ranking table is set to '%(name)s', then the test1 field will automatically get the IS_IN_DB validator you have explicitly defined below, and it will automatically get a represent attribute displaying the name value from the ranking table. However, if you explicitly define your own requires attribute, then you don't get the automatic represent attribute, and you have to explicitly define that as well (I think we should probably change this, though). Anthony On Sunday, October 7, 2012 2:44:44 PM UTC-4, dave wrote: auth.settings.extra_fields['auth_user']= [ #Field('name', requires=IS_NOT_EMPTY()), . . . Field('test1', 'reference ranking', requires=IS_IN_DB(db, 'ranking.id' , '%(name)s')), . . . On Sunday, October 7, 2012 7:37:03 AM UTC-7, Anthony wrote: How is your test1 field defined? On Sunday, October 7, 2012 3:26:31 AM UTC-4, dave wrote: grid = SQLFORM.grid(query, args=[request.args(0)], fields=[db.auth_user.test0, db.auth_user.test1, db.auth_user.test2, I have defined this in my controller, the value of test1 is a reference to another table, how would I make web2py show the referenced value instead of displaying the id, something equivalent to Field('field2', 'reference employees', requires=IS_IN_DB(db, 'employees.id', '%(name)s')) when defining the table -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Custom forms controller and view separation of concerns
Hi Anthony, I try to custom view by using form.custom, But I have trouble in format control, Ex : I want to set textbox size to 10 or whatever Can I add more attributes to form.custom.widget.fieldname? Thanks, Tuan. On Sunday, October 7, 2012 9:44:57 PM UTC+7, Anthony wrote: Depending on what you want to do on the processing side and what you want to do on the display side, you probably don't have to completely repeat everything. You can use form.custom.widget.fieldname in the view if that is suitable. You can also use the server-side DOM to add classes, etc. Another option is to make the formstyle argument to SQLFORM.factory a callable, which can generate whatever form layout you want. Anthony On Saturday, October 6, 2012 7:31:12 PM UTC-4, Austin Cormier wrote: That definitely works and I've done it like that a couple times, but then I'm defining the input fields in two separate places. I'm thinking that maybe I have a custom view function that can take a vanilla form and then add my styling to it automatically. If I only had to do a few forms it wouldn't be a big deal but I want to try and keep the duplication as minimal as possible. On Saturday, October 6, 2012 6:18:49 PM UTC-4, Anthony wrote: Just use SQLFORM.factoryhttp://web2py.com/books/default/chapter/29/07#SQLFORM.factoryin the controller to define the form fields, and then build the form manually in the view (possibly using some of the form.customhttp://web2py.com/books/default/chapter/29/07#Custom-formsitems). Anthony On Saturday, October 6, 2012 2:07:49 PM UTC-4, Austin Cormier wrote: So I have the following customer form defined in my view for prototyping: form = FORM(FIELDSET(DIV(LABEL('Email Address', _class=control-label), DIV(INPUT(_class=input-large, _id=email, _name='email', requires=IS_NOT_EMPTY()), _class=controls), _class=control-group), DIV(DIV(BUTTON(Add Email, _type='submit', _class=btn), _class=controls), _class=control-group), _class=gebo), _class=form-horizontal) The issue is that I need to define the form in the controller so that I can run through the form accept (don't want to do that in the views). Even though I'm doing this in the controller, I would like the view to be responsible for styling the form. Are there any useful techniques anyone knows of so that I can do this in a reusable and maintainable way across my application? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Custom forms controller and view separation of concerns
Anthony, thanks for your help! On 9 April 2013 17:57, Anthony abasta...@gmail.com wrote: All HTML helpers act like dictionaries with respect to their attributes (and attributes beginning with _ become HTML element attributes), so for a string field: f.custom.widget.fieldname['_size']=10 will yield: input class=string id=test_fieldname name=fieldname size=10 type= text value= / Anthony On Tuesday, April 9, 2013 5:42:49 AM UTC-4, Nguyen Minh Tuan wrote: Hi Anthony, I try to custom view by using form.custom, But I have trouble in format control, Ex : I want to set textbox size to 10 or whatever Can I add more attributes to form.custom.widget.fieldname? Thanks, Tuan. On Sunday, October 7, 2012 9:44:57 PM UTC+7, Anthony wrote: Depending on what you want to do on the processing side and what you want to do on the display side, you probably don't have to completely repeat everything. You can use form.custom.widget.fieldname in the view if that is suitable. You can also use the server-side DOM to add classes, etc. Another option is to make the formstyle argument to SQLFORM.factory a callable, which can generate whatever form layout you want. Anthony On Saturday, October 6, 2012 7:31:12 PM UTC-4, Austin Cormier wrote: That definitely works and I've done it like that a couple times, but then I'm defining the input fields in two separate places. I'm thinking that maybe I have a custom view function that can take a vanilla form and then add my styling to it automatically. If I only had to do a few forms it wouldn't be a big deal but I want to try and keep the duplication as minimal as possible. On Saturday, October 6, 2012 6:18:49 PM UTC-4, Anthony wrote: Just use SQLFORM.factoryhttp://web2py.com/books/default/chapter/29/07#SQLFORM.factoryin the controller to define the form fields, and then build the form manually in the view (possibly using some of the form.customhttp://web2py.com/books/default/chapter/29/07#Custom-formsitems). Anthony On Saturday, October 6, 2012 2:07:49 PM UTC-4, Austin Cormier wrote: So I have the following customer form defined in my view for prototyping: form = FORM(FIELDSET(DIV(LABEL('Email Address', _class=control-label), DIV(INPUT(_class=input-**large, _id=email, _name='email', requires=IS_NOT_EMPTY()), _class=controls), _class=control-group), DIV(DIV(BUTTON(Add Email, _type='submit', _class=btn), _class=controls), _class=control-group), _class=gebo), _class=form-horizontal) The issue is that I need to define the form in the controller so that I can run through the form accept (don't want to do that in the views). Even though I'm doing this in the controller, I would like the view to be responsible for styling the form. Are there any useful techniques anyone knows of so that I can do this in a reusable and maintainable way across my application? -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/Ecy_tG1o-3k/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Problem with form.process().accepted ?
Thank you! That's the problem. On Monday, April 8, 2013 1:06:29 PM UTC+7, Anthony wrote: Is it possible that your browser isn't accepting cookies, or that you are somehow clearing the session? Without cookies, the session won't work, and by default, SQLFORM uses the session to store the _formkey token to protect against CSRF attacks. To see if that's the problem, you can try: if form.process(session=None).accepted: With session=None, it won't use the session (and therefore won't protect against CSRF). If it works in that case, then there's a problem with the session cookie and/or session. Anthony On Sunday, April 7, 2013 11:41:02 PM UTC-4, Nguyen Minh Tuan wrote: Thanks Anthony, When I submit with blank data, no error msg displayed. I expected error msg displayed because I set this field mandatory as below db.define_table('person', Field('personname', 'string', requires = IS_NOT_EMPTY())) I found that : if form.process().accepted: always return false, so redirect command never reached. The elseif : response.flash = input info always run, so page and flash input info are displayed again Regards, Tuan. On Friday, April 5, 2013 8:22:50 PM UTC+7, Anthony wrote: redirect('default', 'list') Should be: redirect(URL('default', 'list')) When I submit form with empty value (person name), validation does not work. What do you mean it doesn't work? Do you not see the error message on the form? What do you expect, and what happens instead? It works when I try the code? Anthony -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Problem with form.process().accepted ?
Thanks Anthony, When I submit with blank data, no error msg displayed. I expected error msg displayed because I set this field mandatory as below db.define_table('person', Field('personname', 'string', requires = IS_NOT_EMPTY())) I found that : if form.process().accepted: always return false, so redirect command never reached. The elseif : response.flash = input info always run, so page and flash input info are displayed again Regards, Tuan. On Friday, April 5, 2013 8:22:50 PM UTC+7, Anthony wrote: redirect('default', 'list') Should be: redirect(URL('default', 'list')) When I submit form with empty value (person name), validation does not work. What do you mean it doesn't work? Do you not see the error message on the form? What do you expect, and what happens instead? It works when I try the code? Anthony -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Problem with form.process().accepted ?
Hi! I'm newbie with web2py. I do tutorial in FORM chapter Model db.define_table('person', Field('personname', 'string', requires = IS_NOT_EMPTY())) Controller : def index(): form = SQLFORM(db.person) if form.process().accepted: session.flash = accepted redirect('default', 'list') else: response.flash = input info return dict(form = form) View : -- {{=form}} When I submit form with empty value (person name), validation does not work. When I submit form with value, form does not redirect to page I expected. Can anyone give me ideas? Thanks, Tuan. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] How to intervene in web2py's upload process(store/retrieve/stream...) to do something with uploaded file?
My database is RDBMS, but i want to store uploaded file in a Key/Value storage(NoSQL). How can I intervene to web2py's store/retrieve process? I want temporarily store uploaded file in memory, then call my API to put this in-memory file to my Key/Value storage. When I put this in-memory file(Value) to Key/Value storage, i will get back a auto-gen Key from it, then save this Key to RDBMS (*Field('file','upload') will store this Key instead of modified-uploaded-filename-on-disk *) When user want download this blob, i will get Key from RDBMS, then query Key/Value storage to get file(Value) and streaming back to user. Can you have me figure out the way to intervene in store/retrieve/stream/.. process? Thanks a lot!
[web2py] Urlshortening appliance ERROR!
I download newest version web2py and download this appliance from https://github.com/mdipierro/web2py-appliances/tree/master/UrlShortening But when i run, i can't shorten URL. (No input form?) And when I click Bookmark button: type 'exceptions.KeyError' '127.0.0.1:8000' Traceback (most recent call last): File /home/minhcd/My_Python/web2py/gluon/restricted.py, line 205, in restricted exec ccode in environment File /home/minhcd/My_Python/web2py/applications/UrlShortening/controllers/default.py http://127.0.0.1:8000/admin/default/edit/UrlShortening/controllers/default.py, line 32, in module File /home/minhcd/My_Python/web2py/gluon/globals.py, line 175, in lambda self._caller = lambda f: f() File /home/minhcd/My_Python/web2py/gluon/tools.py, line 2665, in f return action(*a, **b) File /home/minhcd/My_Python/web2py/applications/UrlShortening/controllers/default.py http://127.0.0.1:8000/admin/default/edit/UrlShortening/controllers/default.py, line 11, in bookmark rating = cache.ram(link.url,lambda:wotrate(link.url),3600) File /home/minhcd/My_Python/web2py/gluon/cache.py, line 194, in __call__ value = f() File /home/minhcd/My_Python/web2py/applications/UrlShortening/controllers/default.py http://127.0.0.1:8000/admin/default/edit/UrlShortening/controllers/default.py, line 11, in lambda rating = cache.ram(link.url,lambda:wotrate(link.url),3600) File /home/minhcd/My_Python/web2py/applications/UrlShortening/models/myutils.py http://127.0.0.1:8000/admin/default/edit/UrlShortening/models/myutils.py, line 13, in wotrate return loads(urlopen(wot % url).read())[url] KeyError: '127.0.0.1:8000' Can you help me pls, thanks!
[web2py] How to use SUM()
I couldn't find much documentation on sum() and I'm not sure how to use it. If I have something like define_table('some_table', Field('amount', 'integer') ... I try db(...).select(db.some_table.amount.sum()) When I print it out, I get something like: SUM(some_table.amount) 300 How do I get it to print just the number? Thanks. -- 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] Helper functions
I have functions in my controller that require no view and should be inaccessible through the browser, i.e: helper functions, callbacks, etc If the user tries to access the function through http://../app/controller/function, I'll either get an 'invalid function' or the return values. How do I prevent users from seeing this? I basically want the user to be redirected to an error page if there is no corresponding view. Thanks in advance. -- 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: Ajax query
I'm trying to implement the voting/rating example from the manual and I'm getting a similar issue with the page overlapping. On Mar 2, 2:26 pm, LB22 latn.bl...@googlemail.com wrote: Hi Thadeus, Thanks for your input. Perhaps you could provide a couple of examples, as I'm a little confused. In my example, I intended the function 'mark' to only return this: DIV(IMG(_src=URL(r=request,c='static',f='icons/ star.png'),_class='icons',_title='Remove from favourites',_alt='Remove from favourites'),_id=fav).xml() Basically a div containing an image, which I thought would be serialized as that single portion, not as an entire view, resulting in the page within page problem. Cleary still have much to learn. Could you help me out further? Thanks On Mar 2, 9:14 pm, Thadeus Burgess thade...@thadeusb.com wrote: You are returning a view that contains {{extend layout.html}} when you return the ajax, so since your returning the entire page html... you insert the page over again :) You can A) Return a view that does not extend layout B) Return a string that represents the html instead of a dict C) Call it with .json instead of .html so that your dict gets serialized into JSON and returned. -Thadeus On Tue, Mar 2, 2010 at 3:03 PM, LB22 latn.bl...@googlemail.com wrote: OK, so I tried upgrading, but still the same result I'm afraid. I figured I must be doing something wrong. Is there another method I could try to acheive the same result? Or do you know what I might be doing wrong? I'm just trying to mark something (by inserting a record into my db), and replace the existing image to reflect the current state (marked/ unmarked). Thanks On 2 Mar, 20:37, LB22 latn.bl...@googlemail.com wrote: Hmm...no I'm actually using 1.75.4. I'll try upgrading and report back what happens. On 2 Mar, 19:24, mdipierro mdipie...@cs.depaul.edu wrote: Are you using the latest web2py? On Mar 2, 11:57 am, LB22 latn.bl...@googlemail.com wrote: Hi there, I'm having a small problem and am not sure where I'm going wrong. I'm familar with javascript and have used query for some basic stuff, but this is the first time I've tried to incorporate any ajax. I have in my controller something like: def mark(): check.marker(request.args[0],request.args[1]) # decides how to update db.table return check.chooser(request.args[0],request.args[1]) # decides which icon to display and returns it In the view I have this: div id='test'{{=XML(button)}}/div span onclick=ajax('{{=URL(r=request,f='mark',args=[arg0,arg1])}}', [], 'test');ClickMe/span Instead of replacing the existing image (XML(button)) with the returned one, it inserts the entire page again overlapped on the existing page. Does anyone know where I'm going wrong? Thanks in advance for any help. LB22 -- 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: Ajax query
Should I disregard the example in the manual or is there a simple tweak I can do to get it working. The plugin you mentioned seems a little more involved... don't want to get into it if there's an easy fix for the former method. On Mar 2, 2:42 pm, mdipierro mdipie...@cs.depaul.edu wrote: The manual is old in this respect. I assume you have seen this:http://web2py.com/plugins/default/rating On Mar 2, 4:36 pm, minh mdn0...@gmail.com wrote: I'm trying to implement the voting/rating example from the manual and I'm getting a similar issue with the page overlapping. On Mar 2, 2:26 pm, LB22 latn.bl...@googlemail.com wrote: Hi Thadeus, Thanks for your input. Perhaps you could provide a couple of examples, as I'm a little confused. In my example, I intended the function 'mark' to only return this: DIV(IMG(_src=URL(r=request,c='static',f='icons/ star.png'),_class='icons',_title='Remove from favourites',_alt='Remove from favourites'),_id=fav).xml() Basically a div containing an image, which I thought would be serialized as that single portion, not as an entire view, resulting in the page within page problem. Cleary still have much to learn. Could you help me out further? Thanks On Mar 2, 9:14 pm, Thadeus Burgess thade...@thadeusb.com wrote: You are returning a view that contains {{extend layout.html}} when you return the ajax, so since your returning the entire page html... you insert the page over again :) You can A) Return a view that does not extend layout B) Return a string that represents the html instead of a dict C) Call it with .json instead of .html so that your dict gets serialized into JSON and returned. -Thadeus On Tue, Mar 2, 2010 at 3:03 PM, LB22 latn.bl...@googlemail.com wrote: OK, so I tried upgrading, but still the same result I'm afraid. I figured I must be doing something wrong. Is there another method I could try to acheive the same result? Or do you know what I might be doing wrong? I'm just trying to mark something (by inserting a record into my db), and replace the existing image to reflect the current state (marked/ unmarked). Thanks On 2 Mar, 20:37, LB22 latn.bl...@googlemail.com wrote: Hmm...no I'm actually using 1.75.4. I'll try upgrading and report back what happens. On 2 Mar, 19:24, mdipierro mdipie...@cs.depaul.edu wrote: Are you using the latest web2py? On Mar 2, 11:57 am, LB22 latn.bl...@googlemail.com wrote: Hi there, I'm having a small problem and am not sure where I'm going wrong. I'm familar with javascript and have used query for some basic stuff, but this is the first time I've tried to incorporate any ajax. I have in my controller something like: def mark(): check.marker(request.args[0],request.args[1]) # decides how to update db.table return check.chooser(request.args[0],request.args[1]) # decides which icon to display and returns it In the view I have this: div id='test'{{=XML(button)}}/div span onclick=ajax('{{=URL(r=request,f='mark',args=[arg0,arg1])}}', [], 'test');ClickMe/span Instead of replacing the existing image (XML(button)) with the returned one, it inserts the entire page again overlapped on the existing page. Does anyone know where I'm going wrong? Thanks in advance for any help. LB22 -- 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: Ajax query
I'm basically just having problems that Thadeus seemed to have described above. I'm trying to use the ajax() function but it seems like an entire page is being fed into the target rather than a string I'm returning. This is in my view, bVotes received: /bspan id=sreq{{=sreq.id}}{{=votes_received}} /spanbr/ [span onclick=ajax('vote_yay', ['sreq_id'], 'sreq{{=sreq.id}}');Vote Yay/a] The function vote_yay returns a string. However, doesn't seem like the function is being executed and an entire page is fed into the target. Is it still OK to use the ajax function? Sorry for hijacking the thread btw :/ On Mar 2, 3:25 pm, mdipierro mdipie...@cs.depaul.edu wrote: I do not even remember what is in the manual. Plugins are the future... even if they may change. On Mar 2, 5:19 pm, minh mdn0...@gmail.com wrote: Should I disregard the example in the manual or is there a simple tweak I can do to get it working. The plugin you mentioned seems a little more involved... don't want to get into it if there's an easy fix for the former method. On Mar 2, 2:42 pm, mdipierro mdipie...@cs.depaul.edu wrote: The manual is old in this respect. I assume you have seen this:http://web2py.com/plugins/default/rating On Mar 2, 4:36 pm, minh mdn0...@gmail.com wrote: I'm trying to implement the voting/rating example from the manual and I'm getting a similar issue with the page overlapping. On Mar 2, 2:26 pm, LB22 latn.bl...@googlemail.com wrote: Hi Thadeus, Thanks for your input. Perhaps you could provide a couple of examples, as I'm a little confused. In my example, I intended the function 'mark' to only return this: DIV(IMG(_src=URL(r=request,c='static',f='icons/ star.png'),_class='icons',_title='Remove from favourites',_alt='Remove from favourites'),_id=fav).xml() Basically a div containing an image, which I thought would be serialized as that single portion, not as an entire view, resulting in the page within page problem. Cleary still have much to learn. Could you help me out further? Thanks On Mar 2, 9:14 pm, Thadeus Burgess thade...@thadeusb.com wrote: You are returning a view that contains {{extend layout.html}} when you return the ajax, so since your returning the entire page html... you insert the page over again :) You can A) Return a view that does not extend layout B) Return a string that represents the html instead of a dict C) Call it with .json instead of .html so that your dict gets serialized into JSON and returned. -Thadeus On Tue, Mar 2, 2010 at 3:03 PM, LB22 latn.bl...@googlemail.com wrote: OK, so I tried upgrading, but still the same result I'm afraid. I figured I must be doing something wrong. Is there another method I could try to acheive the same result? Or do you know what I might be doing wrong? I'm just trying to mark something (by inserting a record into my db), and replace the existing image to reflect the current state (marked/ unmarked). Thanks On 2 Mar, 20:37, LB22 latn.bl...@googlemail.com wrote: Hmm...no I'm actually using 1.75.4. I'll try upgrading and report back what happens. On 2 Mar, 19:24, mdipierro mdipie...@cs.depaul.edu wrote: Are you using the latest web2py? On Mar 2, 11:57 am, LB22 latn.bl...@googlemail.com wrote: Hi there, I'm having a small problem and am not sure where I'm going wrong. I'm familar with javascript and have used query for some basic stuff, but this is the first time I've tried to incorporate any ajax. I have in my controller something like: def mark(): check.marker(request.args[0],request.args[1]) # decides how to update db.table return check.chooser(request.args[0],request.args[1]) # decides which icon to display and returns it In the view I have this: div id='test'{{=XML(button)}}/div span onclick=ajax('{{=URL(r=request,f='mark',args=[arg0,arg1])}}', [], 'test');ClickMe/span Instead of replacing the existing image (XML(button)) with the returned one, it inserts the entire page again overlapped on the existing page. Does anyone know where I'm going wrong? Thanks in advance for any help. LB22 -- 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
[web2py] Iterate through form input
Hi, I want to make a page where users can enter e-mails to send an invite. There will be an array of input boxes (1 e-mail each box) and a send button. I was wondering what the best way to generate the form dynamically was... in case the user wanted to add more e-mails. Also, is there a way to iterate through the form elements so I don't have to worry about number/name of input fields? Thanks, Minh -- 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: Iterate through form input
I forgot to mention, the form loads fine... I get the error on submit. On Feb 26, 1:58 pm, minh mdn0...@gmail.com wrote: I have something like this: form = FORM('Emails:', BR(), INPUT(_name='email', requires=IS_NULL_OR(IS_EMAIL())), BR(), INPUT(_name='email', requires=IS_NULL_OR(IS_EMAIL())), BR(), INPUT(_name='email', requires=IS_NULL_OR(IS_EMAIL())), BR(), INPUT(_name='email', requires=IS_NULL_OR(IS_EMAIL())), BR(), INPUT(_name='email', requires=IS_NULL_OR(IS_EMAIL())), BR(), 'Message:', BR(), TEXTAREA(_name='message'), BR(), INPUT(_type='submit', _value='Invite')) However, it seems to crash if I have multiple elements named 'email'. It works fine if I name them email1, email2, etc. This is the error: Error traceback Traceback (most recent call last): File C:\Documents and Settings\minh\My Documents\InvestP2P\gluon \restricted.py, line 173, in restricted exec ccode in environment File C:/Documents and Settings/minh/My Documents/InvestP2P/ applications/investp2p/controllers/loans.py, line 209, in module File C:\Documents and Settings\minh\My Documents\InvestP2P\gluon \globals.py, line 96, in lambda self._caller = lambda f: f() File C:\Documents and Settings\minh\My Documents\InvestP2P\gluon \tools.py, line 1848, in f return action(*a, **b) File C:/Documents and Settings/minh/My Documents/InvestP2P/ applications/investp2p/controllers/loans.py, line 200, in invite_lenders if form.accepts(request.vars, session): File C:\Documents and Settings\minh\My Documents\InvestP2P\gluon \html.py, line 1267, in accepts status = self._traverse(status) File C:\Documents and Settings\minh\My Documents\InvestP2P\gluon \html.py, line 449, in _traverse newstatus = c._traverse(status) and newstatus File C:\Documents and Settings\minh\My Documents\InvestP2P\gluon \html.py, line 456, in _traverse newstatus = self._validate() File C:\Documents and Settings\minh\My Documents\InvestP2P\gluon \html.py, line 1074, in _validate (value, errors) = validator(value) File C:\Documents and Settings\minh\My Documents\InvestP2P\gluon \validators.py, line 2055, in __call__ return self.other(value) File C:\Documents and Settings\minh\My Documents\InvestP2P\gluon \validators.py, line 774, in __call__ match = self.regex.match(value) TypeError: expected string or buffer On Feb 26, 1:02 pm, Thadeus Burgess thade...@thadeusb.com wrote: if they all have the same name you will receive it as a list in request.vars as the name You will need to use jQuery to dynamically add more fields. Also, you could use a textarea instead and have them press enter, and then split the string on '\n' So considering the following html input type=text name=hi id=hi1 value=hello / input type=text name=hi id=hi2 value=world / This will be serialized into www.example.com?hi=hellohi=world Which will be parsed by web2py into request.vars like so. request.vars.hi = ['hello', 'world'] -Thadeus On Fri, Feb 26, 2010 at 2:50 PM, minh mdn0...@gmail.com wrote: Hi, I want to make a page where users can enter e-mails to send an invite. There will be an array of input boxes (1 e-mail each box) and a send button. I was wondering what the best way to generate the form dynamically was... in case the user wanted to add more e-mails. Also, is there a way to iterate through the form elements so I don't have to worry about number/name of input fields? Thanks, Minh -- 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] StackExchange
Just throwing this out there... I think StackExchange.com would make a good platform for web2py help/ discussion. -- 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] Requiring arguments
Is there a way to require arguments/vars in the controller functions other than explicitly checking for them? It would be nice if we could decorate the functions similar to how the auth works, ex: @require_arg_function(minargs=2, message=Invalid arguments) def some_function(): Thanks. -- 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 site problem ?!
Not loading for me (from San Diego, CA) On Feb 11, 4:08 pm, Jonathan Lundell jlund...@pobox.com wrote: On Feb 11, 2010, at 3:45 PM, mdipierro wrote: yes that works. Any EC2 expert around here? DNS is working fine for me. You might just need to wait a bit longer. On Feb 11, 4:51 pm, Jonathan Lundell jlund...@pobox.com wrote: On Feb 11, 2010, at 2:47 PM, mdipierro wrote: Than mine is not refreshing the dns somehow Try 72.44.59.140 On Feb 11, 4:46 pm, tiago almeida tiago.b.alme...@gmail.com wrote: Yes, loaded fine just now. -- On Thu, Feb 11, 2010 at 10:43 PM, mdipierro mdipie...@cs.depaul.edu wrote: I have a possible break in. Lots of brute force ssh attacks in the last 3 days. 20 times more requests that usual. I am trying move the server to amazon. Can you reach web2py.com? 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: DB query help
Thanks for the help. How would you implement a workaround for that 2nd JOIN case to work on GAE? On Feb 9, 11:35 pm, mdipierro mdipie...@cs.depaul.edu wrote: Yes this: comments = db(db.post_comment.post_id==request.args(0)).select() for c in comments: print c.comment_by.username,c.comment works on GAE but this is not a JOIN. This a join: comments = db(db.post_comment.post_id==db.post.id)==.select() for c in comments: print c.post.content,c.post_comment.comment On Feb 9, 11:30 pm, mr.freeze nat...@freezable.com wrote: The DAL will do the join for you on a reference field. You should be able to do: comments = db(db.post_comment.post_id==request.args(0)).select() for c in comments: print c.comment_by.username,c.comment I don't think this works on GAE On Feb 9, 11:19 pm, minh mdn0...@gmail.com wrote: Hi, I have something along the lines of db.define_table('post', ...) db.define_table('post_comment', Field('post_id', db.post), Field('comment_by', db.auth_user), Field('comment', 'text') I'm trying to list the comments along with the author's name. However, I'm having problems joining the tables. How could I do this with the DAL? Thank you. -- 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: Unable to send email
Nevermind... my virus scanner was blocking SMTP access from Python -_- On Feb 9, 11:47 am, minh mdn0...@gmail.com wrote: Hi, I am having problems with the e-mail verification while running on my local dev instance. Here are my settings: mail=Mail(globals()) # mailer mail.settings.server='smtp.gmail.com:587' # your SMTP server mail.settings.sender='usern...@gmail.com' # your email mail.settings.login='usern...@gmail.com:PASSWORD' # your credentials or None auth.settings.mailer=mail # for user email verification auth.settings.registration_requires_verification = True auth.settings.registration_requires_approval = False Obviously I replace USERNAME/PASSWORD with the appropriate values. When I try to register a new user account, I get the 'Unable to send email' message. Am I missing something? Thanks, Minh -- 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] Customizing User Registration Form
Our user table has many fields, so when the Auth() form is auto- generated, there is a long form displayed on the page. I want to make it so that registration will be a 2-3 step process containing 2-3 forms. I was wondering what the best way to customize this form would be? Would it be best to just build the sub-forms in the controller? Or just pass the entire auth() form and break it up in the views. Also, what would I need to do to keep email verification/recaptcha? Thanks. -- 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] DB query help
Hi, I have something along the lines of db.define_table('post', ...) db.define_table('post_comment', Field('post_id', db.post), Field('comment_by', db.auth_user), Field('comment', 'text') I'm trying to list the comments along with the author's name. However, I'm having problems joining the tables. How could I do this with the DAL? Thank you. -- 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.