[web2py] Re: return user defined xml in web2py
any updates/help... --
[web2py] Re: return user defined xml in web2py
does that work on a normal python script ? On Tuesday, October 16, 2012 8:25:18 AM UTC+2, deepak wrote: any updates/help... --
[web2py] Re: doc suggestion
somehow I've never heard a name for those, thanks for explaining. I agree that the feature would be awesome, it's just a little bit cumbersome to code. The source is on github, it's true, but visualizing e.g. for changes of the last revision would not be very helpful, e.g. : - rev 1 chapter 04 - rev 2 chapter 04 (added a section, it has change bars on the right) - rev 3 chapter 04 (fixed a typo, changebars only on that line) We'd need to manage typo revisions and new docs revisions (and possibly, avoid highlighting moved section revisions). How do you suggest to implement the change bars ? On Tuesday, October 16, 2012 7:36:45 AM UTC+2, weheh wrote: Change bar shows a vertical bar on right side of page spanning lines of text that have changed from the previous version(s). Optional is self-explanatory. On Sunday, October 14, 2012 5:10:37 PM UTC+8, Niphlod wrote: ehm what are optional change bars like ? On Sunday, October 14, 2012 1:25:37 AM UTC+2, weheh wrote: Optional change bars could be useful on the online documentation. --
[web2py] Re: Basic question about CSS / Web2py !
I agree with Anthony. Edit that css and see for yourself how can you manage it. Most likely you want that label to go on more lines than one, so what you are searching for in that case is word wraphttp://www.css3.com/css-word-wrap/ On Tuesday, October 16, 2012 5:14:02 AM UTC+2, Anthony wrote: Yes, the label can take an HTML helper -- but wouldn't it have been much faster and easier to just try that rather than post a question about it? ;-) On Monday, October 15, 2012 10:10:20 PM UTC-4, Don_X wrote: weheh ! Thank you for your response ... but this is not what I am looking for ! I know about what you suggested below .. this is how it is declared .. indeed ! Now ... Can the label argument take an HTML helper of somekind, so if the translation of 'mylabel' happens and it is too long of an expression, a way to make it wrap, like in two lines or something !??? ... For example : db.define_table('mytable', Field(myfield, label=T('an expression in english'), ) now .. the label says 'an expression in english' the same expression in another language happens to be almost twice the length shown above ! .. do you understand ? .. now .. how can that translated expression be wrapped a certain way ... within the label ... in order to occupy almost the same space without interrupting the table or the form it is shown on ??? ... --
Re: [web2py] 'DAL' object has no attribute '_lazy_tables'
On Tue, Oct 16, 2012 at 6:37 AM, Martin Weissenboeck mweis...@gmail.com wrote: The trunc version solved my problem Working for me too. Ricardo 2012/10/16 Massimo Di Pierro massimo.dipie...@gmail.com This helped a lot. I was able to reproduce it and fix it. Can you please check it in trunk. I can post 2.1.2 later tonight. On Monday, 15 October 2012 19:18:09 UTC-5, Ricardo Pedroso wrote: Forget to mention that you must make two requests, the first one will save the session and the second one will read from session and will fail Ricardo On Tue, Oct 16, 2012 at 1:10 AM, Ricardo Pedroso rmdpe...@gmail.com wrote: On Mon, Oct 15, 2012 at 9:37 PM, Massimo Di Pierro massimo@gmail.com wrote: This is not the behavior. Quote the opposite. This should work better in web2py 2.1 than before. Can you post a simple app so that I can reproduce it and debug it? Below a simple app that expose the problem. I guess the problem is related to the dog Set in the person Row. --- models/db.py: --- # -*- coding: utf-8 -*- db = DAL('sqlite://storage.sqlite') db.define_table('person', Field('name'), ) db.define_table('dog', Field('name'), Field('owner', db.person), ) if db(db.person).count() == 0: jim = db.person.insert(name='Jim') db.dog.insert(name='Boby', owner=jim) --- controllers/default.py: - # -*- coding: utf-8 -*- def index(): session.person = db(db.person).select().first() return 'ok' Ricardo On Monday, 15 October 2012 15:05:23 UTC-5, Ricardo Pedroso wrote: On Mon, Oct 15, 2012 at 9:01 PM, Ricardo Pedroso rmdpe...@gmail.com wrote: On Mon, Oct 15, 2012 at 7:56 PM, Martin Weissenboeck mwei...@gmail.com wrote: Upgraded to 2.1.1. I get: Traceback (most recent call last): (...) File D:\web2py\gluon\dal.py, line 7146, in __getattr__ if ogetattr(self,'_lazy_tables') and \ AttributeError: 'DAL' object has no attribute '_lazy_tables' I was hit by this, too. I track it down to a dal row that I was putting in session. I was using: session.myvar = dal_row I solve it like: session.myvar = Storage(dal_row.as_dict()) Massimo is it necessary to open a ticket about this or is this intended behavior? Ricardo -- -- -- --
[web2py] Re: return user defined xml in web2py
xmlwitch? xmlwitch works on normal python script. Is there a way to return custom made xml from web2py controller. Can you please help me with some prototype? On Tuesday, 16 October 2012 13:36:30 UTC+5:30, Niphlod wrote: does that work on a normal python script ? On Tuesday, October 16, 2012 8:25:18 AM UTC+2, deepak wrote: any updates/help... --
[web2py] Re: web2py 2.1.1 is OUT!
Thanks... is deploy to openshift experimental? On Tuesday, October 16, 2012 4:04:36 AM UTC+3, Massimo Di Pierro wrote: The book is now kind of in between versions it is correct but some of the new features are not described and some example use old API while there is a better way. I plan to finish update it and release the 5th editions within one month. Hopefully sooner. On Monday, 15 October 2012 20:01:33 UTC-5, apps in tables wrote: Fantastic.as usual. tiny hint: can the book title be more descriptive of the related version of web2py ? On Monday, October 15, 2012 8:30:42 PM UTC+3, martzi wrote: Many thanks Massimo web2py is here to stay ! On Monday, October 15, 2012 1:55:39 PM UTC+2, Massimo Di Pierro wrote: Changelog: - overall faster web2py - when apps are deleted, a w2p copy left in deposit folder - change in cron (it is now disabled by default). removed -N option and introdu\ ced -Y. - faster web2py_uuid() and request initialization logic, thanks Michele - static asset management, thanks Niphlod - improved mobile admin - request.requires_https and Auth(secure=True), thanks Yarin and Niphlod - better custom_import (works per app and is faster), thanks Michele - redis_sesssion.py, thanks Niphlod - allow entropy computation in IS_STRONG and web2py.js, thanks Jonathan and Nip\ hlod - fixed many aith.wiki problems - support for auth.wiki(render='html') - better welcome layout, thanks Paolo - db.define_table(...,redefine=True) - DAL, Row, and Rows object can now be pickled/unpickled, thanks to zombie DAL. - admin uses codemirror - allow syntax auth = Auth(db).define_tables() - better auth.wiki with preview, thanks Alan - better auth.impersonate, thanks Alan - upgraded jQuery 1.8 - upgraded Bootstrap 2.1 - fixed problems with dropbox_account.py - many fixes to cache.ram, cache.disk, memcache and gae_memcache - cache.with_prefix(cache.ram,'prefix') - db.table.field.epoch() counts seconds from epoch - DAL support for SQL CASE, example: db().select(...query.case('true','false)) - DAL(...,do_connect=False) allows faking connections - DAL(...,auto_import=True) now retieves some fiel attributes - mail can specify a sender: mail.send(...,sender='Mr X %(sender)s') - renamed gluon/contrib/comet_messaging.py - gluon/contrib/websocket_messaging.py Please check it and report any problem. As usual, thanks to the many people who have contributed, in particular Michele and Niphlod. Massimo --
[web2py] URL requests always aiming to default controller...
Hi, Using web2py, straight out of the box, no routes.py or such : When i request : https://myserver/myapp/mycontroller/myfunction having /models/models.py : ... default_application = 'myapp' ... and /controllers/mycontroller.py : def myfunction(): # no pasa nada return dict() Web2py answers : invalid function (default/mycontroller) So, he is looking for function *mycontroller*, inside controller *default.py *, instead of looking for function *myfunction*, inside controller * mycontroller.py*. Why ? What I am missing ? --
[web2py] auth.impersonate(0)
I have called auth.impersonate(0) to finish impersonation. Now (Version 2.1.1) I see: Traceback (most recent call last): File H:\...\web2py\gluon\restricted.py, line 209, in restricted exec ccode in environment File H:/.../applications/secure/controllers/default.py http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py, line 3988, in module File H:\...\web2py\gluon\globals.py, line 187, in lambda self._caller = lambda f: f() File H:/.../applications/secure/controllers/default.py http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py, line 1932, in impersonateEnd auth.impersonate(0) File H:\...\web2py\gluon\tools.py, line 2755, in impersonate return SQLFORM(table_user, user.id, readonly=True) UnboundLocalError: local variable 'user' referenced before assignment My function: def impersonateEnd(): auth.impersonate(0) redirect(URL('index',vars=dict(flash=T('End of impersonation' What ist the best way to end impersonation? Regards, Martin --
[web2py] Re: return user defined xml in web2py
what I needed was knowing if import xmlwitch def get_xml(): xml = xmlwitch.Builder(version='1.0', encoding='utf-8') with xml.feed(xmlns='http://www.w3.org/2005/Atom'): xml.title('Example Feed') xml.updated('2003-12-13T18:30:02Z') #response.headers['Content-Type']='text/xml' #return XML(str(xml),sanitize=True) #return XML(str(xml)).xml() return xml if __name__ == '__main__': print get_xml() works if executed outside web2py (and returns actually what you want) On Tuesday, October 16, 2012 10:53:36 AM UTC+2, deepak wrote: xmlwitch? xmlwitch works on normal python script. Is there a way to return custom made xml from web2py controller. Can you please help me with some prototype? On Tuesday, 16 October 2012 13:36:30 UTC+5:30, Niphlod wrote: does that work on a normal python script ? On Tuesday, October 16, 2012 8:25:18 AM UTC+2, deepak wrote: any updates/help... --
[web2py] Route on error
Hey Everyone, Instead of trace trawling with the routes_onerror variable, in routes.py I'm trying to get it to route if an invalid application, controller or function is passed. The app part of the uri might be right, but the controller is not so re-route kind of deal. All I get is a standard H1 error spitting out. This is what I have: routes_onerror = [ (r'*', r'/app/static/error.html') ] error_handler = dict(application='app', controller='default', function='error') Plus I've updated the error_message with some html code wrapped in tripple quotes for the last resort. I can get a uri like such: http://localhost/this to be re-routed, but if I do something like this http://localhost/app/this/that it doesn't work. The app name is right but the controller or function is wrong. looking forward to the response. Cheers, Rhys --
Re: [web2py] Performance overhead when making languages not writable
On 15 October 2012 20:17, Vladyslav Kozlovskyy vld...@gmail.com wrote: sure, it's a right decision :) Thanks for adding this, however I actually don't see this as ideal now. Here it is read only once - at web2py startup. I'm not sure how or where I would set this. Ideally I'd like to control this setting within my application, through something like current.request.xxx Are you ok if I modify this to work in that way? Best Wishes, Fran. У пн, 2012-10-15 у 18:44 +0100, Fran Boon пише: On 15 October 2012 18:36, Vladyslav Kozlovskyy vld...@gmail.com wrote: We have [is_gae] variable in [gluon/languages.py] to avoid writting dicts in Google AppEngine. All we need is to make such replacement in [gluon/languages.py]: replace 38 is_gae = settings.global_settings.web2py_runtime_gae with 38 is_gae = settings.global_settings.web2py_runtime_gae or setings.global_settings.languages_readonly # or use better varname :) Right - this is the right place to do it, but I'd do: 38 read_only = settings.global_settings.web2py_runtime_gae or settings.global_settings.languages_readonly then replace other is_gae refs with that... F -- --
[web2py] Re: web2py 2.1.1 is OUT!
As far as I know it works but I will say experimental until more people have tried it. On Tuesday, 16 October 2012 04:07:37 UTC-5, apps in tables wrote: Thanks... is deploy to openshift experimental? On Tuesday, October 16, 2012 4:04:36 AM UTC+3, Massimo Di Pierro wrote: The book is now kind of in between versions it is correct but some of the new features are not described and some example use old API while there is a better way. I plan to finish update it and release the 5th editions within one month. Hopefully sooner. On Monday, 15 October 2012 20:01:33 UTC-5, apps in tables wrote: Fantastic.as usual. tiny hint: can the book title be more descriptive of the related version of web2py ? On Monday, October 15, 2012 8:30:42 PM UTC+3, martzi wrote: Many thanks Massimo web2py is here to stay ! On Monday, October 15, 2012 1:55:39 PM UTC+2, Massimo Di Pierro wrote: Changelog: - overall faster web2py - when apps are deleted, a w2p copy left in deposit folder - change in cron (it is now disabled by default). removed -N option and introdu\ ced -Y. - faster web2py_uuid() and request initialization logic, thanks Michele - static asset management, thanks Niphlod - improved mobile admin - request.requires_https and Auth(secure=True), thanks Yarin and Niphlod - better custom_import (works per app and is faster), thanks Michele - redis_sesssion.py, thanks Niphlod - allow entropy computation in IS_STRONG and web2py.js, thanks Jonathan and Nip\ hlod - fixed many aith.wiki problems - support for auth.wiki(render='html') - better welcome layout, thanks Paolo - db.define_table(...,redefine=True) - DAL, Row, and Rows object can now be pickled/unpickled, thanks to zombie DAL. - admin uses codemirror - allow syntax auth = Auth(db).define_tables() - better auth.wiki with preview, thanks Alan - better auth.impersonate, thanks Alan - upgraded jQuery 1.8 - upgraded Bootstrap 2.1 - fixed problems with dropbox_account.py - many fixes to cache.ram, cache.disk, memcache and gae_memcache - cache.with_prefix(cache.ram,'prefix') - db.table.field.epoch() counts seconds from epoch - DAL support for SQL CASE, example: db().select(...query.case('true','false)) - DAL(...,do_connect=False) allows faking connections - DAL(...,auto_import=True) now retieves some fiel attributes - mail can specify a sender: mail.send(...,sender='Mr X %(sender)s') - renamed gluon/contrib/comet_messaging.py - gluon/contrib/websocket_messaging.py Please check it and report any problem. As usual, thanks to the many people who have contributed, in particular Michele and Niphlod. Massimo --
[web2py] Re: auth.impersonate(0)
There is a bug, I just fixed it in trunk. auth.impersonate(0) is correct. On Tuesday, 16 October 2012 04:38:35 UTC-5, mweissen wrote: I have called auth.impersonate(0) to finish impersonation. Now (Version 2.1.1) I see: Traceback (most recent call last): File H:\...\web2py\gluon\restricted.py, line 209, in restricted exec ccode in environment File H:/.../applications/secure/controllers/default.py http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py, line 3988, in module File H:\...\web2py\gluon\globals.py, line 187, in lambda self._caller = lambda f: f() File H:/.../applications/secure/controllers/default.py http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py, line 1932, in impersonateEnd auth.impersonate(0) File H:\...\web2py\gluon\tools.py, line 2755, in impersonate return SQLFORM(table_user, user.id, readonly=True) UnboundLocalError: local variable 'user' referenced before assignment My function: def impersonateEnd(): auth.impersonate(0) redirect(URL('index',vars=dict(flash=T('End of impersonation' What ist the best way to end impersonation? Regards, Martin --
Re: [web2py] Performance overhead when making languages not writable
Fran is right. We need this configurable per app, not global On Tuesday, 16 October 2012 05:32:19 UTC-5, Fran wrote: On 15 October 2012 20:17, Vladyslav Kozlovskyy vld...@gmail.comjavascript: wrote: sure, it's a right decision :) Thanks for adding this, however I actually don't see this as ideal now. Here it is read only once - at web2py startup. I'm not sure how or where I would set this. Ideally I'd like to control this setting within my application, through something like current.request.xxx Are you ok if I modify this to work in that way? Best Wishes, Fran. У пн, 2012-10-15 у 18:44 +0100, Fran Boon пише: On 15 October 2012 18:36, Vladyslav Kozlovskyy vld...@gmail.comjavascript: wrote: We have [is_gae] variable in [gluon/languages.py] to avoid writting dicts in Google AppEngine. All we need is to make such replacement in [gluon/languages.py]: replace 38 is_gae = settings.global_settings.web2py_runtime_gae with 38 is_gae = settings.global_settings.web2py_runtime_gae or setings.global_settings.languages_readonly # or use better varname :) Right - this is the right place to do it, but I'd do: 38 read_only = settings.global_settings.web2py_runtime_gae or settings.global_settings.languages_readonly then replace other is_gae refs with that... F -- --
[web2py] help me test sessions in cookies
This is new in trunk and needs to be tested. Add this to your app: session.connect(cookie_key='mypassphrase') and sessions will be stored in cookies (like Flask does). Cookies are encrypted with AES 32bites and signed with HMAC+SHA1. --
[web2py] Re: inserting/updating NULL values via db admin screens
we could go with phpmyadmin solution: null checkboxes next to string fields On Monday, October 15, 2012 8:55:20 PM UTC-4, Massimo Di Pierro wrote: Good point. If the field is of type string, the form does distinguish between an empty string and null, assumes an empty string. On Monday, 15 October 2012 19:50:31 UTC-5, Yarin wrote: Is it possible to work with NULL values via the DB admin screens? I've got a bunch of string fields that should default to NULL, but everytime I try to insert a record through the admin screens they wind up as empty strings. Worse, existing records that have NULL values get those values replaced by empty strings if you update the record via the admin screen. --
Re: [web2py] Re: auth.impersonate(0)
Is this the actual trunc-version? Version 2.1.1 (2012-10-16 06:19:35) dev I get the same message type 'exceptions.UnboundLocalError' local variable 'user' referenced before assignment 2012/10/16 Massimo Di Pierro massimo.dipie...@gmail.com There is a bug, I just fixed it in trunk. auth.impersonate(0) is correct. On Tuesday, 16 October 2012 04:38:35 UTC-5, mweissen wrote: I have called auth.impersonate(0) to finish impersonation. Now (Version 2.1.1) I see: Traceback (most recent call last): File H:\...\web2py\gluon\**restricted.py, line 209, in restricted exec ccode in environment File H:/.../applications/secure/**controllers/default.py http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py, line 3988, in module File H:\...\web2py\gluon\globals.**py, line 187, in lambda self._caller = lambda f: f() File H:/.../applications/secure/**controllers/default.py http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py, line 1932, in impersonateEnd auth.impersonate(0) File H:\...\web2py\gluon\tools.py**, line 2755, in impersonate return SQLFORM(table_user, user.id, readonly=True) UnboundLocalError: local variable 'user' referenced before assignment My function: def impersonateEnd(): auth.impersonate(0) redirect(URL('index',vars=**dict(flash=T('End of impersonation' What ist the best way to end impersonation? Regards, Martin -- -- Mit freundlichen Grüßen / With kind regards Martin Weissenböck Gregor-Mendel-Str. 37, 1190 Wien Austria / European Union Tel +43 1 31400 00 Fax +43 1 31400 700 --
[web2py] Re: return user defined xml in web2py
Hi Niphlod, xmlwitch was not able to return the xml object. I got error: *TypeError: __repr__ returned non-string (type instance)* --
[web2py] Re: inserting/updating NULL values via db admin screens
I do not like it. Do we need it? On Tuesday, 16 October 2012 06:43:24 UTC-5, Yarin wrote: we could go with phpmyadmin solution: null checkboxes next to string fields On Monday, October 15, 2012 8:55:20 PM UTC-4, Massimo Di Pierro wrote: Good point. If the field is of type string, the form does distinguish between an empty string and null, assumes an empty string. On Monday, 15 October 2012 19:50:31 UTC-5, Yarin wrote: Is it possible to work with NULL values via the DB admin screens? I've got a bunch of string fields that should default to NULL, but everytime I try to insert a record through the admin screens they wind up as empty strings. Worse, existing records that have NULL values get those values replaced by empty strings if you update the record via the admin screen. --
Re: [web2py] Re: auth.impersonate(0)
can you show all traceback? On Tuesday, 16 October 2012 07:18:38 UTC-5, mweissen wrote: Is this the actual trunc-version? Version 2.1.1 (2012-10-16 06:19:35) dev I get the same message type 'exceptions.UnboundLocalError' local variable 'user' referenced before assignment 2012/10/16 Massimo Di Pierro massimo@gmail.com javascript: There is a bug, I just fixed it in trunk. auth.impersonate(0) is correct. On Tuesday, 16 October 2012 04:38:35 UTC-5, mweissen wrote: I have called auth.impersonate(0) to finish impersonation. Now (Version 2.1.1) I see: Traceback (most recent call last): File H:\...\web2py\gluon\**restricted.py, line 209, in restricted exec ccode in environment File H:/.../applications/secure/**controllers/default.py http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py, line 3988, in module File H:\...\web2py\gluon\globals.**py, line 187, in lambda self._caller = lambda f: f() File H:/.../applications/secure/**controllers/default.py http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py, line 1932, in impersonateEnd auth.impersonate(0) File H:\...\web2py\gluon\tools.py**, line 2755, in impersonate return SQLFORM(table_user, user.id, readonly=True) UnboundLocalError: local variable 'user' referenced before assignment My function: def impersonateEnd(): auth.impersonate(0) redirect(URL('index',vars=**dict(flash=T('End of impersonation' What ist the best way to end impersonation? Regards, Martin -- -- Mit freundlichen Grüßen / With kind regards Martin Weissenböck Gregor-Mendel-Str. 37, 1190 Wien Austria / European Union Tel +43 1 31400 00 Fax +43 1 31400 700 --
Re: [web2py] Re: cannot upgrade to 2.1.1 from GUI on Pythonanywhere
Now it's working fine! I suppose they cached the old version in their web proxy ... Thank you, Nico --
Re: [web2py] Re: auth.impersonate(0)
Traceback (most recent call last): File H:\...\web2py\gluon\restricted.py, line 209, in restricted exec ccode in environment File H:/.../web2py/applications/secure/controllers/default.py http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py, line 3988, in module File H:\...\web2py\gluon\globals.py, line 182, in lambda self._caller = lambda f: f() File H:/.../web2py/applications/secure/controllers/default.py http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py, line 1932, in impersonateEnd auth.impersonate(0) File H:\...\web2py\gluon\tools.py, line 2756, in impersonate return SQLFORM(table_user, user.id, readonly=True) UnboundLocalError: local variable 'user' referenced before assignment 2012/10/16 Massimo Di Pierro massimo.dipie...@gmail.com can you show all traceback? On Tuesday, 16 October 2012 07:18:38 UTC-5, mweissen wrote: Is this the actual trunc-version? Version 2.1.1 (2012-10-16 06:19:35) dev I get the same message type 'exceptions.UnboundLocalError'** local variable 'user' referenced before assignment 2012/10/16 Massimo Di Pierro massimo@gmail.com There is a bug, I just fixed it in trunk. auth.impersonate(0) is correct. On Tuesday, 16 October 2012 04:38:35 UTC-5, mweissen wrote: I have called auth.impersonate(0) to finish impersonation. Now (Version 2.1.1) I see: Traceback (most recent call last): File H:\...\web2py\gluon\**restricte**d.py, line 209, in restricted exec ccode in environment File H:/.../applications/secure/**co**ntrollers/default.py http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py, line 3988, in module File H:\...\web2py\gluon\globals.**p**y, line 187, in lambda self._caller = lambda f: f() File H:/.../applications/secure/**co**ntrollers/default.py http://127.0.0.1:8000/admin/default/edit/secure/controllers/default.py, line 1932, in impersonateEnd auth.impersonate(0) File H:\...\web2py\gluon\tools.py, line 2755, in impersonate return SQLFORM(table_user, user.id, readonly=True) UnboundLocalError: local variable 'user' referenced before assignment My function: def impersonateEnd(): auth.impersonate(0) redirect(URL('index',vars=**dict**(flash=T('End of impersonation' What ist the best way to end impersonation? Regards, Martin --
[web2py] Re: return user defined xml in web2py
perfect! NB: Before screaming that web2py isn't working you'd normally have to run whatever external module you're trying to use and understand how it works. PS: I don't have a python installation at hand to try xmlwitch, but as long as that bit goes into exception there is no way web2py can execute that snippet and return your precious xml. try with return str(xml). PS2: package is 2 year old, docs are offline. Maybe it's time to ditch the awful piece of code and start using lxml ^_^ On Tuesday, October 16, 2012 2:35:05 PM UTC+2, deepak wrote: Hi Niphlod, xmlwitch was not able to return the xml object. I got error: *TypeError: __repr__ returned non-string (type instance)* --
[web2py] Re: help me test sessions in cookies
I'll do ASAP. If the cookie only is used to store session data, I imagine any webapp using this will hit the 4000 chars limit of cookies, right ? Did someone tested how much data (let's say, how many keys of a dict composed by keys 10 characters long with values 10 characters long) can fit in there with AES and hmac signing ? On Tuesday, October 16, 2012 1:24:00 PM UTC+2, Massimo Di Pierro wrote: This is new in trunk and needs to be tested. Add this to your app: session.connect(cookie_key='mypassphrase') and sessions will be stored in cookies (like Flask does). Cookies are encrypted with AES 32bites and signed with HMAC+SHA1. --
Re: [web2py] Performance overhead when making languages not writable
I'm a little bit uncertain about this. We're struggling to make web2py somewhat faster but then we're incline to drop in faulty checks for every request just to support run-time configs Can we think about something like global_settings_per_app that is set (and stored) at the first request only for the single app ? On Tuesday, October 16, 2012 1:21:40 PM UTC+2, Massimo Di Pierro wrote: Fran is right. We need this configurable per app, not global On Tuesday, 16 October 2012 05:32:19 UTC-5, Fran wrote: On 15 October 2012 20:17, Vladyslav Kozlovskyy vld...@gmail.com wrote: sure, it's a right decision :) Thanks for adding this, however I actually don't see this as ideal now. Here it is read only once - at web2py startup. I'm not sure how or where I would set this. Ideally I'd like to control this setting within my application, through something like current.request.xxx Are you ok if I modify this to work in that way? Best Wishes, Fran. У пн, 2012-10-15 у 18:44 +0100, Fran Boon пише: On 15 October 2012 18:36, Vladyslav Kozlovskyy vld...@gmail.com wrote: We have [is_gae] variable in [gluon/languages.py] to avoid writting dicts in Google AppEngine. All we need is to make such replacement in [gluon/languages.py]: replace 38 is_gae = settings.global_settings.web2py_runtime_gae with 38 is_gae = settings.global_settings.web2py_runtime_gae or setings.global_settings.languages_readonly # or use better varname :) Right - this is the right place to do it, but I'd do: 38 read_only = settings.global_settings.web2py_runtime_gae or settings.global_settings.languages_readonly then replace other is_gae refs with that... F -- --
[web2py] Re: help me test sessions in cookies
It works fine here. I get two cookies (listed below): How can we set a longer expiration? Name: session_id_w2a Content: None Domain: localhost Path: / Send for: Any kind of connection Accessible to script: Yes Created: Tuesday, October 16, 2012 4:51:00 PM Expires: When the browsing session ends Name: session_data_w2a Content: a1cb[...]43FA Domain: localhost Path: / Send for: Any kind of connection Accessible to script: Yes Created: Tuesday, October 16, 2012 4:51:00 PM Expires: When the browsing session ends marți, 16 octombrie 2012, 14:24:00 UTC+3, Massimo Di Pierro a scris: This is new in trunk and needs to be tested. Add this to your app: session.connect(cookie_key='mypassphrase') and sessions will be stored in cookies (like Flask does). Cookies are encrypted with AES 32bites and signed with HMAC+SHA1. --
[web2py] Re: web2py 2.1.1 is OUT!
when i click on deploy to openshift , I get the error : cannot import name dir_util On Tuesday, October 16, 2012 2:17:43 PM UTC+3, Massimo Di Pierro wrote: As far as I know it works but I will say experimental until more people have tried it. On Tuesday, 16 October 2012 04:07:37 UTC-5, apps in tables wrote: Thanks... is deploy to openshift experimental? On Tuesday, October 16, 2012 4:04:36 AM UTC+3, Massimo Di Pierro wrote: The book is now kind of in between versions it is correct but some of the new features are not described and some example use old API while there is a better way. I plan to finish update it and release the 5th editions within one month. Hopefully sooner. On Monday, 15 October 2012 20:01:33 UTC-5, apps in tables wrote: Fantastic.as usual. tiny hint: can the book title be more descriptive of the related version of web2py ? On Monday, October 15, 2012 8:30:42 PM UTC+3, martzi wrote: Many thanks Massimo web2py is here to stay ! On Monday, October 15, 2012 1:55:39 PM UTC+2, Massimo Di Pierro wrote: Changelog: - overall faster web2py - when apps are deleted, a w2p copy left in deposit folder - change in cron (it is now disabled by default). removed -N option and introdu\ ced -Y. - faster web2py_uuid() and request initialization logic, thanks Michele - static asset management, thanks Niphlod - improved mobile admin - request.requires_https and Auth(secure=True), thanks Yarin and Niphlod - better custom_import (works per app and is faster), thanks Michele - redis_sesssion.py, thanks Niphlod - allow entropy computation in IS_STRONG and web2py.js, thanks Jonathan and Nip\ hlod - fixed many aith.wiki problems - support for auth.wiki(render='html') - better welcome layout, thanks Paolo - db.define_table(...,redefine=True) - DAL, Row, and Rows object can now be pickled/unpickled, thanks to zombie DAL. - admin uses codemirror - allow syntax auth = Auth(db).define_tables() - better auth.wiki with preview, thanks Alan - better auth.impersonate, thanks Alan - upgraded jQuery 1.8 - upgraded Bootstrap 2.1 - fixed problems with dropbox_account.py - many fixes to cache.ram, cache.disk, memcache and gae_memcache - cache.with_prefix(cache.ram,'prefix') - db.table.field.epoch() counts seconds from epoch - DAL support for SQL CASE, example: db().select(...query.case('true','false)) - DAL(...,do_connect=False) allows faking connections - DAL(...,auto_import=True) now retieves some fiel attributes - mail can specify a sender: mail.send(...,sender='Mr X %(sender)s') - renamed gluon/contrib/comet_messaging.py - gluon/contrib/websocket_messaging.py Please check it and report any problem. As usual, thanks to the many people who have contributed, in particular Michele and Niphlod. Massimo --
[web2py] Re: Web2Py on OpenShift
Ashraf, (reposting, as response did not show up on list) This morning I installed a web2py app using the github path to Andrew's v2.0.9 web2py install on openshift and it worked fine. My other app install has been working for months, and it uses v2.0.2. I did receive recently an e-mail from openshift stating that their directory structure has changed. So far it has not affected my install. Just reporting. Margaret --
Re: [web2py] URL requests always aiming to default controller...
On 16 Oct 2012, at 2:27 AM, apinho jaapi...@sapo.pt wrote: Using web2py, straight out of the box, no routes.py or such : When i request : https://myserver/myapp/mycontroller/myfunction having /models/models.py : ... default_application = 'myapp' ... and /controllers/mycontroller.py : def myfunction(): # no pasa nada return dict() Web2py answers : invalid function (default/mycontroller) So, he is looking for function mycontroller, inside controller default.py, instead of looking for function myfunction, inside controllermycontroller.py. Why ? What I am missing ? You can't set the default application in your model. It's too late; the routing is already done. But you should still be able to access myapp explicitly. Do you have a directory: applications/myapp with the above models and controller in it? --
Re: [web2py] URL requests always aiming to default controller...
Hi, Yes I have such directory. I can access myapp, but I'm forced to put all my functions inside DEFAULT.PY controller. I was wishing to split my functions across differente controllers, and I just can't understand why I can't. I'm using nginx, with this config : server { listen 80; server_name $hostname; location ~* /(\w+)/static/ { root /home/www-data/web2py/applications/; } location / { uwsgi_pass 127.0.0.1:9001; include uwsgi_params; uwsgi_param UWSGI_SCHEME $scheme; uwsgi_param SERVER_SOFTWAREnginx/$nginx_version; } } server { listen 443; client_max_body_size 20M; server_name $hostname; ssl on; ssl_certificate /etc/nginx/ssl/web2py.crt; ssl_certificate_key /etc/nginx/ssl/web2py.key; location / { uwsgi_pass 127.0.0.1:9001; include uwsgi_params; uwsgi_param UWSGI_SCHEME $scheme; uwsgi_param SERVER_SOFTWAREnginx/$nginx_version; } }' This is a standard config i grabbed from some recipe, since I'm an absolute beginner when it comes to http servers. Do you think something is wrong there ? On Tuesday, October 16, 2012 4:12:16 PM UTC+1, Jonathan Lundell wrote: On 16 Oct 2012, at 2:27 AM, apinho jaap...@sapo.pt javascript: wrote: Using web2py, straight out of the box, no routes.py or such : When i request : https https://myserver/myapp/mycontroller/myfunction:https://myserver/myapp/mycontroller/myfunction //myserver/myapp/mycontroller/myfunctionhttps://myserver/myapp/mycontroller/myfunction having /models/models.py : ... default_application = 'myapp' ... and /controllers/mycontroller.py : def myfunction(): # no pasa nada return dict() Web2py answers : invalid function (default/mycontroller) So, he is looking for function *mycontroller*, inside controller * default.py*, instead of looking for function *myfunction*, inside controller*mycontroller.py*. Why ? What I am missing ? You can't set the default application in your model. It's too late; the routing is already done. But you should still be able to access myapp explicitly. Do you have a directory: applications/myapp with the above models and controller in it? --
Re: [web2py] Re: auth.impersonate(0)
The fix in trunk worked for me. Martin are you calling impersonate(0) via GET or POST. Now I'm going to guessing mode I guest it is via GET, right? And probably when you call it you were not an impersonator any more. Massimo, maybe it is a condition missing: we have in gluon/tools.py: elif user_id in (0, '0') and self.is_impersonating(): session.clear() session.update(cPickle.loads(auth.impersonator)) self.user = session.auth.user return None Probably should go something like this: elif user_id in (0, '0'): if self.is_impersonating(): session.clear() session.update(cPickle.loads(auth.impersonator)) self.user = session.auth.user return None Ricardo On Tue, Oct 16, 2012 at 2:31 PM, Martin Weissenboeck mweis...@gmail.com wrote: Traceback (most recent call last): File H:\...\web2py\gluon\restricted.py, line 209, in restricted exec ccode in environment File H:/.../web2py/applications/secure/controllers/default.py, line 3988, in module File H:\...\web2py\gluon\globals.py, line 182, in lambda self._caller = lambda f: f () File H:/.../web2py/applications/secure/controllers/default.py, line 1932, in impersonateEnd auth.impersonate(0) File H:\...\web2py\gluon\tools.py, line 2756, in impersonate return SQLFORM(table_user, user.id, readonly=True) UnboundLocalError: local variable 'user' referenced before assignment 2012/10/16 Massimo Di Pierro massimo.dipie...@gmail.com can you show all traceback? On Tuesday, 16 October 2012 07:18:38 UTC-5, mweissen wrote: Is this the actual trunc-version? Version 2.1.1 (2012-10-16 06:19:35) dev I get the same message type 'exceptions.UnboundLocalError' local variable 'user' referenced before assignment 2012/10/16 Massimo Di Pierro massimo@gmail.com There is a bug, I just fixed it in trunk. auth.impersonate(0) is correct. On Tuesday, 16 October 2012 04:38:35 UTC-5, mweissen wrote: I have called auth.impersonate(0) to finish impersonation. Now (Version 2.1.1) I see: Traceback (most recent call last): File H:\...\web2py\gluon\restricted.py, line 209, in restricted exec ccode in environment File H:/.../applications/secure/controllers/default.py, line 3988, in module File H:\...\web2py\gluon\globals.py, line 187, in lambda self._caller = lambda f: f() File H:/.../applications/secure/controllers/default.py, line 1932, in impersonateEnd auth.impersonate(0) File H:\...\web2py\gluon\tools.py, line 2755, in impersonate return SQLFORM(table_user, user.id, readonly=True) UnboundLocalError: local variable 'user' referenced before assignment My function: def impersonateEnd(): auth.impersonate(0) redirect(URL('index',vars=dict(flash=T('End of impersonation' What ist the best way to end impersonation? Regards, Martin -- --
Re: [web2py] Re: help me test sessions in cookies
All worked fine for me... Name: session_data_dev_tmobile Content: afccd...8B60 Host: 127.0.0.1 Path: / Send for: Any type of connection Expires: At end of session Name: session_id_dev_tmobile Content: None Path: / Send for: Any type of connection Expires: At end of session On Tue, Oct 16, 2012 at 9:54 AM, rif feric...@gmail.com wrote: It works fine here. I get two cookies (listed below): How can we set a longer expiration? Name: session_id_w2a Content: None Domain: localhost Path: / Send for: Any kind of connection Accessible to script: Yes Created: Tuesday, October 16, 2012 4:51:00 PM Expires: When the browsing session ends Name: session_data_w2a Content: a1cb[...]43FA Domain: localhost Path: / Send for: Any kind of connection Accessible to script: Yes Created: Tuesday, October 16, 2012 4:51:00 PM Expires: When the browsing session ends marți, 16 octombrie 2012, 14:24:00 UTC+3, Massimo Di Pierro a scris: This is new in trunk and needs to be tested. Add this to your app: session.connect(cookie_key='**mypassphrase') and sessions will be stored in cookies (like Flask does). Cookies are encrypted with AES 32bites and signed with HMAC+SHA1. -- --
[web2py] Re: help me test sessions in cookies
I think cookie-based sessions is great for many cases. But in some cases, it might not be desirable as clients can see what might be secret information. Why not both?Maybe, two types of sessions, client-side and server-side sessions. Although both client and server side sessions are meant to maintain states, they are appropriate for different things. --
Re: [web2py] Performance overhead when making languages not writable
I added this current.T.is_writable = False or True I do not think this adds any performance penalty because writes should not happen anyway. If they happen, there is already a big performance hit. On Tuesday, 16 October 2012 06:21:40 UTC-5, Massimo Di Pierro wrote: Fran is right. We need this configurable per app, not global On Tuesday, 16 October 2012 05:32:19 UTC-5, Fran wrote: On 15 October 2012 20:17, Vladyslav Kozlovskyy vld...@gmail.com wrote: sure, it's a right decision :) Thanks for adding this, however I actually don't see this as ideal now. Here it is read only once - at web2py startup. I'm not sure how or where I would set this. Ideally I'd like to control this setting within my application, through something like current.request.xxx Are you ok if I modify this to work in that way? Best Wishes, Fran. У пн, 2012-10-15 у 18:44 +0100, Fran Boon пише: On 15 October 2012 18:36, Vladyslav Kozlovskyy vld...@gmail.com wrote: We have [is_gae] variable in [gluon/languages.py] to avoid writting dicts in Google AppEngine. All we need is to make such replacement in [gluon/languages.py]: replace 38 is_gae = settings.global_settings.web2py_runtime_gae with 38 is_gae = settings.global_settings.web2py_runtime_gae or setings.global_settings.languages_readonly # or use better varname :) Right - this is the right place to do it, but I'd do: 38 read_only = settings.global_settings.web2py_runtime_gae or settings.global_settings.languages_readonly then replace other is_gae refs with that... F -- --
Re: [web2py] Re: auth.impersonate(0)
in trunk On Tuesday, 16 October 2012 10:51:08 UTC-5, Ricardo Pedroso wrote: The fix in trunk worked for me. Martin are you calling impersonate(0) via GET or POST. Now I'm going to guessing mode I guest it is via GET, right? And probably when you call it you were not an impersonator any more. Massimo, maybe it is a condition missing: we have in gluon/tools.py: elif user_id in (0, '0') and self.is_impersonating(): session.clear() session.update(cPickle.loads(auth.impersonator)) self.user = session.auth.user return None Probably should go something like this: elif user_id in (0, '0'): if self.is_impersonating(): session.clear() session.update(cPickle.loads(auth.impersonator)) self.user = session.auth.user return None Ricardo On Tue, Oct 16, 2012 at 2:31 PM, Martin Weissenboeck mwei...@gmail.comjavascript: wrote: Traceback (most recent call last): File H:\...\web2py\gluon\restricted.py, line 209, in restricted exec ccode in environment File H:/.../web2py/applications/secure/controllers/default.py, line 3988, in module File H:\...\web2py\gluon\globals.py, line 182, in lambda self._caller = lambda f: f () File H:/.../web2py/applications/secure/controllers/default.py, line 1932, in impersonateEnd auth.impersonate(0) File H:\...\web2py\gluon\tools.py, line 2756, in impersonate return SQLFORM(table_user, user.id, readonly=True) UnboundLocalError: local variable 'user' referenced before assignment 2012/10/16 Massimo Di Pierro massimo@gmail.com javascript: can you show all traceback? On Tuesday, 16 October 2012 07:18:38 UTC-5, mweissen wrote: Is this the actual trunc-version? Version 2.1.1 (2012-10-16 06:19:35) dev I get the same message type 'exceptions.UnboundLocalError' local variable 'user' referenced before assignment 2012/10/16 Massimo Di Pierro massimo@gmail.com There is a bug, I just fixed it in trunk. auth.impersonate(0) is correct. On Tuesday, 16 October 2012 04:38:35 UTC-5, mweissen wrote: I have called auth.impersonate(0) to finish impersonation. Now (Version 2.1.1) I see: Traceback (most recent call last): File H:\...\web2py\gluon\restricted.py, line 209, in restricted exec ccode in environment File H:/.../applications/secure/controllers/default.py, line 3988, in module File H:\...\web2py\gluon\globals.py, line 187, in lambda self._caller = lambda f: f() File H:/.../applications/secure/controllers/default.py, line 1932, in impersonateEnd auth.impersonate(0) File H:\...\web2py\gluon\tools.py, line 2755, in impersonate return SQLFORM(table_user, user.id, readonly=True) UnboundLocalError: local variable 'user' referenced before assignment My function: def impersonateEnd(): auth.impersonate(0) redirect(URL('index',vars=dict(flash=T('End of impersonation' What ist the best way to end impersonation? Regards, Martin -- --
[web2py] Re: auth.wiki usage - Another Oracle DB Gotcha
Note for future searchers people as foolish as I am to try and use Oracle for web site backend. This happened to me after I finally got the auth.wiki installed in my application and the application connected to Oracle. I had to manually create the wiki_page, wiki_media, and wiki_tab tables in SQLDEveloper and not web2py. My first attempt at creating a wiki page produced this error: Traceback (most recent call last): File C:\web2py_src_2.1.1\web2py\gluon\restricted.py, line 209, inrestricted exec ccode in environment File C:/web2py_src_2.1.1/web2py/applications/TAMOTO/controllers/default.py,line 240, in module File C:\web2py_src_2.1.1\web2py\gluon\globals.py, line 187, in lambda self._caller = lambda f: f() File C:/web2py_src_2.1.1/web2py/applications/TAMOTO/controllers/default.py,line 20, in index return auth.wiki() File C:\web2py_src_2.1.1\web2py\gluon\tools.py, line 3227, in wiki return self._wiki.read(slug)['content'] if slug else self._wiki() File C:\web2py_src_2.1.1\web2py\gluon\tools.py, line 4697, in __call__ return self.edit(request.args(1) or 'index') File C:\web2py_src_2.1.1\web2py\gluon\tools.py, line 4791, in edit formstyle='table2cols',showid=False).process() File C:\web2py_src_2.1.1\web2py\gluon\html.py, line 2135, in process self.validate(**kwargs) File C:\web2py_src_2.1.1\web2py\gluon\html.py, line 2075, in validate if self.accepts(**kwargs): File C:\web2py_src_2.1.1\web2py\gluon\sqlhtml.py, line 1441, in accepts self.vars.id = self.table.insert(**fields) File C:\web2py_src_2.1.1\web2py\gluon\dal.py, line 7808, in insert ret = self._db._adapter.insert(self,self._listify(fields)) File C:\web2py_src_2.1.1\web2py\gluon\dal.py, line 1160, in insert raise e DatabaseError: ORA-04098: trigger 'UWAVEDAT.WIKI_PAGE_TRIGGER' is invalid and failed re-validation This was caused because although I created the trigger, the trigger did not have the sequence. Oracle does not have authoincrement so you need to create a sequence. CREATE SEQUENCE SCHEMANAME.WIKI_PAGE_SEQUENCE MINVALUE 1 MAXVALUE INCREMENT BY 1 START WITH 2001 CACHE 2000ORDER NOCYCLE ; Then create your trigger: CREATE OR REPLACE TRIGGER SCHEMANAME.WIKI_PAGE_TRIGGER BEFORE INSERT ON wiki_page FOR EACH ROW BEGIN SELECT wiki_page_sequence.nextval INTO :NEW.id FROM DUAL; END; / ALTER TRIGGER SCHEMANAME.WIKI_PAGE_TRIGGER ENABLE; I did not have this issue with tables created by web2py. Regards, Bill --
Re: [web2py] URL requests always aiming to default controller...
On 16 Oct 2012, at 8:42 AM, apinho jaapi...@sapo.pt wrote: Hi, Yes I have such directory. I can access myapp, but I'm forced to put all my functions inside DEFAULT.PY controller. I was wishing to split my functions across differente controllers, and I just can't understand why I can't. I'm using nginx, with this config : server { listen 80; server_name $hostname; location ~* /(\w+)/static/ { root /home/www-data/web2py/applications/; } location / { uwsgi_pass 127.0.0.1:9001; include uwsgi_params; uwsgi_param UWSGI_SCHEME $scheme; uwsgi_param SERVER_SOFTWAREnginx/$nginx_version; } } server { listen 443; client_max_body_size 20M; server_name $hostname; ssl on; ssl_certificate /etc/nginx/ssl/web2py.crt; ssl_certificate_key /etc/nginx/ssl/web2py.key; location / { uwsgi_pass 127.0.0.1:9001; include uwsgi_params; uwsgi_param UWSGI_SCHEME $scheme; uwsgi_param SERVER_SOFTWAREnginx/$nginx_version; } }' This is a standard config i grabbed from some recipe, since I'm an absolute beginner when it comes to http servers. Do you think something is wrong there ? I don't think so (or if there is, it's not what's causing your problem). Which version of web2py are you using? You might check whether the other standard apps work OK in this respect. On Tuesday, October 16, 2012 4:12:16 PM UTC+1, Jonathan Lundell wrote: On 16 Oct 2012, at 2:27 AM, apinho jaap...@sapo.pt wrote: Using web2py, straight out of the box, no routes.py or such : When i request : https://myserver/myapp/mycontroller/myfunction having /models/models.py : ... default_application = 'myapp' ... and /controllers/mycontroller.py : def myfunction(): # no pasa nada return dict() Web2py answers : invalid function (default/mycontroller) So, he is looking for function mycontroller, inside controller default.py, instead of looking for function myfunction, inside controllermycontroller.py. Why ? What I am missing ? You can't set the default application in your model. It's too late; the routing is already done. But you should still be able to access myapp explicitly. Do you have a directory: applications/myapp with the above models and controller in it? -- --
[web2py] Re: help me test sessions in cookies
did you even try it (or reading the post) before starting bashing around :-P ??? those cookies contains crypted (and signed) data. No user can read the contents. On Tuesday, October 16, 2012 5:59:20 PM UTC+2, VP wrote: I think cookie-based sessions is great for many cases. But in some cases, it might not be desirable as clients can see what might be secret information. Why not both?Maybe, two types of sessions, client-side and server-side sessions. Although both client and server side sessions are meant to maintain states, they are appropriate for different things. --
[web2py] Re: help me test sessions in cookies
Right now you can have or the other. To me it does not make sense to store anything client side if you already have to access a pickle object locally. You only add overhead and risk of exposing data. On Tuesday, 16 October 2012 10:59:20 UTC-5, VP wrote: I think cookie-based sessions is great for many cases. But in some cases, it might not be desirable as clients can see what might be secret information. Why not both?Maybe, two types of sessions, client-side and server-side sessions. Although both client and server side sessions are meant to maintain states, they are appropriate for different things. --
[web2py] Re: help me test sessions in cookies
Java PlayFramework! has this as the only default. Using client side cookie based sessions help create distributed environment easily, as there are no sessions specific to one server node. They use both client side cookies for sessions and caches for keeping serverside data. David Dne úterý, 16. října 2012 18:39:02 UTC+2 Massimo Di Pierro napsal(a): Right now you can have or the other. To me it does not make sense to store anything client side if you already have to access a pickle object locally. You only add overhead and risk of exposing data. On Tuesday, 16 October 2012 10:59:20 UTC-5, VP wrote: I think cookie-based sessions is great for many cases. But in some cases, it might not be desirable as clients can see what might be secret information. Why not both?Maybe, two types of sessions, client-side and server-side sessions. Although both client and server side sessions are meant to maintain states, they are appropriate for different things. --
Re: [web2py] Re: auth.impersonate(0)
Now it's ok - thank you! Regards, Martin 2012/10/16 Massimo Di Pierro massimo.dipie...@gmail.com in trunk On Tuesday, 16 October 2012 10:51:08 UTC-5, Ricardo Pedroso wrote: The fix in trunk worked for me. Martin are you calling impersonate(0) via GET or POST. Now I'm going to guessing mode I guest it is via GET, right? And probably when you call it you were not an impersonator any more. Massimo, maybe it is a condition missing: we have in gluon/tools.py: elif user_id in (0, '0') and self.is_impersonating(): session.clear() session.update(cPickle.loads(**auth.impersonator)) self.user = session.auth.user return None Probably should go something like this: elif user_id in (0, '0'): if self.is_impersonating(): session.clear() session.update(cPickle.loads(**auth.impersonator)) self.user = session.auth.user return None Ricardo On Tue, Oct 16, 2012 at 2:31 PM, Martin Weissenboeck mwei...@gmail.com wrote: Traceback (most recent call last): File H:\...\web2py\gluon\**restricted.py, line 209, in restricted exec ccode in environment File H:/.../web2py/applications/**secure/controllers/default.py**, line 3988, in module File H:\...\web2py\gluon\globals.**py, line 182, in lambda self._caller = lambda f: f () File H:/.../web2py/applications/**secure/controllers/default.py**, line 1932, in impersonateEnd auth.impersonate(0) File H:\...\web2py\gluon\tools.py**, line 2756, in impersonate return SQLFORM(table_user, user.id, readonly=True) UnboundLocalError: local variable 'user' referenced before assignment 2012/10/16 Massimo Di Pierro massimo@gmail.com can you show all traceback? On Tuesday, 16 October 2012 07:18:38 UTC-5, mweissen wrote: Is this the actual trunc-version? Version 2.1.1 (2012-10-16 06:19:35) dev I get the same message type 'exceptions.UnboundLocalError'** local variable 'user' referenced before assignment 2012/10/16 Massimo Di Pierro massimo@gmail.com There is a bug, I just fixed it in trunk. auth.impersonate(0) is correct. On Tuesday, 16 October 2012 04:38:35 UTC-5, mweissen wrote: I have called auth.impersonate(0) to finish impersonation. Now (Version 2.1.1) I see: Traceback (most recent call last): File H:\...\web2py\gluon\**restricted.py, line 209, in restricted exec ccode in environment File H:/.../applications/secure/**controllers/default.py, line 3988, in module File H:\...\web2py\gluon\globals.**py, line 187, in lambda self._caller = lambda f: f() File H:/.../applications/secure/**controllers/default.py, line 1932, in impersonateEnd auth.impersonate(0) File H:\...\web2py\gluon\tools.py**, line 2755, in impersonate return SQLFORM(table_user, user.id, readonly=True) UnboundLocalError: local variable 'user' referenced before assignment My function: def impersonateEnd(): auth.impersonate(0) redirect(URL('index',vars=**dict(flash=T('End of impersonation' What ist the best way to end impersonation? Regards, Martin -- -- --
[web2py] Re: auth.wiki usage - Another Oracle DB Gotcha
On Tuesday, 16 October 2012 11:23:29 UTC-5, Bill Thayer wrote: Note for future searchers people as foolish as I am to try and use Oracle for web site backend. I did not have this issue with tables created by web2py. so why did you create the wiki tables manually? I am missing something. --
[web2py] Re: help me test sessions in cookies
You can do the same in web2py. You can use cache and sessions. The session you can put where you want. What does not make sense to me is put some session data in session files and some in cookies. If you have to have the session files, use them. On Tuesday, 16 October 2012 11:51:59 UTC-5, David Marko wrote: Java PlayFramework! has this as the only default. Using client side cookie based sessions help create distributed environment easily, as there are no sessions specific to one server node. They use both client side cookies for sessions and caches for keeping serverside data. David Dne úterý, 16. října 2012 18:39:02 UTC+2 Massimo Di Pierro napsal(a): Right now you can have or the other. To me it does not make sense to store anything client side if you already have to access a pickle object locally. You only add overhead and risk of exposing data. On Tuesday, 16 October 2012 10:59:20 UTC-5, VP wrote: I think cookie-based sessions is great for many cases. But in some cases, it might not be desirable as clients can see what might be secret information. Why not both?Maybe, two types of sessions, client-side and server-side sessions. Although both client and server side sessions are meant to maintain states, they are appropriate for different things. --
[web2py] Re: Web2Py on OpenShift
Thank you Margaret, I am trying to use the admin (deploy to openshift). My understanding is that you are not using that option for deployment. Do you know any requirements for using admin (deploy to openshift) ? Ashraf On Tuesday, October 16, 2012 5:57:13 PM UTC+3, greaneym wrote: Ashraf, (reposting, as response did not show up on list) This morning I installed a web2py app using the github path to Andrew's v2.0.9 web2py install on openshift and it worked fine. My other app install has been working for months, and it uses v2.0.2. I did receive recently an e-mail from openshift stating that their directory structure has changed. So far it has not affected my install. Just reporting. Margaret --
[web2py] Re: help me test sessions in cookies
On Tuesday, October 16, 2012 11:33:38 AM UTC-5, Niphlod wrote: did you even try it (or reading the post) before starting bashing around :-P ??? those cookies contains crypted (and signed) data. No user can read the contents. It's not meant to be bashing web2py. Massimo said this implementation is like Flask. As such, they are cryptographically signed, but not encrypted. If that is the case, they might be read but not modified. On Tuesday, October 16, 2012 5:59:20 PM UTC+2, VP wrote: I think cookie-based sessions is great for many cases. But in some cases, it might not be desirable as clients can see what might be secret information. Why not both?Maybe, two types of sessions, client-side and server-side sessions. Although both client and server side sessions are meant to maintain states, they are appropriate for different things. --
[web2py] Re: help me test sessions in cookies
On Tuesday, October 16, 2012 11:39:02 AM UTC-5, Massimo Di Pierro wrote: Right now you can have or the other. To me it does not make sense to store anything client side if you already have to access a pickle object locally. You only add overhead and risk of exposing data. I think one advantage of moving session data to the client side is scalability. There ought to be a noticeable difference between 100 processes writing to the same filesytem and these computations moved to the client side. On Tuesday, 16 October 2012 10:59:20 UTC-5, VP wrote: I think cookie-based sessions is great for many cases. But in some cases, it might not be desirable as clients can see what might be secret information. Why not both?Maybe, two types of sessions, client-side and server-side sessions. Although both client and server side sessions are meant to maintain states, they are appropriate for different things. --
[web2py] Re: lock table possible?
i tried to lock table but with error class 'gluon.contrib.pymysql.err.InternalError' (1099, uTable 'publication' was locked with a READ lock and can't be updated) db.executesql('LOCK TABLE publication READ;') result = db(db.publication.id==pubid).select()[0] newlist = result.photo_list newlist.remove(int(pid)) db(db.publication.id==pubid).update(photo_list=newlist) db.executesql('UNLOCK TABLES;') is it possible to use the same connection? On Thursday, October 11, 2012 9:32:14 PM UTC+8, Massimo Di Pierro wrote: You can try: db.executesql('LOCK TABLE tablename READ;') http://aarklondatabasetrivia.blogspot.com/2009/04/how-to-lock-and-unlock-tables-in-mysql.html On Thursday, 11 October 2012 01:44:14 UTC-5, vince wrote: can i lock a table as readonly during the transaction? the case is i need to insert a record to table B which is base on the query result of table A, i would like to lock table A as readonly until i finish the insert. i am using mysql at the moment. i know web2py may not have this feature, what is the best way to use mysql's 'lock table' on web2py? thanks in advance, vince --
Re: [web2py] Re: IS_STRONG and CRYPT
Ok, I confirm that... I had the same problem here the problem can be reproduced by adding this line to a new app : db.auth_user.password.requires = [IS_STRONG(),CRYPT(key=auth.settings.hmac_key)] Below : ## create all tables needed by auth if not custom tables auth.define_tables(username=False, signature=False) HERE Or, by adding IS_STRONG() to my own app. The problem happen only in appadmin when trying to submit change to auth_user without touching the password field. I saw that IS_STRONG() had been patched recently : https://groups.google.com/forum/?fromgroups#!topic/web2py-developers/PukVxwKUCAo But I don't think that this is caused by this change... I try with a web2py 1.99.4 and the problem seems to be present. It may be possible we just don't know how to use IS_STRONG(). :) Richard On Tue, Oct 16, 2012 at 2:15 PM, piero crisci piero.cri...@gmail.comwrote: Here is a test app that have the same problem i described above Il giorno lunedì 15 ottobre 2012 15:54:47 UTC+2, Richard ha scritto: Try to create the app by your self in this case... It is not very difficult... For the auth definition (I mean auth_user, auth_group, etc.). Use the code available in the book. Also, you could maybe post the demo app you create with the wizard here and we can test it in our environnement. Richard On Sun, Oct 14, 2012 at 12:26 PM, piero crisci piero@gmail.comwrote: I made the changes you said, I also test the app with the V. 1.99.7 I also create a new app called TEST with the wizard without add anything else. Once created the new APP i just add this lines to db.py : db.auth_user.password.requires = [IS_STRONG(),CRYPT(key=auth.** settings.hmac_key)] I chose a good password and after i went to this link page to change user info http://127.0.0.1:8000/TEST/**appadmin/update/db/auth_user/1http://127.0.0.1:8000/TEST/appadmin/update/db/auth_user/1 I try the submit and i got the same IS_STRONG controls Error. So with 2 differnts apps 2 different framework version, 2 different db i got the same Controll error. Could it be due to the use of the Wizard App creation?. Thanks for help Il giorno sabato 13 ottobre 2012 16:42:26 UTC+2, Massimo Di Pierro ha scritto: You do not need two decorators: @auth.requires_login() @auth.requires_membership('**ris**orse_umane' or 'admin') auth.requires_membership also requires login. You cannot do @auth.requires_membership('**ris**orse_umane' or 'admin') because that is the same as @auth.requires_membership('**ris**orse_umane') since 'risorse_umane' evaluates to True. There may be something else going on. On Friday, 12 October 2012 10:04:35 UTC-5, piero crisci wrote: I tryed to find others with the same iusse problem without understand how to solve the problems :( I set in the db.py the follow table #### db.define_table('auth_user', Field('username', type='string', label=T('Username')), Field('first_name', type='string', label=T('First Name')), Field('last_name', type='string', label=T('Last Name')), Field('email', type='string', label=T('Email')), Field('password', type='password',length=512, readable=False, label=T('Password')), Field('created_on','datetime',default=request.now, label=T('Created On'),writable=False,readable=**F**alse), Field('modified_on','datetime',default=request.now, label=T('Modified On'),writable=False,readable=**F**alse, update=request.now), Field('registration_key',**defau**lt='', writable=False,readable=False), Field('reset_password_key',**def**ault='', writable=False,readable=False), Field('registration_id',**defaul**t='', writable=False,readable=False), format='%(username)s', migrate=settings.migrate) db.auth_user.first_name.**requir**es = IS_NOT_EMPTY(error_message=** aut**h.messages.is_empty) db.auth_user.last_name.**require**s = IS_NOT_EMPTY(error_message=**aut **h.messages.is_empty) #db.auth_user.password.**require**s = [ IS_STRONG(min=8, number=1,special=1,error_**messa**ge = La password deve contenere almeno 8 Caratteri, un Numero, un Carattere Speciale, un carattere Maiuscolo), CRYPT(key=auth.settings.hmac_**k**ey)] db.auth_user.password.**requires**= [*IS_STRONG(min=8), CRYPT(auth.settings.hmac_key)*] db.auth_user.username.requires = IS_NOT_IN_DB(db, db.auth_user.username, error_message = 'Username già censita') db.auth_user.email.requires = (IS_EMAIL(error_message=auth.**m** essages.invalid_email), IS_NOT_IN_DB(db, db.auth_user.email,error_**messa**ge = 'Email già censita')) auth.define_tables(migrate = settings.migrate) I set in the default.py this def for manage the user changes . @auth.requires_login() @auth.requires_membership('**ris**orse_umane' or 'admin') def
[web2py] Re: lock table possible?
forget it. it's weird that read lock for mysql is read only, i have to obtain write lock. it seems not possible to block write access only. On Wednesday, October 17, 2012 2:55:49 AM UTC+8, vince wrote: i tried to lock table but with error class 'gluon.contrib.pymysql.err.InternalError' (1099, uTable 'publication' was locked with a READ lock and can't be updated) db.executesql('LOCK TABLE publication READ;') result = db(db.publication.id==pubid).select()[0] newlist = result.photo_list newlist.remove(int(pid)) db(db.publication.id==pubid).update(photo_list=newlist) db.executesql('UNLOCK TABLES;') is it possible to use the same connection? On Thursday, October 11, 2012 9:32:14 PM UTC+8, Massimo Di Pierro wrote: You can try: db.executesql('LOCK TABLE tablename READ;') http://aarklondatabasetrivia.blogspot.com/2009/04/how-to-lock-and-unlock-tables-in-mysql.html On Thursday, 11 October 2012 01:44:14 UTC-5, vince wrote: can i lock a table as readonly during the transaction? the case is i need to insert a record to table B which is base on the query result of table A, i would like to lock table A as readonly until i finish the insert. i am using mysql at the moment. i know web2py may not have this feature, what is the best way to use mysql's 'lock table' on web2py? thanks in advance, vince --
[web2py] Re: lock table possible?
Disclaimer: I may be wrong Reading your example code, you are updating a single record. If done in a single request, web2py wraps all commands in a transaction. In your code, that means that when you want to remove from photolist an item of your publication row, that operation is atomic. Why are you requesting that no other publication can be updated on that single request ? On Tuesday, October 16, 2012 9:06:08 PM UTC+2, vince wrote: forget it. it's weird that read lock for mysql is read only, i have to obtain write lock. it seems not possible to block write access only. On Wednesday, October 17, 2012 2:55:49 AM UTC+8, vince wrote: i tried to lock table but with error class 'gluon.contrib.pymysql.err.InternalError' (1099, uTable 'publication' was locked with a READ lock and can't be updated) db.executesql('LOCK TABLE publication READ;') result = db(db.publication.id==pubid).select()[0] newlist = result.photo_list newlist.remove(int(pid)) db(db.publication.id==pubid).update(photo_list=newlist) db.executesql('UNLOCK TABLES;') is it possible to use the same connection? On Thursday, October 11, 2012 9:32:14 PM UTC+8, Massimo Di Pierro wrote: You can try: db.executesql('LOCK TABLE tablename READ;') http://aarklondatabasetrivia.blogspot.com/2009/04/how-to-lock-and-unlock-tables-in-mysql.html On Thursday, 11 October 2012 01:44:14 UTC-5, vince wrote: can i lock a table as readonly during the transaction? the case is i need to insert a record to table B which is base on the query result of table A, i would like to lock table A as readonly until i finish the insert. i am using mysql at the moment. i know web2py may not have this feature, what is the best way to use mysql's 'lock table' on web2py? thanks in advance, vince --
[web2py] Re: help me test sessions in cookies
On Tuesday, October 16, 2012 7:42:41 PM UTC+2, VP wrote: It's not meant to be bashing web2py. Massimo said this implementation is like Flask. As such, they are cryptographically signed, but not encrypted. If that is the case, they might be read but not modified. yes, but specified that are encrypted too ;-) --
Re: [web2py] restful api post works great localy, but getting login redirect on a remote server
Could I please ask someone with Apache/mod_wsgi to test this code? Everything works fine on a local rocket webserver, and also on nginx, but for some reason when it runs on Apache returns Not authorized. I just can't figure out where exactly is the problem. Same Apache server runs several web2py applications perfectly fine. db=DAL() from gluon.tools import Auth auth = Auth(db).define_tables(username=True) if db(db.auth_user).isempty(): auth.get_or_create_user(dict( username='mdp', email='a...@b.com', password=db.auth_user.password.validate('test')[0])) response.generic_patterns = ['*'] auth.settings.allow_basic_login = True @request.restful() @auth.requires_login() def demo(): def GET(): return dict(hello='world') return locals() Call: curl --user mdp:test http://127.0.0.1:8000/test3/default/demo.json Does this work for you? Thanks, Adnan On Thursday, October 11, 2012 6:00:30 PM UTC-4, Adi wrote: Thanks Massimo for looking into this. ticket opened: http://code.google.com/p/web2py/issues/detail?id=1080thanks=1080ts=1349992678 On Thu, Oct 11, 2012 at 5:05 PM, Massimo Di Pierro wrote: Please open a ticket about this and I will look in detail asap. On Thursday, 11 October 2012 09:44:04 UTC-5, Adi wrote: Tried 2.09 nightly build on a completely different (redhat) server and still getting redirect, while post works as expected on a local rocket. Any hint where to look for a problem please? using: curl --user webserv...@domain.com:pass -d FirstName=Tim5LastName=Jsonhttp ://crm.domain.com/api/**customer.jsonhttp://crm.domain.com/api/customer.json You are being redirected a href=/crm/default/user/login?** _next=/crm/webservices/api/**customer.json Thanks, Adnan On Wed, Oct 10, 2012 at 10:46 AM, Adi wrote: This is an example from book, where authentication and posting into database work good on a local server. Once I moved the code to production redhat linux server, where we have routes.py as bellow all I get as result is a login redirect: You are being redirected a href=/user/login?_next=/** webservices/api/customer.json%**3FFirstName%3DTim5%26LastName%**3DJson here/a If I remove authentication (@auth.requires_login() and @auth.requires_permission('**insert customer through webservice')) on production server, records are inserted properly. Tried adding default and webservices controllers into application specific routes.py, but it didn't help. Any suggestions what should I do? Thanks, Adnan tried in both, default.py and webservices.py controllers: auth.settings.allow_basic_**login = True @auth.requires_login() @auth.requires_permission('**insert customer through webservice') @request.restful() def api(): response.view = 'generic.'+request.extension def GET(*args,**vars): patterns = [ /members[customer], /member_fn/{customer.**FirstName.startswith}, /member_ln/{customer.**LastName.startswith}, /member/{customer.FirstName}/**:field, /member/{customer.FirstName}/**orders[customer_order.** customer_id], /member/{customer.FirstName}/** order[customer_order.customer_**id]/{customer_order.id}, /member/{customer.FirstName}/** order[customer_order.customer_**id]/{customer_order.id}/:**field ] parser = db.parse_as_rest(patterns,args**,vars) if parser.status == 200: return dict(content=parser.response) else: raise HTTP(parser.status,parser.erro**r) def POST(table_name,**vars): if table_name == 'customer': return db.customer.validate_and_**insert(**vars) elif table_name == 'customer_order': return db.customer_order.validate_**and_insert(**vars) else: raise HTTP(400) return locals() web2py folder: routes.py routers = dict( # base router BASE = dict( default_application = 'welcome', domains = {'crm.domain.com': 'crm' } ), ) crm app folder: routes.py (deleted) Terminal test: asm21:~ adnan$ curl --user webserv...@domain.com:pass -d FirstName=Tim5LastName=Json http://crm.domain.com/api/** customer.json http://crm.domain.com/api/customer.json Result: You are being redirected a href=/user/login?_next=/api/** customer.json%3FFirstName%**3DTim5%26LastName%3DJsonhere**/a asm21:~ adnan$ curl --user webserv...@domain.com:pass -d FirstName=Tim5LastName=Json http://crm.domain.com/webservi**ces/api/ customer.json Result: You are being redirected a href=/user/login?_next=/** webservices/api/customer.json%**3FFirstName%3DTim5%26LastName%**3DJson here/a -- --
[web2py] Re: help me test sessions in cookies
On Tuesday, October 16, 2012 7:46:16 PM UTC+2, VP wrote: I think one advantage of moving session data to the client side is scalability. There ought to be a noticeable difference between 100 processes writing to the same filesytem and these computations moved to the client side. yep, you save the filesystem for accesses, but the time taken serializing/deserializing remains the same, plus there's encryption/decryption and the time took to send extra bytes back and forth server and client. There's no computation moved to the client side. Anyway, it's another option you can use with web2py, and as always, to be chosen with a grain of salt. --
[web2py] Re: help me test sessions in cookies
I'd go for this if the session is small and does not contain critical information. So it is good to have this option. marți, 16 octombrie 2012, 22:27:01 UTC+3, Niphlod a scris: On Tuesday, October 16, 2012 7:46:16 PM UTC+2, VP wrote: I think one advantage of moving session data to the client side is scalability. There ought to be a noticeable difference between 100 processes writing to the same filesytem and these computations moved to the client side. yep, you save the filesystem for accesses, but the time taken serializing/deserializing remains the same, plus there's encryption/decryption and the time took to send extra bytes back and forth server and client. There's no computation moved to the client side. Anyway, it's another option you can use with web2py, and as always, to be chosen with a grain of salt. --
[web2py] Re: help me test sessions in cookies
goes always in exception, and the bug is that the IV key must be 16 bytes. secure_dumps is padding the key to 32 (correct) but using key as well for the IV argument. On Tuesday, October 16, 2012 1:24:00 PM UTC+2, Massimo Di Pierro wrote: This is new in trunk and needs to be tested. Add this to your app: session.connect(cookie_key='mypassphrase') and sessions will be stored in cookies (like Flask does). Cookies are encrypted with AES 32bites and signed with HMAC+SHA1. --
[web2py] Re: auth.wiki usage - Another Oracle DB Gotcha
About 6 days ago I posted my saga of failed attempts to get plugin_wiki to work with oracle and to add the blob field. You told me to put return auth.wiki() in my controller and use the built in auth wiki but I needed a bit more information and Oracle was still complaining. Alan told me to add auth.wiki(resolve=False) to my db.py file. Which eventually worked. But by that time the tables were created. Looks like it's working as expected, even storing and retrieving the data with a blob field. So far so good except when I click on the search link for the wiki (/default/index/_search) I did get this error that I haven't yet dug into very deeply but here it is: Traceback (most recent call last): File C:\web2py_src_2.1.1\web2py\gluon\restricted.py, line 209, inrestricted exec ccode in environment File C:/web2py_src_2.1.1/web2py/applications/TAMOTO/controllers/default.pyhttp://127.0.0.1:8000/admin/default/edit/TAMOTO/controllers/default.py , line 240, in module File C:\web2py_src_2.1.1\web2py\gluon\globals.py, line 187, in lambda self._caller = lambda f: f() File C:/web2py_src_2.1.1/web2py/applications/TAMOTO/controllers/default.pyhttp://127.0.0.1:8000/admin/default/edit/TAMOTO/controllers/default.py , line 20, in index return auth.wiki() File C:\web2py_src_2.1.1\web2py\gluon\tools.py, line 3227, in wiki return self._wiki.read(slug)['content'] if slug else self._wiki() File C:\web2py_src_2.1.1\web2py\gluon\tools.py, line 4705, in __call__ return self.search() File C:\web2py_src_2.1.1\web2py\gluon\tools.py, line 4990, in search content.append(self.cloud()['content']) File C:\web2py_src_2.1.1\web2py\gluon\tools.py, line 5001, in cloud orderby = ~count, limitby=(0,20)) File C:\web2py_src_2.1.1\web2py\gluon\dal.py, line 8790, in select return adapter.select(self.query,fields,attributes) File C:\web2py_src_2.1.1\web2py\gluon\dal.py, line 1615, in select return self._select_aux(sql,fields,attributes) File C:\web2py_src_2.1.1\web2py\gluon\dal.py, line 1580, in _select_aux self.execute(sql) File C:\web2py_src_2.1.1\web2py\gluon\dal.py, line 2856, in execute return self.log_execute(command, args) File C:\web2py_src_2.1.1\web2py\gluon\dal.py, line 1687, in log_execute ret = self.cursor.execute(*a, **b) DatabaseError: ORA-00904: WIKI_TAG.WIKI_PAGE: invalid identifier On Tuesday, October 16, 2012 12:20:30 PM UTC-5, Massimo Di Pierro wrote: On Tuesday, 16 October 2012 11:23:29 UTC-5, Bill Thayer wrote: Note for future searchers people as foolish as I am to try and use Oracle for web site backend. I did not have this issue with tables created by web2py. so why did you create the wiki tables manually? I am missing something. --
[web2py] HELP - type 'exceptions.TypeError'('Set' object is not iterable)
HI All, I am up against the wall as far as time is concerned, I have promised I will get the images for his updated products on his site by end of play today and this is the first time I have used web2py to automate most of the process. I am getting this error type 'exceptions.TypeError'('Set' object is not iterable) Here is the offending piece of code. query3 = cmdb(cmdb.executesql(select image.id_product, image.id_image, product.reference from image join product on product.id_product = image.id_product)) for row in query3: image_list_file.write(row.id_product + , + row.id_image + , +row .reference + \n) and here is the full Traceback TRACEBACK 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Traceback (most recent call last): File /home/simon/web2py/gluon/restricted.py, line 205, in restricted exec ccode in environment File /home/simon/web2py/applications/update_vitaldb/controllers/vital.py http://localhost:8000/admin/default/edit/update_vitaldb/controllers/vital.py, line 133, in module File /home/simon/web2py/gluon/globals.py, line 173, in lambda self._caller = lambda f: f() File /home/simon/web2py/applications/update_vitaldb/controllers/vital.py http://localhost:8000/admin/default/edit/update_vitaldb/controllers/vital.py, line 130, in image_database_prep for row in query3: TypeError: 'Set' object is not iterable Any help would be much appreciated. Thanks Simon --
[web2py] Query with postgres
Dear all, I've just switched from sqlite to postgres, and now I have problems with few queries. One query that works correctly on sqlite and fails on postgres is the following: s=db.club.created_on.year() | db.club.created_on.month() | db.club.created_on.day() count = db.club.id.count() dates = db(query).select(db.club.created_on,count,orderby=~db.club.created_on, limitby=limitby, groupby=s) Now on postgres, it raises the following error: ProgrammingError: column club.created_on must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT club.created_on, COUNT(club.id) FROM club WHERE (((c... I read online that the fields in the select must be on the groupby as well. The problem is that by grouping even by club.created_on (by adding groupby=s | club.created_on) the result is totally different. What can I do to tackle this problem? Best, Paolo --
[web2py] Re: HELP - type 'exceptions.TypeError'('Set' object is not iterable)
did you try printing query3 before starting the for loop ? On Tuesday, October 16, 2012 10:51:28 PM UTC+2, Simon Carr wrote: HI All, I am up against the wall as far as time is concerned, I have promised I will get the images for his updated products on his site by end of play today and this is the first time I have used web2py to automate most of the process. I am getting this error type 'exceptions.TypeError'('Set' object is not iterable) Here is the offending piece of code. query3 = cmdb(cmdb.executesql(select image.id_product, image.id_image, product.reference from image join product on product.id_product = image.id_product)) for row in query3: image_list_file.write(row.id_product + , + row.id_image + , +row .reference + \n) and here is the full Traceback TRACEBACK 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Traceback (most recent call last): File /home/simon/web2py/gluon/restricted.py, line 205, in restricted exec ccode in environment File /home/simon/web2py/applications/update_vitaldb/controllers/vital.py http://localhost:8000/admin/default/edit/update_vitaldb/controllers/vital.py, line 133, in module File /home/simon/web2py/gluon/globals.py, line 173, in lambda self._caller = lambda f: f() File /home/simon/web2py/applications/update_vitaldb/controllers/vital.py http://localhost:8000/admin/default/edit/update_vitaldb/controllers/vital.py, line 130, in image_database_prep for row in query3: TypeError: 'Set' object is not iterable Any help would be much appreciated. Thanks Simon --
[web2py] Re: HELP - type 'exceptions.TypeError'('Set' object is not iterable)
whoops, gotcha. syntax for executesql is rows = db.executesql(), not rows = db(db.executesql()) :-P now, go back hitting the wall :P --
[web2py] Re: HELP - type 'exceptions.TypeError'('Set' object is not iterable)
Many Many Thanks, I owe you a beer. Simon On Tuesday, 16 October 2012 22:09:46 UTC+1, Niphlod wrote: whoops, gotcha. syntax for executesql is rows = db.executesql(), not rows = db(db.executesql()) :-P now, go back hitting the wall :P --
Re: [web2py] [FYI] Pyodel is now a plugin
Hi Alan. I went through the registration process, got the Google sign in. Signed in with google too and then did not get re-directed back. -Bill On Wednesday, September 12, 2012 11:49:47 AM UTC-5, Alan Etkin wrote: El miércoles, 12 de septiembre de 2012 12:19:02 UTC-3, Tito Garrido escribió: Hey Alan, I was about to test it but it requested access to my google account, is it expected? The Google account login activates if you register with an active google user session. For now you can avoid the extra authentication by closing your google user session before registration. Anyway, clicking the ... google account gives you normal access to the app too. --
[web2py] Re: help me test sessions in cookies
and confirmed, you can store a limited amount of data, after that the session remains the same (~a dict with 80 keys , 10 chars length both for keys and values) to reproduce: import string def test(): key = session.counter or 0 session['counter'] = key + 1 session[key] = string.letters return dict(counter=session.counter, s=session) at the 28th requests nothing goes on. Even worse for logged-in users: at the 18 request the cookie is full. Even worse (if possible) if you hit the page 20 times, than try to login nothing happens, because it's full yet. So, if you use session cookies, don't even imagine storing something in that (other than VERY small fragments) On Tuesday, October 16, 2012 10:30:59 PM UTC+2, Niphlod wrote: goes always in exception, and the bug is that the IV key must be 16 bytes. secure_dumps is padding the key to 32 (correct) but using key as well for the IV argument. On Tuesday, October 16, 2012 1:24:00 PM UTC+2, Massimo Di Pierro wrote: This is new in trunk and needs to be tested. Add this to your app: session.connect(cookie_key='mypassphrase') and sessions will be stored in cookies (like Flask does). Cookies are encrypted with AES 32bites and signed with HMAC+SHA1. --
[web2py] Re: help me test sessions in cookies
If web2py actually encrypt sessions, that will take quite some time, and saving/retrieving sessions can be computing intensive. I think session data signed and not encrypted is the way to go. With respect to scalability, the computation here is the saving to the filesystem. This is the burden to move from the server to the client with cookie-based session. As I said, imagine you have 100 users active, the difference will be accessing the local filesystem for 100 of them, versus none (when you move this burden to the client). On Tuesday, October 16, 2012 2:27:01 PM UTC-5, Niphlod wrote: On Tuesday, October 16, 2012 7:46:16 PM UTC+2, VP wrote: I think one advantage of moving session data to the client side is scalability. There ought to be a noticeable difference between 100 processes writing to the same filesytem and these computations moved to the client side. yep, you save the filesystem for accesses, but the time taken serializing/deserializing remains the same, plus there's encryption/decryption and the time took to send extra bytes back and forth server and client. There's no computation moved to the client side. Anyway, it's another option you can use with web2py, and as always, to be chosen with a grain of salt. --
[web2py] What are these odd menu dots from the auth.wiki menu?
https://lh3.googleusercontent.com/-6ZrkWiYpzU8/UH3T2J1J9II/ACo/bdZfoL-xDfg/s1600/funnymenu.png --
[web2py] Re: restful api post works great localy, but getting login redirect on a remote server
If this is of any help, I tried tracing basic login in tools.py, and figured out variable basic never gets value from current.request.env.http_authorization, so username and password never get passed through. On the local server, that value gets populated and basic login works as expected... If anyone can share any advice where else to look for a problem, please do. Sorry for going crazy here :) tools.py def basic(self): perform basic login. reads current.request.env.http_authorization and returns basic_allowed,basic_accepted,user if not self.settings.allow_basic_login: return (False,False,False) basic = current.request.env.http_authorization if not basic or not basic[:6].lower() == 'basic ': return (True, False, False) (username, password) = base64.b64decode(basic[6:]).split(':') return (True, True, self.login_bare(username, password)) On Wednesday, October 10, 2012 10:46:54 AM UTC-4, Adi wrote: This is an example from book, where authentication and posting into database work good on a local server. Once I moved the code to production redhat linux server, where we have routes.py as bellow all I get as result is a login redirect: You are being redirected a href= /user/login?_next=/webservices/api/customer.json%3FFirstName%3DTim5%26LastName%3DJson here/a If I remove authentication (@auth.requires_login() and @auth.requires_permission('insert customer through webservice')) on production server, records are inserted properly. Tried adding default and webservices controllers into application specific routes.py, but it didn't help. Any suggestions what should I do? Thanks, Adnan tried in both, default.py and webservices.py controllers: auth.settings.allow_basic_login = True @auth.requires_login() @auth.requires_permission('insert customer through webservice') @request.restful() def api(): response.view = 'generic.'+request.extension def GET(*args,**vars): patterns = [ /members[customer], /member_fn/{customer.FirstName.startswith}, /member_ln/{customer.LastName.startswith}, /member/{customer.FirstName}/:field, /member/{customer.FirstName}/orders[customer_order.customer_id], /member/{customer.FirstName}/order[customer_order.customer_id]/{ customer_order.id}, /member/{customer.FirstName}/order[customer_order.customer_id]/{ customer_order.id}/:field ] parser = db.parse_as_rest(patterns,args,vars) if parser.status == 200: return dict(content=parser.response) else: raise HTTP(parser.status,parser.error) def POST(table_name,**vars): if table_name == 'customer': return db.customer.validate_and_insert(**vars) elif table_name == 'customer_order': return db.customer_order.validate_and_insert(**vars) else: raise HTTP(400) return locals() web2py folder: routes.py routers = dict( # base router BASE = dict( default_application = 'welcome', domains = {'crm.domain.com': 'crm' } ), ) crm app folder: routes.py (deleted) Terminal test: asm21:~ adnan$ curl --user webserv...@domain.com:pass -d FirstName=Tim5LastName=Json http://crm.domain.com/api/customer.json Result: You are being redirected a href= /user/login?_next=/api/customer.json%3FFirstName%3DTim5%26LastName%3DJson here/a asm21:~ adnan$ curl --user webserv...@domain.com:pass -d FirstName=Tim5LastName=Json http://crm.domain.com/webservices/api/ customer.json Result: You are being redirected a href= /user/login?_next=/webservices/api/customer.json%3FFirstName%3DTim5%26LastName%3DJson here/a --
[web2py] Re: Web2Py on OpenShift
Hi Ashraf, I don't understand what you mean by using admin deploy to openshift, but no, I've just used the rhc commands to create the python gear as described in the openshift guide, then used Andrew's scripts to install web2py. But that does create an admin interface accessible via https and using that you can modify the install. Or you can modify the install by using ssh to your account and using git to pull files. Maybe others who have installed on openshift can help. Margaret On Tuesday, October 16, 2012 12:31:32 PM UTC-5, apps in tables wrote: Thank you Margaret, I am trying to use the admin (deploy to openshift). My understanding is that you are not using that option for deployment. Do you know any requirements for using admin (deploy to openshift) ? Ashraf On Tuesday, October 16, 2012 5:57:13 PM UTC+3, greaneym wrote: Ashraf, (reposting, as response did not show up on list) This morning I installed a web2py app using the github path to Andrew's v2.0.9 web2py install on openshift and it worked fine. My other app install has been working for months, and it uses v2.0.2. I did receive recently an e-mail from openshift stating that their directory structure has changed. So far it has not affected my install. Just reporting. Margaret --
[web2py] Re: AWS Elastic Beanstalk installation Recipe
Hi Massimo Big fans of web2py here in CST. We would look at using Red Hat, Openshift, but we have to host in Europe. I think one of the problems is web2py is so easy to set up on ubuntu, eb uses Amazon Linux so I am probably struggling with stuff I never ad to worry about. Best Regardws Michael --
[web2py] Re: return user defined xml in web2py
Hi Niphlod, xmlwitch was able to print the xml but couldn't return from an method. I got issues : *TypeError: __repr__ returned non-string (type instance)* --
[web2py] access a configuration file into web2py
Hi, I have a configuration file. I wanted to use ConfigObj library to access the configuration file. I have placed the file inside the controller and tried accessing it like: cfg=ConfigObj(conf.ini) It didnt read the file. But when i gave it like this: cfg=ConfObj(/home/deepak/web2py/applications/depyweb/controller/conf.ini) it worked!.. What is the issue with this? --
[web2py] return user defined xml
Hi, 1. How do i return user defined xml data from web2py? 2. I tried using xmlwitch along web2py but i get error : error on line 1 at column 26: Specification mandate value for attribute instance Need some help... - Deepak --
[web2py] Re: IS_STRONG and CRYPT
Can you please open a ticket about this? On Friday, 12 October 2012 10:04:35 UTC-5, piero crisci wrote: I tryed to find others with the same iusse problem without understand how to solve the problems :( I set in the db.py the follow table db.define_table('auth_user', Field('username', type='string', label=T('Username')), Field('first_name', type='string', label=T('First Name')), Field('last_name', type='string', label=T('Last Name')), Field('email', type='string', label=T('Email')), Field('password', type='password',length=512, readable=False, label=T('Password')), Field('created_on','datetime',default=request.now, label=T('Created On'),writable=False,readable=False), Field('modified_on','datetime',default=request.now, label=T('Modified On'),writable=False,readable=False, update=request.now), Field('registration_key',default='', writable=False,readable=False), Field('reset_password_key',default='', writable=False,readable=False), Field('registration_id',default='', writable=False,readable=False), format='%(username)s', migrate=settings.migrate) db.auth_user.first_name.requires = IS_NOT_EMPTY(error_message=auth.messages.is_empty) db.auth_user.last_name.requires = IS_NOT_EMPTY(error_message=auth.messages.is_empty) #db.auth_user.password.requires = [ IS_STRONG(min=8, number=1,special=1,error_message = La password deve contenere almeno 8 Caratteri, un Numero, un Carattere Speciale, un carattere Maiuscolo), CRYPT(key=auth.settings.hmac_key)] db.auth_user.password.requires= [*IS_STRONG(min=8), CRYPT(auth.settings.hmac_key)*] db.auth_user.username.requires = IS_NOT_IN_DB(db, db.auth_user.username, error_message = 'Username già censita') db.auth_user.email.requires = (IS_EMAIL(error_message=auth.messages.invalid_email), IS_NOT_IN_DB(db, db.auth_user.email,error_message = 'Email già censita')) auth.define_tables(migrate = settings.migrate) I set in the default.py this def for manage the user changes . @auth.requires_login() @auth.requires_membership('risorse_umane' or 'admin') def anagrafica_utenti_db_manage(): form = SQLFORM.smartgrid(db.auth_user,onupdate=auth.archive) return locals() When i try to modify the name or the surname the framework rise the IS_STRONG control even if i don't touch the password string. I am new with web2py and i want just to know if i need to create a form to make the user changes or i can fix this problem using the smartgrid. I also set the Requires approval for the new registration. How can i delete the Pending in the registration key ? (I can t do it right now because of the IS_STRONG control. Thanks for help And sorry for bother you --
[web2py] Re: What are these odd menu dots from the auth.wiki menu?
Oops. Never seen them before. What;s the browser? Which web2py version? Anybody else sees them? On Tuesday, 16 October 2012 16:39:47 UTC-5, Bill Thayer wrote: https://lh3.googleusercontent.com/-6ZrkWiYpzU8/UH3T2J1J9II/ACo/bdZfoL-xDfg/s1600/funnymenu.png --
[web2py] Re: Web2Py on OpenShift
*Hi Margaret,* * I don't understand what you mean by using admin deploy to openshift.* I mean local admin, as in http://127.0.0.1:8000/admin/default/site , it has a button called deploy to openshift. Since your way is working fine, I will try yours...) You have a good one. Last question: Do i have to use git? ( i did not use git before) Ashraf On Wednesday, October 17, 2012 12:56:59 AM UTC+3, greaneym wrote: Hi Ashraf, I don't understand what you mean by using admin deploy to openshift, but no, I've just used the rhc commands to create the python gear as described in the openshift guide, then used Andrew's scripts to install web2py. But that does create an admin interface accessible via https and using that you can modify the install. Or you can modify the install by using ssh to your account and using git to pull files. Maybe others who have installed on openshift can help. Margaret On Tuesday, October 16, 2012 12:31:32 PM UTC-5, apps in tables wrote: Thank you Margaret, I am trying to use the admin (deploy to openshift). My understanding is that you are not using that option for deployment. Do you know any requirements for using admin (deploy to openshift) ? Ashraf On Tuesday, October 16, 2012 5:57:13 PM UTC+3, greaneym wrote: Ashraf, (reposting, as response did not show up on list) This morning I installed a web2py app using the github path to Andrew's v2.0.9 web2py install on openshift and it worked fine. My other app install has been working for months, and it uses v2.0.2. I did receive recently an e-mail from openshift stating that their directory structure has changed. So far it has not affected my install. Just reporting. Margaret --
[web2py] Re: help me test sessions in cookies
@all: you should test it before all. Storing session in cookies is achieved with scalability in mind. It's quite a buzzword on these days, but things to consider are a lot. Really, a lot. One thing is saying that sharing a single filesystem among 100 machines (scalability) is more intensive than storing sessions in cookies. We all agree on that. There are pound, Haproxy and nginx upstreams for speeding that out (i.e. sending requests coming from an ip to the same machine, thus eliminating the need for a shared filesystem). They are something else to set, and you'll likely need to eliminate the Single Point Of Failure clustering them. There are recipes for that but the poor developer prefer to manage things on his webframework of choice (web2py, yeah!). A very different other is saying having 100 processes scanning the local filesystem for sessions, in which case I can assure you it's pretty fast (managed to run only 80 of those on my rig :-P). You must also take into consideration the speed between sending in/out the standard cookie and the one containing data (larger). In large scale deployment this means you must consider the limit of your users bandwith. Waiting for data in (longer cookie) is wait time, just as it is waiting for seek on a filesystem. Which is faster? I'd not bet against filesystem. Storing sessions in memcache or redis is even probably faster (for high number of session files in the same folder), if the instance is local. If the instance is not on the local network, I'd say choice is session file with pound, haproxy and Co. Don't forget even the option of storing session on db (not sqlite), if local, some speed improvement over a high number of session files in filesystem is noticeable (but again, we are talking about scalability, so it's unlikely you'll have a local db). Bailing out large scale deployments, recent tests showed on a normal piece of hardware that until ~40K sessions files, storing them on redis (localhost) or filesystem doesn't affect response times. With higher number of session files, filesystem starts to show its limits because it takes more time just to scan the index of the folder (mitigated with separate=True). BTW, encrypting and decrypting (on the worst case scenario, 4KB of data) takes 4,7 seconds for 1 million iterations. I'd definitely use encryption no matter what if designing a large scale deployment, with no redis or memcache around. Summing up, I'd choose this path only if the large scale deployment involve more than one geographical location of servers. --
[web2py] Re: help me test sessions in cookies
If encryption is an issue, maybe it should be optional. @Nihplod, your posts are very helpful (not just this one) :) Thanks for your efforts. --
[web2py] Re: Basic question about CSS / Web2py !
word warp is exactly what I was hoping to do in the label declaration ! .. and Yes .. thank you Anthony, I was not sure ! .. you are right ! .. I had to try before I asked ! thanks weheh .. and thank you Niphlod .. you hit it right on the nail ! thank you every one it is very much appreciated ! --
[web2py] Problem with adding Grids in book
The section Adding Grids refers to using appadmin to create a group manager, but I can't find anything in appadmin that allows that. Could someone give me a clue. It seems that something is missing here. --
[web2py] Returning just variables
Hello, I was wondering if web2py controllers could adapt returning just variables. Either as single variable or python implicit tuple. def index(): return images,stories They would implicitly be getting the same dict keys. But I often find it redundant to do it. I know that if I return a variable it returns that plain text but I wondering if anybody is using it this way? --
[web2py] Re: help me test sessions in cookies
On Wednesday, October 17, 2012 12:53:33 AM UTC+2, Marin Pranjić wrote: If encryption is an issue, maybe it should be optional. ehm, 4.7 sec on worst case scenario for 1M repetitions on a single machine means wasting 0,0047 ms per request. Fast responses averages to ~20ms, so again, worst case scenario (fast response, big encryption/decryption), 0,0235% time wasted. Is it Really a problem (capital R) ? @Nihplod, your posts are very helpful (not just this one) :) Thanks for your efforts. I tend to watch the situation from my experience, I'm more a dba and an IT administrator than a developer, so the POV is different from the majority of users here (developers). Maybe real tests are really a pain for developers ? :P --
[web2py] Auth Wiki functionality?
Hello everyone, Thanks to Allen, Villas, of course Massimo among a few others I have web2py auth.wiki with Oracle storing the media blobs and all the pages. I believe I can use the wiki features in a structure way to improv productivity and cross department functionality in my workplace. Now what in the heck to do with it? The app wizard created a bunch of controllers like @auth.requires_login() def part_manage(): form = SQLFORM.smartgrid(db.part) return locals() but if I add @{component:default/part_manage} to my markmin I get a page with my SQLFORM.smartgrid inside a page so I get two footers and two headers. Not to mention the add and edit pages should really be a wiki page with my table attributes added. Looks like auth-wiki is for creating web pages but what caught my attention was the media and tagging capability built in so I don't have to write my own app to do what's already there. However, I have a bunch of tables (parts, sub parts, orders, samples, testing, analyses for tested samples, etc...) defined for my application and basically 75% of the items have attachments, images, files, user references and tags too. Unless someone says different I guess I should be adding a wiki_page column to all of my tables? Then create separate edit/show/create controllers that generate the proper...slug...and return a wiki page? That shouldn't break my relationships I don't think. Just kind of wondering if there's already a know technique for my application that you know of? Regards, Bill --
[web2py] Re: Problem with adding Grids in book
Hello Mike, I'm not an expert but i think you need to go to http://127.0.0.1:8000/myapp/appadmin/index then click on the auth user table and add a user, then go to the groups table table and create a manager then go to the membership table and make your new user a manager then go to the permissions table and make 3 entries: permission = Create group=manager; permission = read group=manager; permission = update group=manager, This is a quick answer on my way out the door hope it helped. -Bill On Tuesday, October 16, 2012 6:33:19 PM UTC-5, mikech wrote: The section Adding Grids refers to using appadmin to create a group manager, but I can't find anything in appadmin that allows that. Could someone give me a clue. It seems that something is missing here. --
[web2py] Re: Returning just variables
nothing shorter than this def s(*args, **kwargs): rtn = {} for a in args: rtn[a] = kwargs['l'].get(a) return rtn def test(): images = 'a' stories = 'b' l = locals() return s('images','stories', l=l) PS: there's no way to retrieve name of variables from statements like return images, values, because they are evaluated. Namedtuple are the most minimal structures allowing that, but code to create a new namedtuple is several characters longer (and you're basically asking for less characters ^_^) On Wednesday, October 17, 2012 1:34:26 AM UTC+2, Marek Mollin wrote: Hello, I was wondering if web2py controllers could adapt returning just variables. Either as single variable or python implicit tuple. def index(): return images,stories They would implicitly be getting the same dict keys. But I often find it redundant to do it (return dict(images=images, stories=stories)) yet I do not want return all the local variables . I know that if I return a variable it returns that plain text but I wondering if anybody is using it this way? --
[web2py] Re: Web2Py on OpenShift
Ashraf, I posted twice to your answer but don't see it on the list. Maybe the answers went directly to you. margaret On Tuesday, October 16, 2012 5:35:04 PM UTC-5, apps in tables wrote: *Hi Margaret,* * I don't understand what you mean by using admin deploy to openshift.* I mean local admin, as in http://127.0.0.1:8000/admin/default/site , it has a button called deploy to openshift. Since your way is working fine, I will try yours...) You have a good one. Last question: Do i have to use git? ( i did not use git before) Ashraf On Wednesday, October 17, 2012 12:56:59 AM UTC+3, greaneym wrote: Hi Ashraf, I don't understand what you mean by using admin deploy to openshift, but no, I've just used the rhc commands to create the python gear as described in the openshift guide, then used Andrew's scripts to install web2py. But that does create an admin interface accessible via https and using that you can modify the install. Or you can modify the install by using ssh to your account and using git to pull files. Maybe others who have installed on openshift can help. Margaret On Tuesday, October 16, 2012 12:31:32 PM UTC-5, apps in tables wrote: Thank you Margaret, I am trying to use the admin (deploy to openshift). My understanding is that you are not using that option for deployment. Do you know any requirements for using admin (deploy to openshift) ? Ashraf On Tuesday, October 16, 2012 5:57:13 PM UTC+3, greaneym wrote: Ashraf, (reposting, as response did not show up on list) This morning I installed a web2py app using the github path to Andrew's v2.0.9 web2py install on openshift and it worked fine. My other app install has been working for months, and it uses v2.0.2. I did receive recently an e-mail from openshift stating that their directory structure has changed. So far it has not affected my install. Just reporting. Margaret --
[web2py] Re: Web2Py on OpenShift
unfortunatelynope On Wednesday, October 17, 2012 4:02:33 AM UTC+3, greaneym wrote: Ashraf, I posted twice to your answer but don't see it on the list. Maybe the answers went directly to you. margaret On Tuesday, October 16, 2012 5:35:04 PM UTC-5, apps in tables wrote: *Hi Margaret,* * I don't understand what you mean by using admin deploy to openshift.* I mean local admin, as in http://127.0.0.1:8000/admin/default/site , it has a button called deploy to openshift. Since your way is working fine, I will try yours...) You have a good one. Last question: Do i have to use git? ( i did not use git before) Ashraf On Wednesday, October 17, 2012 12:56:59 AM UTC+3, greaneym wrote: Hi Ashraf, I don't understand what you mean by using admin deploy to openshift, but no, I've just used the rhc commands to create the python gear as described in the openshift guide, then used Andrew's scripts to install web2py. But that does create an admin interface accessible via https and using that you can modify the install. Or you can modify the install by using ssh to your account and using git to pull files. Maybe others who have installed on openshift can help. Margaret On Tuesday, October 16, 2012 12:31:32 PM UTC-5, apps in tables wrote: Thank you Margaret, I am trying to use the admin (deploy to openshift). My understanding is that you are not using that option for deployment. Do you know any requirements for using admin (deploy to openshift) ? Ashraf On Tuesday, October 16, 2012 5:57:13 PM UTC+3, greaneym wrote: Ashraf, (reposting, as response did not show up on list) This morning I installed a web2py app using the github path to Andrew's v2.0.9 web2py install on openshift and it worked fine. My other app install has been working for months, and it uses v2.0.2. I did receive recently an e-mail from openshift stating that their directory structure has changed. So far it has not affected my install. Just reporting. Margaret --
[web2py] Re: Web2Py on OpenShift
Git was easy to install (on a mac) using this link, https://help.github.com/articles/set-up-git You need git to keep a copy of your repository somewhere else besides on the openshift server. and the only change after that was to the parameters_xxx.py file which one uses to access the admin page. You will need to read this page to see how to set that up. https://github.com/prelegalwonder/openshift_web2py/issues/6 That was the only change to the install. It will hopefully help you to know this before you do the install. Margaret On Tuesday, October 16, 2012 8:07:01 PM UTC-5, apps in tables wrote: unfortunatelynope On Wednesday, October 17, 2012 4:02:33 AM UTC+3, greaneym wrote: Ashraf, I posted twice to your answer but don't see it on the list. Maybe the answers went directly to you. margaret On Tuesday, October 16, 2012 5:35:04 PM UTC-5, apps in tables wrote: *Hi Margaret,* * I don't understand what you mean by using admin deploy to openshift.* I mean local admin, as in http://127.0.0.1:8000/admin/default/site , it has a button called deploy to openshift. Since your way is working fine, I will try yours...) You have a good one. Last question: Do i have to use git? ( i did not use git before) Ashraf On Wednesday, October 17, 2012 12:56:59 AM UTC+3, greaneym wrote: Hi Ashraf, I don't understand what you mean by using admin deploy to openshift, but no, I've just used the rhc commands to create the python gear as described in the openshift guide, then used Andrew's scripts to install web2py. But that does create an admin interface accessible via https and using that you can modify the install. Or you can modify the install by using ssh to your account and using git to pull files. Maybe others who have installed on openshift can help. Margaret On Tuesday, October 16, 2012 12:31:32 PM UTC-5, apps in tables wrote: Thank you Margaret, I am trying to use the admin (deploy to openshift). My understanding is that you are not using that option for deployment. Do you know any requirements for using admin (deploy to openshift) ? Ashraf On Tuesday, October 16, 2012 5:57:13 PM UTC+3, greaneym wrote: Ashraf, (reposting, as response did not show up on list) This morning I installed a web2py app using the github path to Andrew's v2.0.9 web2py install on openshift and it worked fine. My other app install has been working for months, and it uses v2.0.2. I did receive recently an e-mail from openshift stating that their directory structure has changed. So far it has not affected my install. Just reporting. Margaret --
[web2py] Re: Web2Py on OpenShift
Thank you ...for being so supportive. On Wednesday, October 17, 2012 4:21:43 AM UTC+3, greaneym wrote: Git was easy to install (on a mac) using this link, https://help.github.com/articles/set-up-git You need git to keep a copy of your repository somewhere else besides on the openshift server. and the only change after that was to the parameters_xxx.py file which one uses to access the admin page. You will need to read this page to see how to set that up. https://github.com/prelegalwonder/openshift_web2py/issues/6 That was the only change to the install. It will hopefully help you to know this before you do the install. Margaret On Tuesday, October 16, 2012 8:07:01 PM UTC-5, apps in tables wrote: unfortunatelynope On Wednesday, October 17, 2012 4:02:33 AM UTC+3, greaneym wrote: Ashraf, I posted twice to your answer but don't see it on the list. Maybe the answers went directly to you. margaret On Tuesday, October 16, 2012 5:35:04 PM UTC-5, apps in tables wrote: *Hi Margaret,* * I don't understand what you mean by using admin deploy to openshift.* I mean local admin, as in http://127.0.0.1:8000/admin/default/site , it has a button called deploy to openshift. Since your way is working fine, I will try yours...) You have a good one. Last question: Do i have to use git? ( i did not use git before) Ashraf On Wednesday, October 17, 2012 12:56:59 AM UTC+3, greaneym wrote: Hi Ashraf, I don't understand what you mean by using admin deploy to openshift, but no, I've just used the rhc commands to create the python gear as described in the openshift guide, then used Andrew's scripts to install web2py. But that does create an admin interface accessible via https and using that you can modify the install. Or you can modify the install by using ssh to your account and using git to pull files. Maybe others who have installed on openshift can help. Margaret On Tuesday, October 16, 2012 12:31:32 PM UTC-5, apps in tables wrote: Thank you Margaret, I am trying to use the admin (deploy to openshift). My understanding is that you are not using that option for deployment. Do you know any requirements for using admin (deploy to openshift) ? Ashraf On Tuesday, October 16, 2012 5:57:13 PM UTC+3, greaneym wrote: Ashraf, (reposting, as response did not show up on list) This morning I installed a web2py app using the github path to Andrew's v2.0.9 web2py install on openshift and it worked fine. My other app install has been working for months, and it uses v2.0.2. I did receive recently an e-mail from openshift stating that their directory structure has changed. So far it has not affected my install. Just reporting. Margaret --
[web2py] Re: help me test sessions in cookies
On Tuesday, 16 October 2012 17:39:36 UTC-5, Niphlod wrote: BTW, encrypting and decrypting (on the worst case scenario, 4KB of data) takes 4,7 seconds for 1 million iterations. I'd definitely use encryption no matter what if designing a large scale deployment, +1 sessions in cookies without encryption are not an option. --
[web2py] Re: Auth Wiki functionality?
Try: @{component:default/part_manage.load} Or customize the part_manage.html to not {{extend 'layout.html'}} On Tuesday, 16 October 2012 19:20:35 UTC-5, Bill Thayer wrote: Hello everyone, Thanks to Allen, Villas, of course Massimo among a few others I have web2py auth.wiki with Oracle storing the media blobs and all the pages. I believe I can use the wiki features in a structure way to improv productivity and cross department functionality in my workplace. Now what in the heck to do with it? The app wizard created a bunch of controllers like @auth.requires_login() def part_manage(): form = SQLFORM.smartgrid(db.part) return locals() but if I add @{component:default/part_manage} to my markmin I get a page with my SQLFORM.smartgrid inside a page so I get two footers and two headers. Not to mention the add and edit pages should really be a wiki page with my table attributes added. Looks like auth-wiki is for creating web pages but what caught my attention was the media and tagging capability built in so I don't have to write my own app to do what's already there. However, I have a bunch of tables (parts, sub parts, orders, samples, testing, analyses for tested samples, etc...) defined for my application and basically 75% of the items have attachments, images, files, user references and tags too. Unless someone says different I guess I should be adding a wiki_page column to all of my tables? Then create separate edit/show/create controllers that generate the proper...slug...and return a wiki page? That shouldn't break my relationships I don't think. Just kind of wondering if there's already a know technique for my application that you know of? Regards, Bill --
[web2py] Re: Query with postgres
I don't know how it possibly worked in sqlite, but this is an aggregate query combined with a non-aggregate query. In other words, the count is a property of an aggregation of rows in the database, whereas created_on is a property of individual rows. This confuses Postgres. It doesn't know if you want the aggregate result (count) or the result for individual rows (created_on). It cannot deliver both from the same query. What are you trying to find out in your query? On Tuesday, October 16, 2012 4:59:36 PM UTC-4, Paolo wrote: Dear all, I've just switched from sqlite to postgres, and now I have problems with few queries. One query that works correctly on sqlite and fails on postgres is the following: s=db.club.created_on.year() | db.club.created_on.month() | db.club.created_on.day() count = db.club.id.count() dates = db(query).select(db.club.created_on,count,orderby=~db.club.created_on, limitby=limitby, groupby=s) Now on postgres, it raises the following error: ProgrammingError: column club.created_on must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT club.created_on, COUNT(club.id) FROM club WHERE (((c... I read online that the fields in the select must be on the groupby as well. The problem is that by grouping even by club.created_on (by adding groupby=s | club.created_on) the result is totally different. What can I do to tackle this problem? Best, Paolo --
[web2py] Odd behavior with domain routes. Can't undo them.
I set up my Webfaction hosting with a single web2py install that I intend to use for a couple of subdomains pointing to separate apps using routes.py. I pointed domain.com and blog.domain.com to my web2py app and through routes.py told web2py to point blog.domain.com to my blog app that I plan on writing. Right now it's just a default scaffolding app. Here is the code in my routes.py file: routers = dict( BASE = dict( domains = { 'blog.domain.com' : 'blog', } ) ) So... this worked great, until I tried to undo it for some troubleshooting purposes. I commented out all the code in routes.py. blog.domain.com still points to my blog app instead of my default web2py app (currently Welcome). I renamed routes.py, blog.domain.com still points to the blog app. I thought maybe this was some new default behavior where if a subdomain is used with the same name as an app it will point to the app. I made a new app and a subdomain of the same name and pointed it to my web2py app. This one points to the default Welcome app as expected. So what is the deal here? Is there some cache of routes.py that I need to clear to return a domain route back to default? --
[web2py] web2py/gluon/compileapp.py throwing ticket
I'm getting the following ticket after upgrading from web2py 1.99.x to 2.1.1 source: Traceback (most recent call last): File N:\web2py\gluon\restricted.py, line 209, in restricted exec ccode in environment File N:\web2py\applications\myapp\views\mycontroller/index.html, line 444, in module jQuery('#image-form').ajaxForm({ File N:\web2py\gluon\compileapp.py, line 136, in LOAD from html import TAG, DIV, URL, SCRIPT, XML ImportError: cannot import name TAG --