[web2py] Re: GAE: defaults on _tableobj
Thank you. I will take care of this asap. Can you submit a patch? On Friday, 3 January 2014 04:10:11 UTC-6, Quint wrote: I created an issue for this: https://code.google.com/p/web2py/issues/detail?id=1842 On Thursday, January 2, 2014 6:45:59 PM UTC+1, Quint wrote: Hello everybody, Happy New Year! I'm using GAE and sometimes a need to call some GAE datastore functions directly. (For instance when I want to supply a key_name when I put() an entity so I can have better performance to get() that entity from db. Or when I want to use put_multi()) Anyway, I can use the *_tableobj* property of the web2py table to access the GAE model class. But, this class does not have the defaults applied to it's properties while the Fields on the web2py table do. This means that when I put() my _tableobj instance (using GAE API) , the defaults are not set in the database record. At the moment a call this function in my db model after each table definition: @classmethod def set_defaults(cls, table): Takes a web2py table and sets the defaults of all Fields and sets those defaults on the associated properties of the tableobj (tableobj = the GAE model class associated with the web2py table) for propname, prop in table._tableobj._properties.iteritems(): field = getattr(table, propname, None) if None != field and isinstance(field, Field): prop._default = field.default Can this (or something like this) be integrated in the create_table() method of GoogleDatastoreAdapter() so it's done when the table gets created? Thanks, Regards Quint -- 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: IS_IN_SET in SQLFORM.dictform
This is the source for SQLFORM.dictform: def dictform(dictionary, **kwargs): fields = [] for key, value in sorted(dictionary.items()): t, requires = SQLFORM.AUTOTYPES.get(type(value), (None, None)) if t: fields.append(Field(key, t, requires=requires, default=value)) return SQLFORM.factory(*fields, **kwargs) As you can see it is just a SQLFORM.factory except that it makes a guess for field types and requires. If you want to change those defaults, than you do not need this function at all. Perhaps it can be used as an example of how to do what you need to do. On Sunday, 5 January 2014 10:48:08 UTC-6, brushek wrote: Thank You Masimo for answer, Hm... so this is huge problem for me, because I have in dict many other options (I showed only one field to show the problem). Is there any easy way to append or insert Field (with corect select option generated in the view) to the form created by SQLFORM.dictform ? Or, to change the SQLFORM.dictform to SQLFORM.factory, but factory need to take dict with (many) fields ? I was very happy to see dictform - it perfectly fit into the config setter/updater for me, last thing I needed is to make select for some of the fields :(. Regards brushek W dniu niedziela, 5 stycznia 2014 17:07:09 UTC+1 użytkownik Massimo Di Pierro napisał: Unfortunately dictform does not support this. You can do: session.config = dict(NAME = 'a') form = SQLFORM.factory(Field('NAME',default=session.config['NAME'],requires=IS_IN_SET(('a','b','c','d','e'), error_message=Choose between a and e))) if form.process().accepted: session.config['NAME'] = form.vars['NAME'] On Saturday, 4 January 2014 11:26:10 UTC-6, brushek wrote: Hello :) I have following code in controller: session.config = dict(NAME = 'a') form = SQLFORM.dictform(session.config) form.custom.widget.NAME['requires'] = IS_IN_SET(('a','b','c','d','e'), error_message=Choose between a and e) if form.process().accepted: session.config.update(form.vars) validator is working OK, but I would like to change the type of NAME field in form to select dropdown, instead simple input. How to do this ? How to change the type of field after it is created by any SQLFORM(.*) ? Regards brushek -- 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] Rows.compact and other Rows methods
I've been experimenting with the render method of the Rows class, and I am very impressed. But one drawback I found is that the Rows object must have its value set to compact=False to work properly with render(). It isn't a problem if the Rows object is used directly without any operators, but I discovered that many, if not most, Rows methods do not preserve the compact setting. For example. if you sort the Rows, it leaves compact=True. Ditto, if you use extract or find on the Rows object. The and | operators also set the compact variable to True. The upshot is that you can't use any of these operators on the Rows object and then use render on the resulting object. It is a simple change to add the preservation of the compact flag during any of these steps, but I'm unsure if this will break existing code. Other than coming up with a completely parallel set of methods, which leave compact set the way it came in, I can't think of another approach will be provably backwards-compatible. Here is an example: def __and__(self,other): if self.colnames!=other.colnames: raise Exception('Cannot incompatible Rows objects') records = self.records+other.records return Rows(self.db,records,self.colnames) Becomes: def __and__(self,other): if self.colnames!=other.colnames: raise Exception('Cannot incompatible Rows objects') records = self.records+other.records return Rows(self.db,records,self.colnames,compact=(self.compact and other.compact)) Going through the other methods we could make a Rows object preserve its compact setting while undergoing these transformations. What do you think? -- Joe B. -- 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: Getting a 'list' object has no attribute 'xml' error when exporting smartgrid data in HTML format.
I think it is fixed in trunk now. Please try it. On Tuesday, 31 December 2013 04:42:22 UTC-6, Rahul wrote: Hi All, I am getting below exception under web2py 2.8.2 when I am exporting the smartgrid in HTML format (SmartGrid attribute used csv=True) . *Steps*: Try to export a table (smartGrid) data in csv format, it works fine, later try to export it in HTML and it shows below ticket. *Browser*: Chrome, Win7 type 'exceptions.AttributeError' 'list' object has no attribute 'xml' Versionweb2py™Version 2.8.2-stable+timestamp.2013.11.28.13.54.07PythonPython 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Traceback (most recent call last): File D:\Web2py\web2py\gluon\restricted.py, line 217, in restricted exec ccode in environment File D:/Web2py/web2py/applications/BBOnline/controllers/default.py http://admin/default/edit/BBOnline/controllers/default.py, line 7994, in module File D:\Web2py\web2py\gluon\globals.py, line 372, in lambda self._caller = lambda f: f() File D:/Web2py/web2py/applications/BBOnline/controllers/default.py http://admin/default/edit/BBOnline/controllers/default.py, line 1517, in ticket_list details=False) File D:\Web2py\web2py\gluon\sqlhtml.py, line 2194, in grid raise HTTP(200, oExp.export(), **response.headers) File D:\Web2py\web2py\gluon\sqlhtml.py, line 3201, in export return 'html\nhead\nmeta http-equiv=content-type content=text/html; charset=UTF-8 /\n/head\nbody\n%s\n/body\n/html' % (self.rows.xml() or '') AttributeError: 'list' object has no attribute 'xml' Please suggest Rahul -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] styling widget divs
Is there a patch for this? I'd take it. On Monday, 6 January 2014 15:27:59 UTC-6, Richard wrote: Ok, seems like a easy one, why not just commit the change on github? :) Richard On Mon, Jan 6, 2014 at 4:22 PM, Paolo Caruccio paolo.ca...@gmail.comjavascript: wrote: That was the solution I proposed. Il giorno lunedì 6 gennaio 2014 22:10:04 UTC+1, Richard ha scritto: Could the CAT just be replaced by another DIV? Richard On Mon, Jan 6, 2014 at 3:56 PM, Paolo Caruccio paolo.ca...@gmail.comwrote: The radiowidget function returns https://github.com/ web2py/web2py/blob/master/gluon/sqlhtml.py#L384 parent(*opts, **attr) so the kargs solution of Richard works but not when style is 'divs' because the parent is 'CAT' https://github.com/ web2py/web2py/blob/master/gluon/sqlhtml.py#L364 and http s://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L366 The same happens for the checkboxeswidget. Some time ago I opened an issue on this matter ( https://code.google.com/p/web2py/issues/detail?id=1821) but only the first problem was corrected. Maybe we should open another issue ticket. What do you think? Il giorno lunedì 6 gennaio 2014 20:27:15 UTC+1, Richard ha scritto: Or you will have to create a custom widget... You can grab the radio.widget in /gluon/sqlhtml.py ans search for RadioWidget class... You can turn it into a method with the help of the book. But the kargs above should work as far as I can see look at the code of the RadioWidget... Richard On Mon, Jan 6, 2014 at 2:24 PM, Richard Vézina ml.richa...@gmail.comwrote: You can try this : **{'_class': 'radio'} As a kargs... Richard On Mon, Jan 6, 2014 at 1:53 PM, Annet anne...@googlemail.com wrote: I have the following field definition in a table: Field('title', length=8, requires=IS_IN_SET(['Mr', 'Mrs'. 'Ms']), widget=lambda k,v: SQLFORM.widgets.radio.widget(k, v, style='divs')), I would like to style the radio widget, but adding _class='radio' to the widget function does not add a class attribute to the divs. Is there a way to add this class? Kind regards. Annet -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: !! NEW ADMIN !!
Really nice. I will try it asap. How can I help distributing this? On Monday, 6 January 2014 15:19:54 UTC-6, samuel bonill wrote: https://lh6.googleusercontent.com/m1SF59SEqKdRRSBdoT-_LLsbS0hFlfsO_orZ-fU5KKs=w800-h450Admin Plus(A-Plus) is a web2py plugin that provides an easy-to-use interface for managing your data link: https://github.com/pyner/admin_plus install 1. Download and install the plugin 2. go to 127.0.0.1:8000/app/plugin_admin_plus/install 3. Get the permissions plugin_admin_plus_superuser in 127.0.0.1:8000/app/appadmin/insert/db/auth_membership 4. !! ready! Now you can log in... 127.0.0.1:8000/ app/plugin_admin_plus/index NOTE: app is replaced by the name of your application -- 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: Possibly a problem with CAS redirection in v2.8.2
Thanks Tim. Your patch is in trunk. On Tuesday, 7 January 2014 01:50:49 UTC-6, Tim Richardson wrote: this time it was throwing a ticket due to an undefined variable. -- 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] Redirecting From Register Function
I have two different register forms in my application. One is pretty basic and I control where it redirects to using: auth.settings.register_next = URL('default', 'home') In my other register function I want to redirect it to a completely different place, and I want to send some vars over to the different place. It looks like the following (simplified): def register_invite(): form = auth.register() a = 10 b = 11 return dict(form=form) So to sum up my question again: How can I redirect this function along with the variables a and b, to say a middle function named middle, after successful processing and after if being accepted? -- 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] Web2py Integration with Sentry
Has anyone ever integrated web2py an Sentry (https://github.com/getsentry/sentry)? I would like it if all web2py generated exceptions generate a ticket like usual, but also generates an event to a sentry server. Has anyone ever done this? If not, could anyone point to where I would need to patch web2py or how best this integration would work? Thanks for any help! -- 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: Important New Year News: Edison Award
Wow. How cool would THAT be?? I'm hoping and pulling for you Massimo! Nobody deserves the award more than US! (Yes, we're all planning to bask in your reflected glory!) -- Joe B. On Friday, January 3, 2014 8:08:38 PM UTC-8, Massimo Di Pierro wrote: Web2py/me have been nominated for the Edison Award. Please wish web2py (and me) good luck. :-) -- 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: outer join? i guess
ah, nice. didn't know that. now i read it in the manual, and the db._lastsql makes it even a bit easier after the statement has run to compare to the output also. sweet. thanx for the tip. learned a new little thing. and after seeing the SQLs for all the different wanderings i did, things are much clearer now. thanx again. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: !! NEW ADMIN !!
Good job, administrative inteface is very important, but more importantly would create an engine of reports that web2py does not. Let's think about this. Ovidio Marinho Falcao Neto ITJP.NET.BR ovidio...@gmail.com Brasil 2014/1/7 Massimo Di Pierro massimo.dipie...@gmail.com Really nice. I will try it asap. How can I help distributing this? On Monday, 6 January 2014 15:19:54 UTC-6, samuel bonill wrote: https://lh6.googleusercontent.com/m1SF59SEqKdRRSBdoT-_LLsbS0hFlfsO_orZ-fU5KKs=w800-h450Admin Plus(A-Plus) is a web2py plugin that provides an easy-to-use interface for managing your data link: https://github.com/pyner/admin_plus install 1. Download and install the plugin 2. go to 127.0.0.1:8000/app/plugin_admin_plus/install 3. Get the permissions plugin_admin_plus_superuser in 127.0.0.1:8000/app/appadmin/insert/db/auth_membership 4. !! ready! Now you can log in... 127.0.0.1:8000/app/plugin_ admin_plus/index NOTE: app is replaced by the name of your application -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Getting a 'list' object has no attribute 'xml' error when exporting smartgrid data in HTML format.
trunk means the current state of the repository. the zip downloads are behind. gi to github.com and learn how to clone the repository. there is some discussion of this in the book under the chapter 'helping web2py', you need the pre-6th edition version of the book. or skip the book and learn from github. It's really easy. -- 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] Different applications usiong same set of tables
I have an application app1. I want to create another application - app2 which will use the same set of tables as used by app1. For this, what I have to do is create a tables.py under app2/models and mention migrate=False for the common tables. Is that right? Do I have to set fake_migrate=True and ensure the table files are created under databases folder in app2? My simple tests tell me it is not necessary. Just for confirmation. -- 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: Getting a 'list' object has no attribute 'xml' error when exporting smartgrid data in HTML format.
Here is the link to the book section where the git repository is discussed: http://web2py.com/books/default/chapter/29/15/helping-web2py On Tuesday, 7 January 2014 22:35:28 UTC+11, Tim Richardson wrote: trunk means the current state of the repository. the zip downloads are behind. gi to github.com and learn how to clone the repository. there is some discussion of this in the book under the chapter 'helping web2py', you need the pre-6th edition version of the book. or skip the book and learn from github. It's really easy. -- 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: Important New Year News: Edison Award
Massimo, is there a link to the nomination? Good twitter food. On Saturday, 4 January 2014 15:08:38 UTC+11, Massimo Di Pierro wrote: Web2py/me have been nominated for the Edison Award. Please wish web2py (and me) good luck. :-) -- 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] Is login dependent on web2py.js?
I'm using web2py with jQuery Mobile and I noticed that the login breaks if I omit web2py.js. I end up at an empty page with no fetched body content. Is it supposed to be so? I'm not sure I want to use web2py.js. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: !! NEW ADMIN !!
thanks all. massimo, can help with a posting on reddit, hacker news etc ... 2014/1/7 Ovidio Marinho ovidio...@gmail.com Good job, administrative inteface is very important, but more importantly would create an engine of reports that web2py does not. Let's think about this. Ovidio Marinho Falcao Neto ITJP.NET.BR ovidio...@gmail.com Brasil 2014/1/7 Massimo Di Pierro massimo.dipie...@gmail.com Really nice. I will try it asap. How can I help distributing this? On Monday, 6 January 2014 15:19:54 UTC-6, samuel bonill wrote: https://lh6.googleusercontent.com/m1SF59SEqKdRRSBdoT-_LLsbS0hFlfsO_orZ-fU5KKs=w800-h450Admin Plus(A-Plus) is a web2py plugin that provides an easy-to-use interface for managing your data link: https://github.com/pyner/admin_plus install 1. Download and install the plugin 2. go to 127.0.0.1:8000/app/plugin_admin_plus/install 3. Get the permissions plugin_admin_plus_superuser in 127.0.0.1:8000/app/appadmin/insert/db/auth_membership 4. !! ready! Now you can log in... 127.0.0.1:8000/app/plugin_ admin_plus/index NOTE: app is replaced by the name of your application -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/irlm_8dGSnQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] ckeditor in appadmin
hi guys, is there any way to implement the ckeditor in the appadmin page when adding or editing records? Thanks -- *This e-mail is confidential and may also be privileged. If you are not the intended **recipient, please notify the sender immediately, delete it from your system and do **not copy, disseminate, distribute or disclose any information contained therein.* -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: !! NEW ADMIN !!
You can Contribute in many ways: 1. reporting errors 2. writing code 3. contributing with Ideas 4. Also You can support with Bitcoin the next version will feature: 1. website for A-Plus 2. settings 3. ckeditor 4.3, (with with limitations in GAE) 4. create and customize permissions 2014/1/7 samuel bonill pythonn...@gmail.com thanks all. massimo, can help with a posting on reddit, hacker news etc ... 2014/1/7 Ovidio Marinho ovidio...@gmail.com Good job, administrative inteface is very important, but more importantly would create an engine of reports that web2py does not. Let's think about this. Ovidio Marinho Falcao Neto ITJP.NET.BR ovidio...@gmail.com Brasil 2014/1/7 Massimo Di Pierro massimo.dipie...@gmail.com Really nice. I will try it asap. How can I help distributing this? On Monday, 6 January 2014 15:19:54 UTC-6, samuel bonill wrote: https://lh6.googleusercontent.com/m1SF59SEqKdRRSBdoT-_LLsbS0hFlfsO_orZ-fU5KKs=w800-h450Admin Plus(A-Plus) is a web2py plugin that provides an easy-to-use interface for managing your data link: https://github.com/pyner/admin_plus install 1. Download and install the plugin 2. go to 127.0.0.1:8000/app/plugin_admin_plus/install 3. Get the permissions plugin_admin_plus_superuser in 127.0.0.1:8000/app/appadmin/insert/db/auth_membership 4. !! ready! Now you can log in... 127.0.0.1:8000/app/plugin_ admin_plus/index NOTE: app is replaced by the name of your application -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/irlm_8dGSnQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: IS_IN_SET in SQLFORM.dictform
Thank You Massimo, it's enaugh for me - indeed, the code is rather simple. Regards and good luck :) brushek W dniu wtorek, 7 stycznia 2014 09:09:04 UTC+1 użytkownik Massimo Di Pierro napisał: This is the source for SQLFORM.dictform: def dictform(dictionary, **kwargs): fields = [] for key, value in sorted(dictionary.items()): t, requires = SQLFORM.AUTOTYPES.get(type(value), (None, None)) if t: fields.append(Field(key, t, requires=requires, default=value)) return SQLFORM.factory(*fields, **kwargs) As you can see it is just a SQLFORM.factory except that it makes a guess for field types and requires. If you want to change those defaults, than you do not need this function at all. Perhaps it can be used as an example of how to do what you need to do. On Sunday, 5 January 2014 10:48:08 UTC-6, brushek wrote: Thank You Masimo for answer, Hm... so this is huge problem for me, because I have in dict many other options (I showed only one field to show the problem). Is there any easy way to append or insert Field (with corect select option generated in the view) to the form created by SQLFORM.dictform ? Or, to change the SQLFORM.dictform to SQLFORM.factory, but factory need to take dict with (many) fields ? I was very happy to see dictform - it perfectly fit into the config setter/updater for me, last thing I needed is to make select for some of the fields :(. Regards brushek W dniu niedziela, 5 stycznia 2014 17:07:09 UTC+1 użytkownik Massimo Di Pierro napisał: Unfortunately dictform does not support this. You can do: session.config = dict(NAME = 'a') form = SQLFORM.factory(Field('NAME',default=session.config['NAME'],requires=IS_IN_SET(('a','b','c','d','e'), error_message=Choose between a and e))) if form.process().accepted: session.config['NAME'] = form.vars['NAME'] On Saturday, 4 January 2014 11:26:10 UTC-6, brushek wrote: Hello :) I have following code in controller: session.config = dict(NAME = 'a') form = SQLFORM.dictform(session.config) form.custom.widget.NAME['requires'] = IS_IN_SET(('a','b','c','d','e'), error_message=Choose between a and e) if form.process().accepted: session.config.update(form.vars) validator is working OK, but I would like to change the type of NAME field in form to select dropdown, instead simple input. How to do this ? How to change the type of field after it is created by any SQLFORM(.*) ? Regards brushek -- 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: Temporarily Poll View
Answered in https://groups.google.com/forum/#!msg/web2py/4G8TBqqy33c/QqMMS31DSFMJ On Thursday, January 2, 2014 11:49:14 AM UTC-8, EW wrote: Thanks, but I don't understand..how would I know when the insert (scheduler task) has completed? On Thursday, January 2, 2014 11:14:00 AM UTC-8, Anthony wrote: You can set a component to reload indefinitely and then stop the reloading by doing: jQuery('#mydiv').addClass('w2p_component_stop'); However, in this case, rather than continually reloading the entire grid while waiting for the database insert, it might be better to simply poll the server every x seconds, and only when the insert has finally occurred, then do a single reload of the grid. Anthony On Friday, December 20, 2013 1:24:00 PM UTC-5, EW wrote: I have a load component with a grid in it and a user-triggered action that could insert/update the database table that my grid's based on. Depending on many factors, the database insert could take a long time, say 45s+. I would like to update the view to show the updating grid while the inserts are going on rather than having a stagnant page that looks like it's not doing anything for 45s+. So I created a scheduler and am doing the db inserts in a scheduler task. But I'm not sure what the best way is to update the view. I know that I could use the 'times' and 'timeout' parameters in the LOAD. Or I could poll in javascript using setInterval to call web2py_component. But is it burdensome to always have my page updating this, say every second? The scheduler task for my db inserts only happen when the user clicks something; at all other times it is unnecessary to reload the grid. Is there a way to make the view constantly update on the user's click but once the scheduler task has completed (i.e. finished inserting into the database) to stop the view from updating? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] styling widget divs
Patch: https://code.google.com/p/web2py/issues/detail?id=1845 Il giorno martedì 7 gennaio 2014 09:15:50 UTC+1, Massimo Di Pierro ha scritto: Is there a patch for this? I'd take it. On Monday, 6 January 2014 15:27:59 UTC-6, Richard wrote: Ok, seems like a easy one, why not just commit the change on github? :) Richard On Mon, Jan 6, 2014 at 4:22 PM, Paolo Caruccio paolo.ca...@gmail.comwrote: That was the solution I proposed. Il giorno lunedì 6 gennaio 2014 22:10:04 UTC+1, Richard ha scritto: Could the CAT just be replaced by another DIV? Richard On Mon, Jan 6, 2014 at 3:56 PM, Paolo Caruccio paolo.ca...@gmail.comwrote: The radiowidget function returns https://github.com/ web2py/web2py/blob/master/gluon/sqlhtml.py#L384 parent(*opts, **attr) so the kargs solution of Richard works but not when style is 'divs' because the parent is 'CAT' https://github.com/ web2py/web2py/blob/master/gluon/sqlhtml.py#L364 and http s://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L366 The same happens for the checkboxeswidget. Some time ago I opened an issue on this matter ( https://code.google.com/p/web2py/issues/detail?id=1821) but only the first problem was corrected. Maybe we should open another issue ticket. What do you think? Il giorno lunedì 6 gennaio 2014 20:27:15 UTC+1, Richard ha scritto: Or you will have to create a custom widget... You can grab the radio.widget in /gluon/sqlhtml.py ans search for RadioWidget class... You can turn it into a method with the help of the book. But the kargs above should work as far as I can see look at the code of the RadioWidget... Richard On Mon, Jan 6, 2014 at 2:24 PM, Richard Vézina ml.richa...@gmail.com wrote: You can try this : **{'_class': 'radio'} As a kargs... Richard On Mon, Jan 6, 2014 at 1:53 PM, Annet anne...@googlemail.comwrote: I have the following field definition in a table: Field('title', length=8, requires=IS_IN_SET(['Mr', 'Mrs'. 'Ms']), widget=lambda k,v: SQLFORM.widgets.radio.widget(k, v, style='divs')), I would like to style the radio widget, but adding _class='radio' to the widget function does not add a class attribute to the divs. Is there a way to add this class? Kind regards. Annet -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Rows.compact and other Rows methods
.render() works fine on Rows objects with compact=True, and it also works fine on the results of .sort(), .exclude(), , and | operations. The only problem is with the results of .find() operations when the original Rows object has compact=True. The problem is that the .find() method modifies the Row objects in self.records when compact=True, which it probably should not due. Aside from this issue, perhaps the various Rows methods should preserve the compact attribute -- not sure why they don't. Forwarding to the developers list for discussion. Anthony On Tuesday, January 7, 2014 3:10:00 AM UTC-5, Joe Barnhart wrote: I've been experimenting with the render method of the Rows class, and I am very impressed. But one drawback I found is that the Rows object must have its value set to compact=False to work properly with render(). It isn't a problem if the Rows object is used directly without any operators, but I discovered that many, if not most, Rows methods do not preserve the compact setting. For example. if you sort the Rows, it leaves compact=True. Ditto, if you use extract or find on the Rows object. The and | operators also set the compact variable to True. The upshot is that you can't use any of these operators on the Rows object and then use render on the resulting object. It is a simple change to add the preservation of the compact flag during any of these steps, but I'm unsure if this will break existing code. Other than coming up with a completely parallel set of methods, which leave compact set the way it came in, I can't think of another approach will be provably backwards-compatible. Here is an example: def __and__(self,other): if self.colnames!=other.colnames: raise Exception('Cannot incompatible Rows objects') records = self.records+other.records return Rows(self.db,records,self.colnames) Becomes: def __and__(self,other): if self.colnames!=other.colnames: raise Exception('Cannot incompatible Rows objects') records = self.records+other.records return Rows(self.db,records,self.colnames,compact=(self.compact or other.compact)) In the case above, the flag compact will be set True if either of the participating Rows object is also compact. My logic is, if you've lost the table values on either Rows object, you may as well lose them on the combined set. What do you think? -- Joe B. -- 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] Matplotlib webagg in web2py
Hi, I want to do data analysis in pandas and show results via web2py to managers. Is it possible to use the new webagg from matplot lib in web2py ? http://matplotlib.org/users/whats_new.html?highlight=webagg#backends If the answer is yes can you show an example ? Thanks very much Art -- 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: Rows.compact and other Rows methods
The Rows.find() method does the following: for row in self: if f(row): if a=k: records.append(row) k += 1 if k==b: break In a Rows object, there is self.records, which is a list of Row objects. Each Row object has at least one top-level key with the table name, and the record is stored in the value associated with that key: Row {'person': {'first_name': 'Bob', 'last_name': 'Smith'}} When .find() is called on a Rows object with compact=True, the __iter__ method (called by the for row in self loop) returns a transformed version of each Row object, removing the top-level table key: Row {'first_name': 'Bob', 'last_name': 'Smith'} I believe this is an unnecessary transformation, and it is what is subsequently causing the .render() method to fail (the .render() method expects the top-level table key to be there, whether or not compact=True). I propose the following change to .find(): for i, row in enumerate(self): if f(row): if a=k: records.append(self.records[i]) k += 1 if k==b: break The above code appends self.records[i] instead of row, which preserves the original Row objects instead of including transformed objects. Anyone see any problems with that change? Also, is there any reason all of the Rows methods (i.e., find, exclude, __and__, __or__) should not be preserving the compact attribute of the original Rows object? Perhaps we should change them all to do so. (Note, this is a separate issue unrelated to the above problem with .find() and .render().) Anthony On Tuesday, January 7, 2014 10:47:28 AM UTC-5, Anthony wrote: .render() works fine on Rows objects with compact=True, and it also works fine on the results of .sort(), .exclude(), , and | operations. The only problem is with the results of .find() operations when the original Rows object has compact=True. The problem is that the .find() method modifies the Row objects in self.records when compact=True, which it probably should not due. Aside from this issue, perhaps the various Rows methods should preserve the compact attribute -- not sure why they don't. Forwarding to the developers list for discussion. Anthony On Tuesday, January 7, 2014 3:10:00 AM UTC-5, Joe Barnhart wrote: I've been experimenting with the render method of the Rows class, and I am very impressed. But one drawback I found is that the Rows object must have its value set to compact=False to work properly with render(). It isn't a problem if the Rows object is used directly without any operators, but I discovered that many, if not most, Rows methods do not preserve the compact setting. For example. if you sort the Rows, it leaves compact=True. Ditto, if you use extract or find on the Rows object. The and | operators also set the compact variable to True. The upshot is that you can't use any of these operators on the Rows object and then use render on the resulting object. It is a simple change to add the preservation of the compact flag during any of these steps, but I'm unsure if this will break existing code. Other than coming up with a completely parallel set of methods, which leave compact set the way it came in, I can't think of another approach will be provably backwards-compatible. Here is an example: def __and__(self,other): if self.colnames!=other.colnames: raise Exception('Cannot incompatible Rows objects') records = self.records+other.records return Rows(self.db,records,self.colnames) Becomes: def __and__(self,other): if self.colnames!=other.colnames: raise Exception('Cannot incompatible Rows objects') records = self.records+other.records return Rows(self.db,records,self.colnames,compact=(self.compact or other.compact)) In the case above, the flag compact will be set True if either of the participating Rows object is also compact. My logic is, if you've lost the table values on either Rows object, you may as well lose them on the combined set. What do you think? -- Joe B. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Matplotlib webagg in web2py
Look more like a interactive Ipython and built-in webserver then something that could be integrated with web2py, but there is few detail about how it works so can say for sure... Richard On Tue, Jan 7, 2014 at 10:51 AM, ArtDijk artd...@gmail.com wrote: Hi, I want to do data analysis in pandas and show results via web2py to managers. Is it possible to use the new webagg from matplot lib in web2py ? http://matplotlib.org/users/whats_new.html?highlight=webagg#backends If the answer is yes can you show an example ? Thanks very much Art -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: !! NEW ADMIN !!
You can Contribute in many ways: Consider posting this to the plugins list in web2pyslices, adding a link to the installer (.w2p file) so it can be installed directly from admin. -- 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] intercept closing session
Hi, I am new with web2py, is there a way to intercept the closing of a session? -- 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: intercept closing session
El martes, 7 de enero de 2014 14:40:38 UTC-3, Giuseppe D'Amico escribió: Hi, I am new with web2py, is there a way to intercept the closing of a session? You mean you want to catch a user logout from the scaffolding app? You could modify the user action at controllers.py so it checks wether the logout action was asked: def user(): if request.args[0] == logout: do something There's also the auth.settings.logout_onlogout which can be a function that receives auth.user as argument (undocumented) and auth.settings.logout_next (a URL for redirection after logout). -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] intercept closing session
tornado and websocket_messaging.py in contrib Richard On Tue, Jan 7, 2014 at 12:40 PM, Giuseppe D'Amico damicogiusepp...@gmail.com wrote: Hi, I am new with web2py, is there a way to intercept the closing of a session? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] intercept closing session
You need websocket_messaging.py if you want to know who is actually connected... Alan solution may works if you only want to catch logout event, but you don't have logout event in case user closer the browser... Richard On Tue, Jan 7, 2014 at 1:03 PM, Richard Vézina ml.richard.vez...@gmail.comwrote: You may found more info with comet_messaging.py since it have been rename to websocket_messaging,py recently Richard On Tue, Jan 7, 2014 at 12:59 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: tornado and websocket_messaging.py in contrib Richard On Tue, Jan 7, 2014 at 12:40 PM, Giuseppe D'Amico damicogiusepp...@gmail.com wrote: Hi, I am new with web2py, is there a way to intercept the closing of a session? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] intercept closing session
You may found more info with comet_messaging.py since it have been rename to websocket_messaging,py recently Richard On Tue, Jan 7, 2014 at 12:59 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: tornado and websocket_messaging.py in contrib Richard On Tue, Jan 7, 2014 at 12:40 PM, Giuseppe D'Amico damicogiusepp...@gmail.com wrote: Hi, I am new with web2py, is there a way to intercept the closing of a session? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Need more than one value to unpack
Traceback (most recent call last): File /home/hornet632/webapps/joyofreading/web2py/applications/AK_M14/controllers/appadmin.py, line 243, in select limitby=(start, stop)) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 10335, in select return adapter.select(self.query,fields,attributes) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 2388, in select return super(SQLiteAdapter, self).select(query, fields, attributes) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1831, in select return self._select_aux(sql,fields,attributes) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1796, in _select_aux self.execute(sql) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1916, in execute return self.log_execute(*a, **b) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1910, in log_execute ret = self.cursor.execute(command, *a[1:], **b) File /usr/local/lib/python2.7/sqlite3/dbapi2.py, line 66, in convert_timestamp datepart, timepart = val.split( ) ValueError: need more than 1 value to unpack On Tuesday, January 7, 2014 2:11:35 AM UTC+5:30, Dave S wrote: On Monday, January 6, 2014 12:32:01 PM UTC-8, Akash Agrawall wrote: I am getting this error: Need more than one value to unpack Can you tell us which line the error message is referencing? Is there a traceback in the ticket? /dps *db.py:* class IS_CATEGORYIT(object): def __init__(self, error_message=Zip code not allowed): self.error_message = error def __call__(self, value): error = None print len(value) if len(value)==0: error = self.error_message return (value, error) db.define_table('book', db.Field('Name','string'), db.Field('Category','string',requires=IS_CATEGORYIT), db.Field('Quantity','integer'), db.Field('ISBN','string',unique=True), db.Field('Age_group','list:string', requires=IS_IN_SET(['1-4','5-8','9-12','13-17'])), db.Field('entry_date','date',default=datetime.date.today(),requires=IS_DATE(format=('%d-%m-%Y'))), db.Field('Description','text'), db.Field('Image','upload',uploadfield='picture_file'), db.Field('picture_file','blob'), db.Field('Available','integer'), db.Field('Author','string'), db.Field('Link','string',requires=IS_EMPTY_OR(IS_URL( db.book.Description.widget= lambda field,value: SQLFORM.widgets.text.widget(field,value,_style='width:400px',_rows=5) db.book.Category.requires=IS_IN_SET(['ficton','non-fiction','action and adventure','travel','biography','story'],multiple=True,zero=None),IS_NOT_EMPTY(error_message=cannot be empty) db.book.Category.widget= lambda field,value: SQLFORM.widgets.checkboxes.widget(field,value) *controller: default.py* def add_book(): form1=SQLFORM(db.book) form1.add_button('Cancel', URL('add_book')) if form1.accepts(request.vars,session): response.flash=Book Inserted elif form1.errors: response.flash=Errors in form return dict(form1=form1) *view:add_book.html* {{=form1.custom.begin}} table trtd style=width:51%Namenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Name }}/td/tr trtd Quantitynbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Quantity}}/td/tr trtd style=width:51%Availablenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Available}}/td/tr trtd style=width:51%ISBNnbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.ISBN}}/td/tr trtd style=width:51%Entry Datenbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.entry_date}}/td/tr /table nbsp; span style=color:#66; Category/spanspan style=color:red;*/span: nbsp;nbsp; br/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[0]}}/label/span span style=position:relative;left:50%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[1]}}/label/spanbr/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[3]}}/label/span span style=position:relative;left:50.5%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[4]}}/label/spanbr/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[5]}}/label/span span style=position:relative;left:51%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[2]}}/label/span /tr /tr table trtd style=width:45%Age Groupnbsp;span style=color:red;*/span:/td
[web2py] Re: Need more than one value to unpack
On Tuesday, January 7, 2014 2:11:35 AM UTC+5:30, Dave S wrote: On Monday, January 6, 2014 12:32:01 PM UTC-8, Akash Agrawall wrote: I am getting this error: Need more than one value to unpack Can you tell us which line the error message is referencing? Is there a traceback in the ticket? /dps Traceback (most recent call last): File /home/hornet632/webapps/joyofreading/web2py/applications/AK_M14/controllers/appadmin.py, line 243, in select limitby=(start, stop)) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 10335, in select return adapter.select(self.query,fields,attributes) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 2388, in select return super(SQLiteAdapter, self).select(query, fields, attributes) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1831, in select return self._select_aux(sql,fields,attributes) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1796, in _select_aux self.execute(sql) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1916, in execute return self.log_execute(*a, **b) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1910, in log_execute ret = self.cursor.execute(command, *a[1:], **b) File /usr/local/lib/python2.7/sqlite3/dbapi2.py, line 66, in convert_timestamp datepart, timepart = val.split( ) ValueError: need more than 1 value to unpack *db.py:* class IS_CATEGORYIT(object): def __init__(self, error_message=Zip code not allowed): self.error_message = error def __call__(self, value): error = None print len(value) if len(value)==0: error = self.error_message return (value, error) db.define_table('book', db.Field('Name','string'), db.Field('Category','string',requires=IS_CATEGORYIT), db.Field('Quantity','integer'), db.Field('ISBN','string',unique=True), db.Field('Age_group','list:string', requires=IS_IN_SET(['1-4','5-8','9-12','13-17'])), db.Field('entry_date','date',default=datetime.date.today(),requires=IS_DATE(format=('%d-%m-%Y'))), db.Field('Description','text'), db.Field('Image','upload',uploadfield='picture_file'), db.Field('picture_file','blob'), db.Field('Available','integer'), db.Field('Author','string'), db.Field('Link','string',requires=IS_EMPTY_OR(IS_URL( db.book.Description.widget= lambda field,value: SQLFORM.widgets.text.widget(field,value,_style='width:400px',_rows=5) db.book.Category.requires=IS_IN_SET(['ficton','non-fiction','action and adventure','travel','biography','story'],multiple=True,zero=None),IS_NOT_EMPTY(error_message=cannot be empty) db.book.Category.widget= lambda field,value: SQLFORM.widgets.checkboxes.widget(field,value) *controller: default.py* def add_book(): form1=SQLFORM(db.book) form1.add_button('Cancel', URL('add_book')) if form1.accepts(request.vars,session): response.flash=Book Inserted elif form1.errors: response.flash=Errors in form return dict(form1=form1) *view:add_book.html* {{=form1.custom.begin}} table trtd style=width:51%Namenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Name }}/td/tr trtd Quantitynbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Quantity}}/td/tr trtd style=width:51%Availablenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Available}}/td/tr trtd style=width:51%ISBNnbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.ISBN}}/td/tr trtd style=width:51%Entry Datenbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.entry_date}}/td/tr /table nbsp; span style=color:#66; Category/spanspan style=color:red;*/span: nbsp;nbsp; br/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[0]}}/label/span span style=position:relative;left:50%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[1]}}/label/spanbr/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[3]}}/label/span span style=position:relative;left:50.5%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[4]}}/label/spanbr/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[5]}}/label/span span style=position:relative;left:51%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[2]}}/label/span /tr /tr table trtd style=width:45%Age Groupnbsp;span style=color:red;*/span:/td
[web2py] Re: Need more than one value to unpack
Traceback (most recent call last): File /home/hornet632/webapps/joyofreading/web2py/applications/AK_M14/controllers/appadmin.py, line 243, in select limitby=(start, stop)) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 10335, in select return adapter.select(self.query,fields,attributes) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 2388, in select return super(SQLiteAdapter, self).select(query, fields, attributes) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1831, in select return self._select_aux(sql,fields,attributes) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1796, in _select_aux self.execute(sql) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1916, in execute return self.log_execute(*a, **b) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1910, in log_execute ret = self.cursor.execute(command, *a[1:], **b) File /usr/local/lib/python2.7/sqlite3/dbapi2.py, line 66, in convert_timestamp datepart, timepart = val.split( ) ValueError: need more than 1 value to unpack On Tuesday, January 7, 2014 3:21:09 AM UTC+5:30, Anthony wrote: Yes, please provide more detail. Also, requires=IS_CATEGORYIT should be requires=IS_CATEGORYIT(). Anthony On Monday, January 6, 2014 3:41:35 PM UTC-5, Dave S wrote: On Monday, January 6, 2014 12:32:01 PM UTC-8, Akash Agrawall wrote: I am getting this error: Need more than one value to unpack Can you tell us which line the error message is referencing? Is there a traceback in the ticket? /dps *db.py:* class IS_CATEGORYIT(object): def __init__(self, error_message=Zip code not allowed): self.error_message = error def __call__(self, value): error = None print len(value) if len(value)==0: error = self.error_message return (value, error) db.define_table('book', db.Field('Name','string'), db.Field('Category','string',requires=IS_CATEGORYIT), db.Field('Quantity','integer'), db.Field('ISBN','string',unique=True), db.Field('Age_group','list:string', requires=IS_IN_SET(['1-4','5-8','9-12','13-17'])), db.Field('entry_date','date',default=datetime.date.today(),requires=IS_DATE(format=('%d-%m-%Y'))), db.Field('Description','text'), db.Field('Image','upload',uploadfield='picture_file'), db.Field('picture_file','blob'), db.Field('Available','integer'), db.Field('Author','string'), db.Field('Link','string',requires=IS_EMPTY_OR(IS_URL( db.book.Description.widget= lambda field,value: SQLFORM.widgets.text.widget(field,value,_style='width:400px',_rows=5) db.book.Category.requires=IS_IN_SET(['ficton','non-fiction','action and adventure','travel','biography','story'],multiple=True,zero=None),IS_NOT_EMPTY(error_message=cannot be empty) db.book.Category.widget= lambda field,value: SQLFORM.widgets.checkboxes.widget(field,value) *controller: default.py* def add_book(): form1=SQLFORM(db.book) form1.add_button('Cancel', URL('add_book')) if form1.accepts(request.vars,session): response.flash=Book Inserted elif form1.errors: response.flash=Errors in form return dict(form1=form1) *view:add_book.html* {{=form1.custom.begin}} table trtd style=width:51%Namenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Name }}/td/tr trtd Quantitynbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Quantity}}/td/tr trtd style=width:51%Availablenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Available}}/td/tr trtd style=width:51%ISBNnbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.ISBN}}/td/tr trtd style=width:51%Entry Datenbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.entry_date}}/td/tr /table nbsp; span style=color:#66; Category/spanspan style=color:red;*/span: nbsp;nbsp; br/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[0]}}/label/span span style=position:relative;left:50%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[1]}}/label/spanbr/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[3]}}/label/span span style=position:relative;left:50.5%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[4]}}/label/spanbr/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[5]}}/label/span span style=position:relative;left:51%;color:rgb(102, 102,
[web2py] Re: Need more than one value to unpack
on doing the change you mentioned a ticket comes up. Traceback (most recent call last): File /home/hornet632/webapps/joyofreading/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /home/hornet632/webapps/joyofreading/web2py/applications/AK_M14/models/db.py https://joyofreading.org/admin/default/edit/AK_M14/models/db.py, line 125, in module db.Field('Category','string',requires=IS_CATEGORYIT()), File /home/hornet632/webapps/joyofreading/web2py/applications/AK_M14/models/db.py https://joyofreading.org/admin/default/edit/AK_M14/models/db.py, line 105, in __init__ self.error_message = error NameError: global name 'error' is not defined On Tuesday, January 7, 2014 3:21:09 AM UTC+5:30, Anthony wrote: Yes, please provide more detail. Also, requires=IS_CATEGORYIT should be requires=IS_CATEGORYIT(). Anthony On Monday, January 6, 2014 3:41:35 PM UTC-5, Dave S wrote: On Monday, January 6, 2014 12:32:01 PM UTC-8, Akash Agrawall wrote: I am getting this error: Need more than one value to unpack Can you tell us which line the error message is referencing? Is there a traceback in the ticket? /dps *db.py:* class IS_CATEGORYIT(object): def __init__(self, error_message=Zip code not allowed): self.error_message = error def __call__(self, value): error = None print len(value) if len(value)==0: error = self.error_message return (value, error) db.define_table('book', db.Field('Name','string'), db.Field('Category','string',requires=IS_CATEGORYIT), db.Field('Quantity','integer'), db.Field('ISBN','string',unique=True), db.Field('Age_group','list:string', requires=IS_IN_SET(['1-4','5-8','9-12','13-17'])), db.Field('entry_date','date',default=datetime.date.today(),requires=IS_DATE(format=('%d-%m-%Y'))), db.Field('Description','text'), db.Field('Image','upload',uploadfield='picture_file'), db.Field('picture_file','blob'), db.Field('Available','integer'), db.Field('Author','string'), db.Field('Link','string',requires=IS_EMPTY_OR(IS_URL( db.book.Description.widget= lambda field,value: SQLFORM.widgets.text.widget(field,value,_style='width:400px',_rows=5) db.book.Category.requires=IS_IN_SET(['ficton','non-fiction','action and adventure','travel','biography','story'],multiple=True,zero=None),IS_NOT_EMPTY(error_message=cannot be empty) db.book.Category.widget= lambda field,value: SQLFORM.widgets.checkboxes.widget(field,value) *controller: default.py* def add_book(): form1=SQLFORM(db.book) form1.add_button('Cancel', URL('add_book')) if form1.accepts(request.vars,session): response.flash=Book Inserted elif form1.errors: response.flash=Errors in form return dict(form1=form1) *view:add_book.html* {{=form1.custom.begin}} table trtd style=width:51%Namenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Name }}/td/tr trtd Quantitynbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Quantity}}/td/tr trtd style=width:51%Availablenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Available}}/td/tr trtd style=width:51%ISBNnbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.ISBN}}/td/tr trtd style=width:51%Entry Datenbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.entry_date}}/td/tr /table nbsp; span style=color:#66; Category/spanspan style=color:red;*/span: nbsp;nbsp; br/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[0]}}/label/span span style=position:relative;left:50%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[1]}}/label/spanbr/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[3]}}/label/span span style=position:relative;left:50.5%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[4]}}/label/spanbr/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[5]}}/label/span span style=position:relative;left:51%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[2]}}/label/span /tr /tr table trtd style=width:45%Age Groupnbsp;span style=color:red;*/span:/td td{{=form1.custom.widget.Age_group}}/td/tr trtd style=width:45%Author:/tdtd {{=form1.custom.widget.Author}}/td/tr trtd style=width:45%Amazon Link:/td td{{=form1.custom.widget.Link}}/td/tr trtd style=width:45%Description:/tdtd {{=form1.custom.widget.Description}}/td/tr trtd
Re: [web2py] Re: intercept closing session
thanks I will do like you say 2014/1/7 Alan Etkin spame...@gmail.com El martes, 7 de enero de 2014 14:40:38 UTC-3, Giuseppe D'Amico escribió: Hi, I am new with web2py, is there a way to intercept the closing of a session? You mean you want to catch a user logout from the scaffolding app? You could modify the user action at controllers.py so it checks wether the logout action was asked: def user(): if request.args[0] == logout: do something There's also the auth.settings.logout_onlogout which can be a function that receives auth.user as argument (undocumented) and auth.settings.logout_next (a URL for redirection after logout). -- 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/rzS37obsTI4/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: intercept closing session
what if someone does not do the logout, but for some reason the session end? 2014/1/7 Giuseppe D'Amico damicogiusepp...@gmail.com thanks I will do like you say 2014/1/7 Alan Etkin spame...@gmail.com El martes, 7 de enero de 2014 14:40:38 UTC-3, Giuseppe D'Amico escribió: Hi, I am new with web2py, is there a way to intercept the closing of a session? You mean you want to catch a user logout from the scaffolding app? You could modify the user action at controllers.py so it checks wether the logout action was asked: def user(): if request.args[0] == logout: do something There's also the auth.settings.logout_onlogout which can be a function that receives auth.user as argument (undocumented) and auth.settings.logout_next (a URL for redirection after logout). -- 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/rzS37obsTI4/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Need more than one value to unpack
On Tuesday, January 7, 2014 10:11:27 AM UTC-8, Akash Agrawall wrote: On Tuesday, January 7, 2014 2:11:35 AM UTC+5:30, Dave S wrote: On Monday, January 6, 2014 12:32:01 PM UTC-8, Akash Agrawall wrote: I am getting this error: Need more than one value to unpack Can you tell us which line the error message is referencing? Is there a traceback in the ticket? [...] File /usr/local/lib/python2.7/sqlite3/dbapi2.py, line 66, in convert_timestamp datepart, timepart = val.split( ) ValueError: need more than 1 value to unpack The following seem to be the two places where you are dealing with dates, and this is the sort of message that the Python date parser gives when your date string being parsed doesn't match the pattern it is parsing to. *db.py:* db.define_table('book', db.Field('Name','string'), db.Field('Category','string',requires=IS_CATEGORYIT), db.Field('Quantity','integer'), db.Field('ISBN','string',unique=True), db.Field('Age_group','list:string', requires=IS_IN_SET(['1-4','5-8','9-12','13-17'])), db.Field('entry_date','date',default=datetime.date.today(),requires=IS_DATE(format=('%d-%m-%Y'))), *view:add_book.html* {{=form1.custom.begin}} table trtd style=width:51%Namenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Name }}/td/tr trtd Quantitynbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Quantity}}/td/tr trtd style=width:51%Availablenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Available}}/td/tr trtd style=width:51%ISBNnbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.ISBN}}/td/tr trtd style=width:51%Entry Datenbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.entry_date}}/td/tr Good luck! /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Need more than one value to unpack
There's a bug in your custom validator code -- should be: self.error_message = error_message On Tuesday, January 7, 2014 1:12:51 PM UTC-5, Akash Agrawall wrote: on doing the change you mentioned a ticket comes up. Traceback (most recent call last): File /home/hornet632/webapps/joyofreading/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /home/hornet632/webapps/joyofreading/web2py/applications/AK_M14/models/db.py https://joyofreading.org/admin/default/edit/AK_M14/models/db.py, line 125, in module db.Field('Category','string',requires=IS_CATEGORYIT()), File /home/hornet632/webapps/joyofreading/web2py/applications/AK_M14/models/db.py https://joyofreading.org/admin/default/edit/AK_M14/models/db.py, line 105, in __init__ self.error_message = error NameError: global name 'error' is not defined On Tuesday, January 7, 2014 3:21:09 AM UTC+5:30, Anthony wrote: Yes, please provide more detail. Also, requires=IS_CATEGORYIT should be requires=IS_CATEGORYIT(). Anthony On Monday, January 6, 2014 3:41:35 PM UTC-5, Dave S wrote: On Monday, January 6, 2014 12:32:01 PM UTC-8, Akash Agrawall wrote: I am getting this error: Need more than one value to unpack Can you tell us which line the error message is referencing? Is there a traceback in the ticket? /dps *db.py:* class IS_CATEGORYIT(object): def __init__(self, error_message=Zip code not allowed): self.error_message = error def __call__(self, value): error = None print len(value) if len(value)==0: error = self.error_message return (value, error) db.define_table('book', db.Field('Name','string'), db.Field('Category','string',requires=IS_CATEGORYIT), db.Field('Quantity','integer'), db.Field('ISBN','string',unique=True), db.Field('Age_group','list:string', requires=IS_IN_SET(['1-4','5-8','9-12','13-17'])), db.Field('entry_date','date',default=datetime.date.today(),requires=IS_DATE(format=('%d-%m-%Y'))), db.Field('Description','text'), db.Field('Image','upload',uploadfield='picture_file'), db.Field('picture_file','blob'), db.Field('Available','integer'), db.Field('Author','string'), db.Field('Link','string',requires=IS_EMPTY_OR(IS_URL( db.book.Description.widget= lambda field,value: SQLFORM.widgets.text.widget(field,value,_style='width:400px',_rows=5) db.book.Category.requires=IS_IN_SET(['ficton','non-fiction','action and adventure','travel','biography','story'],multiple=True,zero=None),IS_NOT_EMPTY(error_message=cannot be empty) db.book.Category.widget= lambda field,value: SQLFORM.widgets.checkboxes.widget(field,value) *controller: default.py* def add_book(): form1=SQLFORM(db.book) form1.add_button('Cancel', URL('add_book')) if form1.accepts(request.vars,session): response.flash=Book Inserted elif form1.errors: response.flash=Errors in form return dict(form1=form1) *view:add_book.html* {{=form1.custom.begin}} table trtd style=width:51%Namenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Name }}/td/tr trtd Quantitynbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Quantity}}/td/tr trtd style=width:51%Availablenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Available}}/td/tr trtd style=width:51%ISBNnbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.ISBN}}/td/tr trtd style=width:51%Entry Datenbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.entry_date}}/td/tr /table nbsp; span style=color:#66; Category/spanspan style=color:red;*/span: nbsp;nbsp; br/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[0]}}/label/span span style=position:relative;left:50%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[1]}}/label/spanbr/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[3]}}/label/span span style=position:relative;left:50.5%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[4]}}/label/spanbr/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[5]}}/label/span span style=position:relative;left:51%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[2]}}/label/span /tr /tr table trtd style=width:45%Age Groupnbsp;span style=color:red;*/span:/td td{{=form1.custom.widget.Age_group}}/td/tr trtd style=width:45%Author:/tdtd
[web2py] Re: Need more than one value to unpack
This error comes from appadmin. Exactly what were you doing in appadmin to generate this error (what URL was requested)? Anthony On Tuesday, January 7, 2014 1:10:45 PM UTC-5, Akash Agrawall wrote: Traceback (most recent call last): File /home/hornet632/webapps/joyofreading/web2py/applications/AK_M14/controllers/appadmin.py, line 243, in select limitby=(start, stop)) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 10335, in select return adapter.select(self.query,fields,attributes) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 2388, in select return super(SQLiteAdapter, self).select(query, fields, attributes) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1831, in select return self._select_aux(sql,fields,attributes) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1796, in _select_aux self.execute(sql) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1916, in execute return self.log_execute(*a, **b) File /home/hornet632/webapps/joyofreading/web2py/gluon/dal.py, line 1910, in log_execute ret = self.cursor.execute(command, *a[1:], **b) File /usr/local/lib/python2.7/sqlite3/dbapi2.py, line 66, in convert_timestamp datepart, timepart = val.split( ) ValueError: need more than 1 value to unpack On Tuesday, January 7, 2014 2:11:35 AM UTC+5:30, Dave S wrote: On Monday, January 6, 2014 12:32:01 PM UTC-8, Akash Agrawall wrote: I am getting this error: Need more than one value to unpack Can you tell us which line the error message is referencing? Is there a traceback in the ticket? /dps *db.py:* class IS_CATEGORYIT(object): def __init__(self, error_message=Zip code not allowed): self.error_message = error def __call__(self, value): error = None print len(value) if len(value)==0: error = self.error_message return (value, error) db.define_table('book', db.Field('Name','string'), db.Field('Category','string',requires=IS_CATEGORYIT), db.Field('Quantity','integer'), db.Field('ISBN','string',unique=True), db.Field('Age_group','list:string', requires=IS_IN_SET(['1-4','5-8','9-12','13-17'])), db.Field('entry_date','date',default=datetime.date.today(),requires=IS_DATE(format=('%d-%m-%Y'))), db.Field('Description','text'), db.Field('Image','upload',uploadfield='picture_file'), db.Field('picture_file','blob'), db.Field('Available','integer'), db.Field('Author','string'), db.Field('Link','string',requires=IS_EMPTY_OR(IS_URL( db.book.Description.widget= lambda field,value: SQLFORM.widgets.text.widget(field,value,_style='width:400px',_rows=5) db.book.Category.requires=IS_IN_SET(['ficton','non-fiction','action and adventure','travel','biography','story'],multiple=True,zero=None),IS_NOT_EMPTY(error_message=cannot be empty) db.book.Category.widget= lambda field,value: SQLFORM.widgets.checkboxes.widget(field,value) *controller: default.py* def add_book(): form1=SQLFORM(db.book) form1.add_button('Cancel', URL('add_book')) if form1.accepts(request.vars,session): response.flash=Book Inserted elif form1.errors: response.flash=Errors in form return dict(form1=form1) *view:add_book.html* {{=form1.custom.begin}} table trtd style=width:51%Namenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Name }}/td/tr trtd Quantitynbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Quantity}}/td/tr trtd style=width:51%Availablenbsp;span style=color:red;*/span:/tdtd {{=form1.custom.widget.Available}}/td/tr trtd style=width:51%ISBNnbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.ISBN}}/td/tr trtd style=width:51%Entry Datenbsp;span style=color:red;*/span: /tdtd{{=form1.custom.widget.entry_date}}/td/tr /table nbsp; span style=color:#66; Category/spanspan style=color:red;*/span: nbsp;nbsp; br/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[0]}}/label/span span style=position:relative;left:50%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[1]}}/label/spanbr/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[3]}}/label/span span style=position:relative;left:50.5%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[4]}}/label/spanbr/ span style=position:relative;left:43%;color:rgb(102, 102, 102);label class=checkbox inline{{=form1.custom.widget.Category[5]}}/label/span
Re: [web2py] Re: Possibly a problem with CAS redirection in v2.8.2
Congrats. :-) On Tue, Jan 7, 2014 at 6:19 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Thanks Tim. Your patch is in trunk. On Tuesday, 7 January 2014 01:50:49 UTC-6, Tim Richardson wrote: this time it was throwing a ticket due to an undefined variable. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: intercept closing session
The same I guess, you will need websocket_messaging.py and tornado server... This video is great even if in portuguese : http://vimeo.com/38972256 Richard On Tue, Jan 7, 2014 at 1:39 PM, Giuseppe D'Amico damicogiusepp...@gmail.com wrote: what if someone does not do the logout, but for some reason the session end? 2014/1/7 Giuseppe D'Amico damicogiusepp...@gmail.com thanks I will do like you say 2014/1/7 Alan Etkin spame...@gmail.com El martes, 7 de enero de 2014 14:40:38 UTC-3, Giuseppe D'Amico escribió: Hi, I am new with web2py, is there a way to intercept the closing of a session? You mean you want to catch a user logout from the scaffolding app? You could modify the user action at controllers.py so it checks wether the logout action was asked: def user(): if request.args[0] == logout: do something There's also the auth.settings.logout_onlogout which can be a function that receives auth.user as argument (undocumented) and auth.settings.logout_next (a URL for redirection after logout). -- 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/rzS37obsTI4/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: intercept closing session
There is also this vid : http://vimeo.com/18399381 Richard On Tue, Jan 7, 2014 at 2:14 PM, Richard Vézina ml.richard.vez...@gmail.comwrote: The same I guess, you will need websocket_messaging.py and tornado server... This video is great even if in portuguese : http://vimeo.com/38972256 Richard On Tue, Jan 7, 2014 at 1:39 PM, Giuseppe D'Amico damicogiusepp...@gmail.com wrote: what if someone does not do the logout, but for some reason the session end? 2014/1/7 Giuseppe D'Amico damicogiusepp...@gmail.com thanks I will do like you say 2014/1/7 Alan Etkin spame...@gmail.com El martes, 7 de enero de 2014 14:40:38 UTC-3, Giuseppe D'Amico escribió: Hi, I am new with web2py, is there a way to intercept the closing of a session? You mean you want to catch a user logout from the scaffolding app? You could modify the user action at controllers.py so it checks wether the logout action was asked: def user(): if request.args[0] == logout: do something There's also the auth.settings.logout_onlogout which can be a function that receives auth.user as argument (undocumented) and auth.settings.logout_next (a URL for redirection after logout). -- 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/rzS37obsTI4/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Important New Year News: Edison Award
Congrats! :) Richartd On Tue, Jan 7, 2014 at 6:51 AM, Tim Richardson t...@growthpath.com.auwrote: Massimo, is there a link to the nomination? Good twitter food. On Saturday, 4 January 2014 15:08:38 UTC+11, Massimo Di Pierro wrote: Web2py/me have been nominated for the Edison Award. Please wish web2py (and me) good luck. :-) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py][share] gluttony for graph python project dependencies
Hello, I was looking to find a way to compile the dependencies of my project and I falled on this : https://bitbucket.org/victorlin/gluttony It might be an interesting addon to web2py? Richard -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py][share] gluttony for graph python project dependencies
Ho! Forget about that, there is no web2py pip package and gluttony required a pip package to work... So, not possible to make it works for app I guess. Richard On Tue, Jan 7, 2014 at 2:31 PM, Richard ml.richard.vez...@gmail.com wrote: Hello, I was looking to find a way to compile the dependencies of my project and I falled on this : https://bitbucket.org/victorlin/gluttony It might be an interesting addon to web2py? Richard -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: intercept closing session
What exactly do you need to do? On Tuesday, January 7, 2014 1:39:04 PM UTC-5, Giuseppe D'Amico wrote: what if someone does not do the logout, but for some reason the session end? 2014/1/7 Giuseppe D'Amico damicogi...@gmail.com javascript: thanks I will do like you say 2014/1/7 Alan Etkin spam...@gmail.com javascript: El martes, 7 de enero de 2014 14:40:38 UTC-3, Giuseppe D'Amico escribió: Hi, I am new with web2py, is there a way to intercept the closing of a session? You mean you want to catch a user logout from the scaffolding app? You could modify the user action at controllers.py so it checks wether the logout action was asked: def user(): if request.args[0] == logout: do something There's also the auth.settings.logout_onlogout which can be a function that receives auth.user as argument (undocumented) and auth.settings.logout_next (a URL for redirection after logout). -- 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/rzS37obsTI4/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Ajax
Have you found a solution for this yet? I'm struggling with this as well.. On Thursday, September 10, 2009 5:21:11 AM UTC+2, eddwinston wrote: Hi, I am trying to make an ajax login, I am currently sending request to this url: [app]/default/user/login. But it has been fruitless. I just get a full page html markup and the user will not be logged in. Is there a way I can do it? Regards, Winston -- 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: custom widgets
1. Where should I put my custom widget logic? Right now i have it grossely stored in my db.py You can always put it in a module file and import it. 2. Can i pass more information to my widget other than field, value from my db.table.colum.widget = mywidgetfunc If you have: def mywidget(field, value, arg1, arg2): you can do: db.table.column.widget = lambda f, v: mywidget(f, v, value1, value2) or: import functools db.table.column.widget = functools.partial(mywidget, arg1=value1, arg2= value2) Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: custom widgets
great thanks! On 7 January 2014 15:18, Anthony abasta...@gmail.com wrote: 1. Where should I put my custom widget logic? Right now i have it grossely stored in my db.py You can always put it in a module file and import it. 2. Can i pass more information to my widget other than field, value from my db.table.colum.widget = mywidgetfunc If you have: def mywidget(field, value, arg1, arg2): you can do: db.table.column.widget = lambda f, v: mywidget(f, v, value1, value2) or: import functools db.table.column.widget = functools.partial(mywidget, arg1=value1, arg2=value2) Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py][share] gluttony for graph python project dependencies
El Tue, 7 Jan 2014 14:55:17 -0500 Richard Vézina ml.richard.vez...@gmail.com escribió: Ho! Forget about that, there is no web2py pip package and gluttony required a pip package to work... So, not possible to make it works for app I guess. Richard On Tue, Jan 7, 2014 at 2:31 PM, Richard ml.richard.vez...@gmail.com wrote: Hello, I was looking to find a way to compile the dependencies of my project and I falled on this : https://bitbucket.org/victorlin/gluttony It might be an interesting addon to web2py? Richard -- 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. There **IS**: $pip install web2py Downloading/unpacking web2py-2.1.1.tar.gz but maybe pypi version should be updated... Downloading web2py-2.1.1.tar.gz -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py][share] gluttony for graph python project dependencies
except that web2py depends on nothing by default, and in fact you can run it on the standard python library with no additions. That project just parses the various setup.py in packages to find dependencies that are explicitely written into setup.py, it doesn't inspect your code to see what libraries are imported. On Tuesday, January 7, 2014 9:27:40 PM UTC+1, marco mansilla wrote: El Tue, 7 Jan 2014 14:55:17 -0500 Richard Vézina ml.richa...@gmail.com javascript: escribió: Ho! Forget about that, there is no web2py pip package and gluttony required a pip package to work... So, not possible to make it works for app I guess. Richard On Tue, Jan 7, 2014 at 2:31 PM, Richard ml.richa...@gmail.comjavascript: wrote: Hello, I was looking to find a way to compile the dependencies of my project and I falled on this : https://bitbucket.org/victorlin/gluttony It might be an interesting addon to web2py? Richard -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. There **IS**: $pip install web2py Downloading/unpacking web2py-2.1.1.tar.gz but maybe pypi version should be updated... Downloading web2py-2.1.1.tar.gz -- 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: Different applications usiong same set of tables
migrate=False prevents web2py to check if the underlying tables are in sync with your model. you don't need to run fake_migrate=True if you're not planning on altering tables on app2. fake_migrate=True just generates .table files according to your model, so you'll get (assuming the connection string is identical) exactly the same files that you can find under app1/databases/ On Tuesday, January 7, 2014 12:44:10 PM UTC+1, Jayadevan M wrote: I have an application app1. I want to create another application - app2 which will use the same set of tables as used by app1. For this, what I have to do is create a tables.py under app2/models and mention migrate=False for the common tables. Is that right? Do I have to set fake_migrate=True and ensure the table files are created under databases folder in app2? My simple tests tell me it is not necessary. Just for confirmation. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: !! NEW ADMIN !!
before spreading the work, you could rename all spanish comments and variables in english. At least in my POV (Italian, knows english, tries to auto-translate spanish but doesn't know a single word of it) its the first step towards getting more developers contributing. On Tuesday, January 7, 2014 6:10:27 PM UTC+1, Alan Etkin wrote: You can Contribute in many ways: Consider posting this to the plugins list in web2pyslices, adding a link to the installer (.w2p file) so it can be installed directly from admin. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py][share] gluttony for graph python project dependencies
I didn't try before post :( I should have... I know web2py is self containing, but I may have import other python package from my app... Do you have a cue about a prog or a python script that could ramp my source and list my dependencies? Thanks Richard On Tue, Jan 7, 2014 at 3:46 PM, Niphlod niph...@gmail.com wrote: except that web2py depends on nothing by default, and in fact you can run it on the standard python library with no additions. That project just parses the various setup.py in packages to find dependencies that are explicitely written into setup.py, it doesn't inspect your code to see what libraries are imported. On Tuesday, January 7, 2014 9:27:40 PM UTC+1, marco mansilla wrote: El Tue, 7 Jan 2014 14:55:17 -0500 Richard Vézina ml.richa...@gmail.com escribió: Ho! Forget about that, there is no web2py pip package and gluttony required a pip package to work... So, not possible to make it works for app I guess. Richard On Tue, Jan 7, 2014 at 2:31 PM, Richard ml.richa...@gmail.com wrote: Hello, I was looking to find a way to compile the dependencies of my project and I falled on this : https://bitbucket.org/victorlin/gluttony It might be an interesting addon to web2py? Richard -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. There **IS**: $pip install web2py Downloading/unpacking web2py-2.1.1.tar.gz but maybe pypi version should be updated... Downloading web2py-2.1.1.tar.gz -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py][share] gluttony for graph python project dependencies
This may seems what I am searching for : http://furius.ca/snakefood/ Richard On Tue, Jan 7, 2014 at 3:54 PM, Richard Vézina ml.richard.vez...@gmail.comwrote: I didn't try before post :( I should have... I know web2py is self containing, but I may have import other python package from my app... Do you have a cue about a prog or a python script that could ramp my source and list my dependencies? Thanks Richard On Tue, Jan 7, 2014 at 3:46 PM, Niphlod niph...@gmail.com wrote: except that web2py depends on nothing by default, and in fact you can run it on the standard python library with no additions. That project just parses the various setup.py in packages to find dependencies that are explicitely written into setup.py, it doesn't inspect your code to see what libraries are imported. On Tuesday, January 7, 2014 9:27:40 PM UTC+1, marco mansilla wrote: El Tue, 7 Jan 2014 14:55:17 -0500 Richard Vézina ml.richa...@gmail.com escribió: Ho! Forget about that, there is no web2py pip package and gluttony required a pip package to work... So, not possible to make it works for app I guess. Richard On Tue, Jan 7, 2014 at 2:31 PM, Richard ml.richa...@gmail.com wrote: Hello, I was looking to find a way to compile the dependencies of my project and I falled on this : https://bitbucket.org/victorlin/gluttony It might be an interesting addon to web2py? Richard -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. There **IS**: $pip install web2py Downloading/unpacking web2py-2.1.1.tar.gz but maybe pypi version should be updated... Downloading web2py-2.1.1.tar.gz -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Important New Year News: Edison Award
Congratulations and good luck! Routing for you! On Friday, January 3, 2014 10:08:38 PM UTC-6, Massimo Di Pierro wrote: Web2py/me have been nominated for the Edison Award. Please wish web2py (and me) good luck. :-) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py][share] gluttony for graph python project dependencies
never tried. I'd go for http://pythonhosted.org/modulegraph/index.html. BTW: why don't you just initialize an empty venv, run your test suite and add modules as they are found missing ? Given the nature of web2py applications you'll have hard times to figure out dependencies without running every model and every controller through a dependency parser. On Tuesday, January 7, 2014 9:57:40 PM UTC+1, Richard wrote: This may seems what I am searching for : http://furius.ca/snakefood/ Richard On Tue, Jan 7, 2014 at 3:54 PM, Richard Vézina ml.richa...@gmail.comjavascript: wrote: I didn't try before post :( I should have... I know web2py is self containing, but I may have import other python package from my app... Do you have a cue about a prog or a python script that could ramp my source and list my dependencies? Thanks Richard On Tue, Jan 7, 2014 at 3:46 PM, Niphlod nip...@gmail.com javascript:wrote: except that web2py depends on nothing by default, and in fact you can run it on the standard python library with no additions. That project just parses the various setup.py in packages to find dependencies that are explicitely written into setup.py, it doesn't inspect your code to see what libraries are imported. On Tuesday, January 7, 2014 9:27:40 PM UTC+1, marco mansilla wrote: El Tue, 7 Jan 2014 14:55:17 -0500 Richard Vézina ml.richa...@gmail.com escribió: Ho! Forget about that, there is no web2py pip package and gluttony required a pip package to work... So, not possible to make it works for app I guess. Richard On Tue, Jan 7, 2014 at 2:31 PM, Richard ml.richa...@gmail.com wrote: Hello, I was looking to find a way to compile the dependencies of my project and I falled on this : https://bitbucket.org/victorlin/gluttony It might be an interesting addon to web2py? Richard -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. There **IS**: $pip install web2py Downloading/unpacking web2py-2.1.1.tar.gz but maybe pypi version should be updated... Downloading web2py-2.1.1.tar.gz -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Different applications usiong same set of tables
You can also define models in a module function or class and import into both apps (e.g., the way Auth works). There is also http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Using-DAL-without-define-tables, though you don't get the web2py specific attributes, such as validators, widgets, etc. Anthony On Tuesday, January 7, 2014 6:44:10 AM UTC-5, Jayadevan M wrote: I have an application app1. I want to create another application - app2 which will use the same set of tables as used by app1. For this, what I have to do is create a tables.py under app2/models and mention migrate=False for the common tables. Is that right? Do I have to set fake_migrate=True and ensure the table files are created under databases folder in app2? My simple tests tell me it is not necessary. Just for confirmation. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py][share] gluttony for graph python project dependencies
That's a idea... You are right snakefood can't import web2py modules... Thanks Richard On Tue, Jan 7, 2014 at 4:31 PM, Niphlod niph...@gmail.com wrote: never tried. I'd go for http://pythonhosted.org/modulegraph/index.html. BTW: why don't you just initialize an empty venv, run your test suite and add modules as they are found missing ? Given the nature of web2py applications you'll have hard times to figure out dependencies without running every model and every controller through a dependency parser. On Tuesday, January 7, 2014 9:57:40 PM UTC+1, Richard wrote: This may seems what I am searching for : http://furius.ca/snakefood/ Richard On Tue, Jan 7, 2014 at 3:54 PM, Richard Vézina ml.richa...@gmail.comwrote: I didn't try before post :( I should have... I know web2py is self containing, but I may have import other python package from my app... Do you have a cue about a prog or a python script that could ramp my source and list my dependencies? Thanks Richard On Tue, Jan 7, 2014 at 3:46 PM, Niphlod nip...@gmail.com wrote: except that web2py depends on nothing by default, and in fact you can run it on the standard python library with no additions. That project just parses the various setup.py in packages to find dependencies that are explicitely written into setup.py, it doesn't inspect your code to see what libraries are imported. On Tuesday, January 7, 2014 9:27:40 PM UTC+1, marco mansilla wrote: El Tue, 7 Jan 2014 14:55:17 -0500 Richard Vézina ml.richa...@gmail.com escribió: Ho! Forget about that, there is no web2py pip package and gluttony required a pip package to work... So, not possible to make it works for app I guess. Richard On Tue, Jan 7, 2014 at 2:31 PM, Richard ml.richa...@gmail.com wrote: Hello, I was looking to find a way to compile the dependencies of my project and I falled on this : https://bitbucket.org/victorlin/gluttony It might be an interesting addon to web2py? Richard -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. There **IS**: $pip install web2py Downloading/unpacking web2py-2.1.1.tar.gz but maybe pypi version should be updated... Downloading web2py-2.1.1.tar.gz -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: !! NEW ADMIN !!
before spreading the work, you could rename all spanish comments and variables in english. At least in my POV (Italian, knows english, tries to auto-translate spanish but doesn't know a single word of it) its the first step towards getting more developers contributing. thanks Niphlod, comments in english now are available https://github.com/pyner/admin_plus/blob/master/models/plugin_admin_plus.py I need help with the documentation in inglish -- 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: Rows.compact and other Rows methods
It's actually a little deeper problem. I see that Rows.sort() has the effect of stripping the table key from the resulting Row objects. If I try the obvious fix, to use the built-in sorted on self.records instead of self, then the next problem surfaces -- the supplied sort key must include the table and the field key, and they must both be supplied to the sort. Which would break all manner of existing programs. I love the concept of compact vs non-compact, but the implementation of stripping the table keys from the Row objects has left quite a mess! -- Joe On Tuesday, January 7, 2014 8:03:56 AM UTC-8, Anthony wrote: The Rows.find() method does the following: for row in self: if f(row): if a=k: records.append(row) k += 1 if k==b: break In a Rows object, there is self.records, which is a list of Row objects. Each Row object has at least one top-level key with the table name, and the record is stored in the value associated with that key: Row {'person': {'first_name': 'Bob', 'last_name': 'Smith'}} When .find() is called on a Rows object with compact=True, the __iter__ method (called by the for row in self loop) returns a transformed version of each Row object, removing the top-level table key: Row {'first_name': 'Bob', 'last_name': 'Smith'} I believe this is an unnecessary transformation, and it is what is subsequently causing the .render() method to fail (the .render() method expects the top-level table key to be there, whether or not compact=True). I propose the following change to .find(): for i, row in enumerate(self): if f(row): if a=k: records.append(self.records[i]) k += 1 if k==b: break The above code appends self.records[i] instead of row, which preserves the original Row objects instead of including transformed objects. Anyone see any problems with that change? Also, is there any reason all of the Rows methods (i.e., find, exclude, __and__, __or__) should not be preserving the compact attribute of the original Rows object? Perhaps we should change them all to do so. (Note, this is a separate issue unrelated to the above problem with .find() and .render().) Anthony On Tuesday, January 7, 2014 10:47:28 AM UTC-5, Anthony wrote: .render() works fine on Rows objects with compact=True, and it also works fine on the results of .sort(), .exclude(), , and | operations. The only problem is with the results of .find() operations when the original Rows object has compact=True. The problem is that the .find() method modifies the Row objects in self.records when compact=True, which it probably should not due. Aside from this issue, perhaps the various Rows methods should preserve the compact attribute -- not sure why they don't. Forwarding to the developers list for discussion. Anthony On Tuesday, January 7, 2014 3:10:00 AM UTC-5, Joe Barnhart wrote: I've been experimenting with the render method of the Rows class, and I am very impressed. But one drawback I found is that the Rows object must have its value set to compact=False to work properly with render(). It isn't a problem if the Rows object is used directly without any operators, but I discovered that many, if not most, Rows methods do not preserve the compact setting. For example. if you sort the Rows, it leaves compact=True. Ditto, if you use extract or find on the Rows object. The and | operators also set the compact variable to True. The upshot is that you can't use any of these operators on the Rows object and then use render on the resulting object. It is a simple change to add the preservation of the compact flag during any of these steps, but I'm unsure if this will break existing code. Other than coming up with a completely parallel set of methods, which leave compact set the way it came in, I can't think of another approach will be provably backwards-compatible. Here is an example: def __and__(self,other): if self.colnames!=other.colnames: raise Exception('Cannot incompatible Rows objects') records = self.records+other.records return Rows(self.db,records,self.colnames) Becomes: def __and__(self,other): if self.colnames!=other.colnames: raise Exception('Cannot incompatible Rows objects') records = self.records+other.records return Rows(self.db,records,self.colnames,compact=(self.compact or other.compact)) In the case above, the flag compact will be set True if either of the participating Rows object is also compact. My logic is, if you've lost the table values on either Rows object, you may as well lose them on the combined set. What do you think? -- Joe B. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py
[web2py] Re: Rows.compact and other Rows methods
Ah, I see, .sort has the same problem as .find. I think we should just try to fix .sort. Anthony On Tuesday, January 7, 2014 5:53:15 PM UTC-5, Joe Barnhart wrote: It's actually a little deeper problem. I see that Rows.sort() has the effect of stripping the table key from the resulting Row objects. If I try the obvious fix, to use the built-in sorted on self.records instead of self, then the next problem surfaces -- the supplied sort key must include the table and the field key, and they must both be supplied to the sort. Which would break all manner of existing programs. I love the concept of compact vs non-compact, but the implementation of stripping the table keys from the Row objects has left quite a mess! -- Joe -- 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: Rows.compact and other Rows methods
Note, same problem with .sort (it modifies the Row objects in self.records), so we should probably fix that as well (will be a bit more complicated). Anthony On Tuesday, January 7, 2014 11:03:56 AM UTC-5, Anthony wrote: The Rows.find() method does the following: for row in self: if f(row): if a=k: records.append(row) k += 1 if k==b: break In a Rows object, there is self.records, which is a list of Row objects. Each Row object has at least one top-level key with the table name, and the record is stored in the value associated with that key: Row {'person': {'first_name': 'Bob', 'last_name': 'Smith'}} When .find() is called on a Rows object with compact=True, the __iter__ method (called by the for row in self loop) returns a transformed version of each Row object, removing the top-level table key: Row {'first_name': 'Bob', 'last_name': 'Smith'} I believe this is an unnecessary transformation, and it is what is subsequently causing the .render() method to fail (the .render() method expects the top-level table key to be there, whether or not compact=True). I propose the following change to .find(): for i, row in enumerate(self): if f(row): if a=k: records.append(self.records[i]) k += 1 if k==b: break The above code appends self.records[i] instead of row, which preserves the original Row objects instead of including transformed objects. Anyone see any problems with that change? Also, is there any reason all of the Rows methods (i.e., find, exclude, __and__, __or__) should not be preserving the compact attribute of the original Rows object? Perhaps we should change them all to do so. (Note, this is a separate issue unrelated to the above problem with .find() and .render().) Anthony On Tuesday, January 7, 2014 10:47:28 AM UTC-5, Anthony wrote: .render() works fine on Rows objects with compact=True, and it also works fine on the results of .sort(), .exclude(), , and | operations. The only problem is with the results of .find() operations when the original Rows object has compact=True. The problem is that the .find() method modifies the Row objects in self.records when compact=True, which it probably should not due. Aside from this issue, perhaps the various Rows methods should preserve the compact attribute -- not sure why they don't. Forwarding to the developers list for discussion. Anthony On Tuesday, January 7, 2014 3:10:00 AM UTC-5, Joe Barnhart wrote: I've been experimenting with the render method of the Rows class, and I am very impressed. But one drawback I found is that the Rows object must have its value set to compact=False to work properly with render(). It isn't a problem if the Rows object is used directly without any operators, but I discovered that many, if not most, Rows methods do not preserve the compact setting. For example. if you sort the Rows, it leaves compact=True. Ditto, if you use extract or find on the Rows object. The and | operators also set the compact variable to True. The upshot is that you can't use any of these operators on the Rows object and then use render on the resulting object. It is a simple change to add the preservation of the compact flag during any of these steps, but I'm unsure if this will break existing code. Other than coming up with a completely parallel set of methods, which leave compact set the way it came in, I can't think of another approach will be provably backwards-compatible. Here is an example: def __and__(self,other): if self.colnames!=other.colnames: raise Exception('Cannot incompatible Rows objects') records = self.records+other.records return Rows(self.db,records,self.colnames) Becomes: def __and__(self,other): if self.colnames!=other.colnames: raise Exception('Cannot incompatible Rows objects') records = self.records+other.records return Rows(self.db,records,self.colnames,compact=(self.compact or other.compact)) In the case above, the flag compact will be set True if either of the participating Rows object is also compact. My logic is, if you've lost the table values on either Rows object, you may as well lose them on the combined set. What do you think? -- Joe B. -- 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] web2py administrative interface issue
Hi, Today I was trying to access my application via web2py administrative interface but one of my application was not opening on 'edit' click in 'manage' button. It waits and throws a internal server error. Till yesterday it was working fine... Whereas other application like 'example' is opening after 'edit' click. Why it is happening? Thanks -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM and IS_IN_SET problem
I have the same problem as the original poster. I am only storing a single value as of now but I'm using list:string instead of string so that if I change my mind to allow multiple values it will be easier to transition. Is this a bug that it won't preselect the selected value? Alternatively, does migration from a string field to a list:string field preserve the string data? On Monday, October 10, 2011 7:20:46 PM UTC-4, Anthony wrote: On Monday, October 10, 2011 6:01:49 PM UTC-4, Cliff wrote: Mostly fixed now. There was also a bug in my controller code that was complicating things. One problem remains. With readonly=True, the field still shows the dictionary key rather than the value. With readonly, I guess it's not using the widget, so it will just show the value stored in the field itself. Maybe you can define a represent function for the field so it shows the label associated with the value. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Web2py Integration with Sentry
I haven't, but I've done something similar with a different piece of software. You'd usually just use it as a wsgi middleware around your app. So you'd need to run web2py as wsgi and wrap it with Sentry. On Monday, January 6, 2014 8:14:46 PM UTC-7, James Q wrote: Has anyone ever integrated web2py an Sentry ( https://github.com/getsentry/sentry)? I would like it if all web2py generated exceptions generate a ticket like usual, but also generates an event to a sentry server. Has anyone ever done this? If not, could anyone point to where I would need to patch web2py or how best this integration would work? Thanks for any help! -- 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: Why web2py and AnguljarJS?
Yea, there are a lot of similarities, I decided myself just to skip web2py and do most of the work in a client side template, where the webserver only serves static files and json, and the client framework handles everything else. It works pretty good on the desktop, but I haven't even tested in on mobile. There's room for both. On Sunday, January 5, 2014 3:06:43 PM UTC-7, Ruud Schroen wrote: I see more and more about using angularjs with web2py. But why? What would be an example of a benefit from using those two. Cause when i look at AngularJS, it already looks alot like web2py. Not saying that it's a bad idea, just wondering ;) -- 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: Rows.compact and other Rows methods
Maybe the best answer is to change Row so that it always holds the full set of keys (table:field) and change the __getitem__ method to look up the key recursively if only one part is provided. Here is a sample method which implements this strategy of testing keys for dicts within dicts. Our case is a little simpler since we never recurse more than one level deep. def _finditem(obj, key): if key in obj: return obj[key] for k, v in obj.items(): if isinstance(v,dict): item = _finditem(v, key) if item is not None: return item This has the advantage of working with existing code and preserving as much information as possible in the Row object. I have a feeling this could make the internals of web2py a good deal more consistent. Less testing for special cases is always good! -- Joe B. On Tuesday, January 7, 2014 3:48:39 PM UTC-8, Anthony wrote: Note, same problem with .sort (it modifies the Row objects in self.records), so we should probably fix that as well (will be a bit more complicated). Anthony On Tuesday, January 7, 2014 11:03:56 AM UTC-5, Anthony wrote: The Rows.find() method does the following: for row in self: if f(row): if a=k: records.append(row) k += 1 if k==b: break In a Rows object, there is self.records, which is a list of Row objects. Each Row object has at least one top-level key with the table name, and the record is stored in the value associated with that key: Row {'person': {'first_name': 'Bob', 'last_name': 'Smith'}} When .find() is called on a Rows object with compact=True, the __iter__ method (called by the for row in self loop) returns a transformed version of each Row object, removing the top-level table key: Row {'first_name': 'Bob', 'last_name': 'Smith'} I believe this is an unnecessary transformation, and it is what is subsequently causing the .render() method to fail (the .render() method expects the top-level table key to be there, whether or not compact=True). I propose the following change to .find(): for i, row in enumerate(self): if f(row): if a=k: records.append(self.records[i]) k += 1 if k==b: break The above code appends self.records[i] instead of row, which preserves the original Row objects instead of including transformed objects. Anyone see any problems with that change? Also, is there any reason all of the Rows methods (i.e., find, exclude, __and__, __or__) should not be preserving the compact attribute of the original Rows object? Perhaps we should change them all to do so. (Note, this is a separate issue unrelated to the above problem with .find() and .render().) Anthony On Tuesday, January 7, 2014 10:47:28 AM UTC-5, Anthony wrote: .render() works fine on Rows objects with compact=True, and it also works fine on the results of .sort(), .exclude(), , and | operations. The only problem is with the results of .find() operations when the original Rows object has compact=True. The problem is that the .find() method modifies the Row objects in self.records when compact=True, which it probably should not due. Aside from this issue, perhaps the various Rows methods should preserve the compact attribute -- not sure why they don't. Forwarding to the developers list for discussion. Anthony On Tuesday, January 7, 2014 3:10:00 AM UTC-5, Joe Barnhart wrote: I've been experimenting with the render method of the Rows class, and I am very impressed. But one drawback I found is that the Rows object must have its value set to compact=False to work properly with render(). It isn't a problem if the Rows object is used directly without any operators, but I discovered that many, if not most, Rows methods do not preserve the compact setting. For example. if you sort the Rows, it leaves compact=True. Ditto, if you use extract or find on the Rows object. The and | operators also set the compact variable to True. The upshot is that you can't use any of these operators on the Rows object and then use render on the resulting object. It is a simple change to add the preservation of the compact flag during any of these steps, but I'm unsure if this will break existing code. Other than coming up with a completely parallel set of methods, which leave compact set the way it came in, I can't think of another approach will be provably backwards-compatible. Here is an example: def __and__(self,other): if self.colnames!=other.colnames: raise Exception('Cannot incompatible Rows objects') records = self.records+other.records return Rows(self.db,records,self.colnames) Becomes: def __and__(self,other): if self.colnames!=other.colnames: raise Exception('Cannot incompatible Rows objects')
[web2py] Re: Different applications usiong same set of tables
Thank you. So fake_migrate=True will scan the structure defined for tables defined under models in the .py files and create files under databases so that the structure defined in the python files and in the databases folder are same. It wil not really connect to the database at all. If we set migrate=false, web2py will not do any checks at all, but 'assume' that the database table structure is in synch with those defined under the models, and issue a ticket if there are issues. The files under database folder have no significance if migrate=False. On Wednesday, January 8, 2014 2:18:59 AM UTC+5:30, Niphlod wrote: migrate=False prevents web2py to check if the underlying tables are in sync with your model. you don't need to run fake_migrate=True if you're not planning on altering tables on app2. fake_migrate=True just generates .table files according to your model, so you'll get (assuming the connection string is identical) exactly the same files that you can find under app1/databases/ On Tuesday, January 7, 2014 12:44:10 PM UTC+1, Jayadevan M wrote: I have an application app1. I want to create another application - app2 which will use the same set of tables as used by app1. For this, what I have to do is create a tables.py under app2/models and mention migrate=False for the common tables. Is that right? Do I have to set fake_migrate=True and ensure the table files are created under databases folder in app2? My simple tests tell me it is not necessary. Just for confirmation. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: intercept closing session
I have to connect to a database known only at runtime, I create the model on the fly, but it is not thread safe, so I thoughthttp://it.dicios.com/enit/thoughtthat a possible solution could be to give to the model the name of the session_id, but I believe that there is a better solution, how do you think a thing like that should be done? 2014/1/7 Anthony abasta...@gmail.com What exactly do you need to do? On Tuesday, January 7, 2014 1:39:04 PM UTC-5, Giuseppe D'Amico wrote: what if someone does not do the logout, but for some reason the session end? 2014/1/7 Giuseppe D'Amico damicogi...@gmail.com thanks I will do like you say 2014/1/7 Alan Etkin spam...@gmail.com El martes, 7 de enero de 2014 14:40:38 UTC-3, Giuseppe D'Amico escribió: Hi, I am new with web2py, is there a way to intercept the closing of a session? You mean you want to catch a user logout from the scaffolding app? You could modify the user action at controllers.py so it checks wether the logout action was asked: def user(): if request.args[0] == logout: do something There's also the auth.settings.logout_onlogout which can be a function that receives auth.user as argument (undocumented) and auth.settings.logout_next (a URL for redirection after logout). -- 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/rzS37obsTI4/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.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/rzS37obsTI4/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.