[web2py] Re: Python job oportunity
On Dec 31, 12:23 am, GoldenTiger goldenboy...@gmail.com wrote: Who needs the key for only a few chars?? ;) Cool!
[web2py] bug with multi-form input component
I have a multi-table multi-form input that I've componentized. As a stand-alone component, it's various sub-forms workthe fine. But when I load the component into the rest of the app, it fails to upload a file in one of the sub-forms. It gives the standard enter a valid filename error, as if there were no file. I traced it thru eclipse and the sub-form vars are empty after submit. I could be doing something stupid, but it seems like a bug.
[web2py] Re: bug with multi-form input component
It happened to me also.
[web2py] GAE shows error
Once again my application runs fine on supplied server with web2py but on GAE there's a problem. Line of code that shows problem is *candidate =db(db.words.word.lower()==trans_form.vars.word.lower())(db.words.lang==trans_form.vars.languages).select().first() * where trans_form is a FORM object. table : *db.define_table('words', * * Field('word', 'string', length=128, notnull=True, required=True), * *Field('lang', db.languages, notnull=True), * *Field('entry_by', db.auth_user, default=auth.user_id, readable=False, writable=False), * * migrate=migration)* Error shown, when runs over GAE: ERROR2002-01-01 05:48:44,608 restricted.py:151] Traceback (most recent call last): File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/restricted.py, line 188, in restricted exec ccode in environment File /media/KRA/Evolve/Work/web/google_appengine/VL/applications/init/controllers/forms.py:addtranslation, line 90, in module File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/globals.py, line 95, in lambda self._caller = lambda f: f() *File /media/KRA/Evolve/Work/web/google_appengine/VL/applications/init/controllers/forms.py:addtranslation, line 31, in addtranslation* File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 4499, in select return self.db._adapter.select(self.query,fields,attributes) File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 2673, in select (items, tablename, fields) = self.select_raw(query,fields,attributes) File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 2633, in select_raw filters = self.expand(query) File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 2544, in expand return expression.op(expression.first, expression.second) File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 2558, in AND a = self.expand(first) File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 2544, in expand return expression.op(expression.first, expression.second) File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 2565, in EQ return [GAEF(first.name,'=',self.represent(second,first.type),lambda a,b:a==b)] *AttributeError: 'Expression' object has no attribute 'name'* *Where I went wrong?*
[web2py] Re: GAE shows error
I'm using Version 1.91.5 (2010-12-28 21:52:10)
[web2py] Legacy table
Hello, I have a legacy database, and want to access it with web2py. One table is called another_name in the database (mysql). But I want to use it in web2py as: db.define_table('person', Field('name')) I read docs, but could not figure this out Thanks for any help... Marcello
[web2py] Using EditArea Full on front-end
Hey everyone, I know web2py comes with the EditArea on the administration section; I was wondering how would I be able to use that on the front end of the website in a textarea? I don't think installing another instance of it would be necessary, would it? Thanks~.
[web2py] Re: web2py Turnkey Linux Appliance (collaborator needed)
Thanks Chris, I've got the patch worked out for the most part. (incidentally to patching eden). Just incorporating Massimo's suggestions and blueprint, then getting together the first run script to set the password are my remaining concerns. On Dec 31, 1:47 am, Christopher Steel chris.st...@gmail.com wrote: Hi Rik, Turnkey looks interesting... You can get a working Web2py / Turnkey system up and running fairly quickly using the vanilla Turnkey installation and then running a slightly modified version of the setup-we2py-ubuntu.sh script on the same system. This will allow you to break down the task into pieces and you can slowly convert the bash script to Python rather than taking on the entire task in one fell swoop in addition to getting a working system along the way. setup-we2py-ubuntu.sh could be modified or run manually in some places where sudo is used. So for example near the end of the script instead of: sudo -u www-data python -c from gluon.widget import console; console(); and sudo -u www-data python -c from gluon.main import save_password; save_password(raw_input('admin password: '),443)u you could become the www-data user with su www-data change to /home/www-data/web2py and then run the commands: python -c from gluon.widget import console; console(); and python -c from gluon.main import save_password; save_password(raw_input('admin password: '),443) echo done! In the mean time I am going to try it myself... looks like fun. Cheers, Chris On Dec 30, 10:36 am, ghoulmann rikgold...@gmail.com wrote: However, I don't know Python well enough produce the script. I also don't know where web2py wants passwords kept or whether there's hashing involved. So given example scripts for other appliances, is there anyone willing to collaborate - either write the script for incorporation, or if it has to be the case, mentor me so I can produce the script with my students? This blog post and the subsequent thread explains and provides examples:http://www.turnkeylinux.org/blog/end-to-default-passwords I look forward to working together on this contribution to web2py and TurnKey Linux. Rik Goldman
[web2py] Translation problem
Hi, I want to translate my web page to German. The T()operator is very fine, but I could not find any way to translate message like enter an integer less than or equal to %(max)g in class IS_INT_IN_RANGE. I think it is very unprofessional to mix English and German words and I have tried to find a solution. I have changed the following lines (file validators.py, class IS_INT_IN_RANGE) def __init__( self, minimum=None, maximum=None, error_message=None, *T=lambda x:x,* ): self.minimum = self.maximum = None if minimum is None: if maximum is None: if error_message is None: self.error_message = *T('enter an integer')* else: self.maximum = int(maximum) if error_message is None: error_message = *T('enter an integer less than or equal to %(max)g')* self.error_message = error_message % dict(max=self.maximum-1) elif maximum is None: self.minimum = int(minimum) if error_message is None: error_message = *T('enter an integer greater than or equal to %(min)g')* self.error_message = error_message % dict(min=self.minimum) else: self.minimum = int(minimum) self.maximum = int(maximum) if error_message is None: error_message = *T('enter an integer between %(min)g and %(max)g')* self.error_message = error_message % dict(min=self.minimum, max=self.maximum-1) And I have used it: Field('number', type='integer', requires=IS_INT_IN_RANGE(2,5,*T=T*), label=T('number')), It's full compatible. Are there any disadvantages in my solution? Or is there any other solution? Of course the whole file validators.py has to be changed. Maybe the file tools.py too? Is it possible to use this proposal in the next release? Regards, Martin
[web2py] Re: web2py Turnkey Linux Appliance (collaborator needed)
Does anyone here use Fabric? I'm going to take a look in the next few days.
[web2py] Re: gql broken in latest version (1.91.4) ?
GAE recently (well a few months ago now) added a namespace feature to Big Table. I too am interested in having each web2py app run in its own namespace, but not yet been motivated to try and add that in. i suspect that what you want to do is find where the GQL gets assembled and perhaps use the app name as the namespace. cfh
Re: [web2py] Re: web2py Turnkey Linux Appliance (collaborator needed)
On Dec 30, 2010, at 10:47 PM, Christopher Steel wrote: you could become the www-data user with su www-data change to /home/www-data/web2py and then run the commands: python -c from gluon.widget import console; console(); and python -c from gluon.main import save_password; save_password(raw_input('admin password: '),443) echo done! In the mean time I am going to try it myself... looks like fun. I keep forgetting you can reach inside and do this stuff. Yes, the second command, at least, works very nicely. I don't quite follow what the console() run is intended to do, though. The script could use one or two more comments.
Re: [web2py] Translation problem
On Dec 31, 2010, at 6:18 AM, Martin Weissenboeck wrote: I want to translate my web page to German. The T()operator is very fine, but I could not find any way to translate message like enter an integer less than or equal to %(max)g in class IS_INT_IN_RANGE. I think it is very unprofessional to mix English and German words and I have tried to find a solution. Am I correct that you had to make the translation entries manually (because the T() search doesn't look in gluon)? I assume that the current logic was written with the intention of passing in error_message=T(something); does that work too? I wonder whether there isn't a general solution that would let us use T() in gluon code that's invoked by applications. I have changed the following lines (file validators.py, class IS_INT_IN_RANGE) def __init__( self, minimum=None, maximum=None, error_message=None, T=lambda x:x, ): self.minimum = self.maximum = None if minimum is None: if maximum is None: if error_message is None: self.error_message = T('enter an integer') else: self.maximum = int(maximum) if error_message is None: error_message = T('enter an integer less than or equal to %(max)g') self.error_message = error_message % dict(max=self.maximum-1) elif maximum is None: self.minimum = int(minimum) if error_message is None: error_message = T('enter an integer greater than or equal to %(min)g') self.error_message = error_message % dict(min=self.minimum) else: self.minimum = int(minimum) self.maximum = int(maximum) if error_message is None: error_message = T('enter an integer between %(min)g and %(max)g') self.error_message = error_message % dict(min=self.minimum, max=self.maximum-1) And I have used it: Field('number', type='integer', requires=IS_INT_IN_RANGE(2,5,T=T), label=T('number')), It's full compatible. Are there any disadvantages in my solution? Or is there any other solution? Of course the whole file validators.py has to be changed. Maybe the file tools.py too? Is it possible to use this proposal in the next release?
[web2py] Re: Translation problem
The problem is that those messages are defined internally in the validator and can not be set via error_message. An easy solution would be to wrap them in a T call but that results in: NameError: global name 'T' is not defined, line 188, in restricted So the question is why T can not be part of the environment variable when it is available at the model level. On Dec 31, 11:26 am, Jonathan Lundell jlund...@pobox.com wrote: On Dec 31, 2010, at 6:18 AM, Martin Weissenboeck wrote: I want to translate my web page to German. The T()operator is very fine, but I could not find any way to translate message like enter an integer less than or equal to %(max)g in class IS_INT_IN_RANGE. I think it is very unprofessional to mix English and German words and I have tried to find a solution. Am I correct that you had to make the translation entries manually (because the T() search doesn't look in gluon)? I assume that the current logic was written with the intention of passing in error_message=T(something); does that work too? I wonder whether there isn't a general solution that would let us use T() in gluon code that's invoked by applications. I have changed the following lines (file validators.py, class IS_INT_IN_RANGE)
[web2py] Re: Legacy table
Hi Marcello. if your table has an auto-increment integer field you can do: db.define_table('another_name',Field('the-auto-inc-field','id'), ...) if not then sorry, no one has contributed the keyed table support for mysql, see: http://web2py.com/book/default/chapter/06#Legacy-Databases-and-Keyed-Tables Denes On Dec 31, 8:17 am, Marcello Parra parro...@gmail.com wrote: Hello, I have a legacy database, and want to access it with web2py. One table is called another_name in the database (mysql). But I want to use it in web2py as: db.define_table('person', Field('name')) I read docs, but could not figure this out Thanks for any help... Marcello
[web2py] Re: GAE shows error
GAE does not allow this query: db.words.word.lower()==trans_form.vars.word.lower() In SQL this would be ... WHERE LOWER(words.word) = ' value of trans_form.vars.word.lower() ' but GAE has no LOWER. On Dec 31, 4:54 am, Arun K.Rajeevan the1.a...@gmail.com wrote: Once again my application runs fine on supplied server with web2py but on GAE there's a problem. Line of code that shows problem is *candidate =db(db.words.word.lower()==trans_form.vars.word.lower())(db.words.lang==trans_form.vars.languages).select().first() * where trans_form is a FORM object. table : *db.define_table('words', * * Field('word', 'string', length=128, notnull=True, required=True), * * Field('lang', db.languages, notnull=True), * * Field('entry_by', db.auth_user, default=auth.user_id, readable=False, writable=False), * * migrate=migration)* Error shown, when runs over GAE: ERROR 2002-01-01 05:48:44,608 restricted.py:151] Traceback (most recent call last): File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/restricted.py, line 188, in restricted exec ccode in environment File /media/KRA/Evolve/Work/web/google_appengine/VL/applications/init/controllers/forms.py:addtranslation, line 90, in module File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/globals.py, line 95, in lambda self._caller = lambda f: f() *File /media/KRA/Evolve/Work/web/google_appengine/VL/applications/init/controllers/forms.py:addtranslation, line 31, in addtranslation* File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 4499, in select return self.db._adapter.select(self.query,fields,attributes) File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 2673, in select (items, tablename, fields) = self.select_raw(query,fields,attributes) File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 2633, in select_raw filters = self.expand(query) File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 2544, in expand return expression.op(expression.first, expression.second) File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 2558, in AND a = self.expand(first) File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 2544, in expand return expression.op(expression.first, expression.second) File /media/KRA/Evolve/Work/web/google_appengine/VL/gluon/dal.py, line 2565, in EQ return [GAEF(first.name,'=',self.represent(second,first.type),lambda a,b:a==b)] *AttributeError: 'Expression' object has no attribute 'name'* *Where I went wrong?*
[web2py] Re: Using EditArea Full on front-end
No but you would have to copy /admin/static/editarea into /yourapp/ static/editarea On Dec 31, 7:52 am, Hybride mshybr...@gmail.com wrote: Hey everyone, I know web2py comes with the EditArea on the administration section; I was wondering how would I be able to use that on the front end of the website in a textarea? I don't think installing another instance of it would be necessary, would it? Thanks~.
Re: [web2py] Re: Translation problem
On Dec 31, 2010, at 8:54 AM, DenesL wrote: The problem is that those messages are defined internally in the validator and can not be set via error_message. Actually, they can, except that there's a bug for the first one, 'enter an integer' that needs to be fixed. An easy solution would be to wrap them in a T call but that results in: NameError: global name 'T' is not defined, line 188, in restricted So the question is why T can not be part of the environment variable when it is available at the model level. Perhaps because validators.py gets compiled without T being defined? I'm a little fuzzy on the whole subject, and would appreciate some clarification. On Dec 31, 11:26 am, Jonathan Lundell jlund...@pobox.com wrote: On Dec 31, 2010, at 6:18 AM, Martin Weissenboeck wrote: I want to translate my web page to German. The T()operator is very fine, but I could not find any way to translate message like enter an integer less than or equal to %(max)g in class IS_INT_IN_RANGE. I think it is very unprofessional to mix English and German words and I have tried to find a solution. Am I correct that you had to make the translation entries manually (because the T() search doesn't look in gluon)? I assume that the current logic was written with the intention of passing in error_message=T(something); does that work too? I wonder whether there isn't a general solution that would let us use T() in gluon code that's invoked by applications. I have changed the following lines (file validators.py, class IS_INT_IN_RANGE)
[web2py] Re: gql broken in latest version (1.91.4) ?
Try this in trunk: db=DAL('gae://mynamespace') On Dec 31, 9:58 am, howesc how...@umich.edu wrote: GAE recently (well a few months ago now) added a namespace feature to Big Table. I too am interested in having each web2py app run in its own namespace, but not yet been motivated to try and add that in. i suspect that what you want to do is find where the GQL gets assembled and perhaps use the app name as the namespace. cfh
[web2py] Re: Legacy table
Thanks Danes, But this is not the problem. The table has an ID. The problem is that I can't rename the table, and it's name is another_name And I want to do something like: db.product.insert(name=Box) Thanks, Marcello On Dec 31, 3:03 pm, DenesL denes1...@yahoo.ca wrote: Hi Marcello. if your table has an auto-increment integer field you can do: db.define_table('another_name',Field('the-auto-inc-field','id'), ...) if not then sorry, no one has contributed the keyed table support for mysql, see:http://web2py.com/book/default/chapter/06#Legacy-Databases-and-Keyed-... Denes On Dec 31, 8:17 am, Marcello Parra parro...@gmail.com wrote: Hello, I have a legacy database, and want to access it with web2py. One table is called another_name in the database (mysql). But I want to use it in web2py as: db.define_table('person', Field('name')) I read docs, but could not figure this out Thanks for any help... Marcello
[web2py] Re: Translation problem
This is a complex issue. I have been experimenting with turning request, response, session, cache and T in thread local singletons. This will fixed a lot of the problem and would allow to create modules that use those variables without having to pass the explicitly. The issues are: - will this make web2py slower (of faster?) - will this break something? massimo On Dec 31, 10:54 am, DenesL denes1...@yahoo.ca wrote: The problem is that those messages are defined internally in the validator and can not be set via error_message. An easy solution would be to wrap them in a T call but that results in: NameError: global name 'T' is not defined, line 188, in restricted So the question is why T can not be part of the environment variable when it is available at the model level. On Dec 31, 11:26 am, Jonathan Lundell jlund...@pobox.com wrote: On Dec 31, 2010, at 6:18 AM, Martin Weissenboeck wrote: I want to translate my web page to German. The T()operator is very fine, but I could not find any way to translate message like enter an integer less than or equal to %(max)g in class IS_INT_IN_RANGE. I think it is very unprofessional to mix English and German words and I have tried to find a solution. Am I correct that you had to make the translation entries manually (because the T() search doesn't look in gluon)? I assume that the current logic was written with the intention of passing in error_message=T(something); does that work too? I wonder whether there isn't a general solution that would let us use T() in gluon code that's invoked by applications. I have changed the following lines (file validators.py, class IS_INT_IN_RANGE)
[web2py] Re: Translation problem
On Dec 31, 12:23 pm, Jonathan Lundell jlund...@pobox.com wrote: On Dec 31, 2010, at 8:54 AM, DenesL wrote: The problem is that those messages are defined internally in the validator and can not be set via error_message. Actually, they can, except that there's a bug for the first one, 'enter an integer' that needs to be fixed. Those messages are set by IF statements inside the validator where they are not accessible to the developer, and they should be translatable. How would you define error_message to handle the four different cases?. An easy solution would be to wrap them in a T call but that results in: NameError: global name 'T' is not defined, line 188, in restricted So the question is why T can not be part of the environment variable when it is available at the model level. Perhaps because validators.py gets compiled without T being defined? I'm a little fuzzy on the whole subject, and would appreciate some clarification.
[web2py] Re: GAE shows error
never mind, I got it working, by modifying candidate =db(db.words.word.lower()==trans_form.vars.word.lower())(db.words.lang==trans_form.vars.languages).select().first() to candidate = db(db.words.lang==trans_form.vars.languages).select().find(lambda x:x.word.lower()==trans_form.vars.word.lower()).first() I opened this discussion because (If I remember it correctly), I didn't got candidate = db(db.words.word.lower()==trans_form.vars.word.lower()).select().find(lambda x:x.lang==trans_form.vars.languages).first() to working in the first place. (note find is changed)
[web2py] Re: Legacy table
You don't have to rename the table. You can use db.another_name.insert(name=Box) On Dec 31, 12:39 pm, Marcello parro...@gmail.com wrote: Thanks Danes, But this is not the problem. The table has an ID. The problem is that I can't rename the table, and it's name is another_name And I want to do something like: db.product.insert(name=Box) Thanks, Marcello On Dec 31, 3:03 pm, DenesL denes1...@yahoo.ca wrote: Hi Marcello. if your table has an auto-increment integer field you can do: db.define_table('another_name',Field('the-auto-inc-field','id'), ...) if not then sorry, no one has contributed the keyed table support for mysql, see:http://web2py.com/book/default/chapter/06#Legacy-Databases-and-Keyed-... Denes On Dec 31, 8:17 am, Marcello Parra parro...@gmail.com wrote: Hello, I have a legacy database, and want to access it with web2py. One table is called another_name in the database (mysql). But I want to use it in web2py as: db.define_table('person', Field('name')) I read docs, but could not figure this out Thanks for any help... Marcello
Re: [web2py] eclipse: getting it to ignore db
Add to your list... if 0: from gluon.dal import DAL db = DAL() -- Thadeus On Thu, Dec 30, 2010 at 4:46 AM, weheh richard_gor...@verizon.net wrote: I'm trying to get eclipse to ignore undefined var: db using the if 0: import gluon from ... import ... trick, but I'm not sure where db is coming from?
Re: [web2py] Re: Translation problem
On Dec 31, 2010, at 9:44 AM, DenesL wrote: On Dec 31, 12:23 pm, Jonathan Lundell jlund...@pobox.com wrote: On Dec 31, 2010, at 8:54 AM, DenesL wrote: = The problem is that those messages are defined internally in the validator and can not be set via error_message. Actually, they can, except that there's a bug for the first one, 'enter an integer' that needs to be fixed. Those messages are set by IF statements inside the validator where they are not accessible to the developer, and they should be translatable. How would you define error_message to handle the four different cases?. You don't need to. For any given instantiation, only one of the error messages is relevant (it's a static function of min max). An easy solution would be to wrap them in a T call but that results in: NameError: global name 'T' is not defined, line 188, in restricted So the question is why T can not be part of the environment variable when it is available at the model level. Perhaps because validators.py gets compiled without T being defined? I'm a little fuzzy on the whole subject, and would appreciate some clarification.
Re: [web2py] Re: Web2Py Foundation?
That leaves taxes which aren't a factor here :-)
Re: [web2py] Re: Translation problem
On Dec 31, 2010, at 9:43 AM, mdipierro wrote: This is a complex issue. I have been experimenting with turning request, response, session, cache and T in thread local singletons. This will fixed a lot of the problem and would allow to create modules that use those variables without having to pass the explicitly. The issues are: - will this make web2py slower (of faster?) - will this break something? It'll break application threads, but you've convinced me that they're a bad thing. Can you explain to us what's happening now? Why, when a validator is called from a model, it doesn't see T? massimo On Dec 31, 10:54 am, DenesL denes1...@yahoo.ca wrote: The problem is that those messages are defined internally in the validator and can not be set via error_message. An easy solution would be to wrap them in a T call but that results in: NameError: global name 'T' is not defined, line 188, in restricted So the question is why T can not be part of the environment variable when it is available at the model level. On Dec 31, 11:26 am, Jonathan Lundell jlund...@pobox.com wrote: On Dec 31, 2010, at 6:18 AM, Martin Weissenboeck wrote: I want to translate my web page to German. The T()operator is very fine, but I could not find any way to translate message like enter an integer less than or equal to %(max)g in class IS_INT_IN_RANGE. I think it is very unprofessional to mix English and German words and I have tried to find a solution. Am I correct that you had to make the translation entries manually (because the T() search doesn't look in gluon)? I assume that the current logic was written with the intention of passing in error_message=T(something); does that work too? I wonder whether there isn't a general solution that would let us use T() in gluon code that's invoked by applications. I have changed the following lines (file validators.py, class IS_INT_IN_RANGE)
[web2py] comet for web2py (give it a try) - and happy new year
Should be self explanatory: http://code.google.com/p/web2py/source/browse/scripts/comet_messaging.py
[web2py] Re: comet for web2py (give it a try) - and happy new year
Sorry Mistake: http://code.google.com/p/web2py/source/browse/gluon/contrib/comet_messaging.py On Dec 31, 1:14 pm, mdipierro mdipie...@cs.depaul.edu wrote: Should be self explanatory: http://code.google.com/p/web2py/source/browse/scripts/comet_messaging.py
Re: [web2py] Translation problem
No, I did not not want to translate these sentences *manually*. The error_message=T(..) does not work, because there are some if-statements inside the class IS_INT_IN_RANGE (and in some other classes). One solution could be a list of error messages for these classes. My proposal uses T as an addition parameter of the __init__ methode of class IS_INT_IN_RANGE (and all other classes) in validators.py and therefore there is not compatiblity problem. I can use everything as before and the translation method (T-search) works with every internal error_message. This usage of T has another advantage: Currenty error_messages are defined twice: - 1st inside validators.py, e.g.: def __init__(self, expression, error_message='invalid expression'): ... self.error_message = error_message - 2nd on using the class, e.g. a=IS_MATCH(...,error_message=T('invalid expression') I think, this is against the rule *Don't repeat yourself* With an additional T-parameter these lines could be written as follows: - 1st inside validators.py, e.g.: def __init__(self, expression, error_message='invalid expression', T=lambda x:x): ... self.error_message = T(error_message) - 2nd on using the class, e.g. a=IS_MATCH(...,T=T) # if you like the default message Now the default error message appears only once, but could be changed by the user. But I don't know whether this will slow down web2py. 2010/12/31 Jonathan Lundell jlund...@pobox.com On Dec 31, 2010, at 6:18 AM, Martin Weissenboeck wrote: I want to translate my web page to German. The T()operator is very fine, but I could not find any way to translate message like enter an integer less than or equal to %(max)g in class IS_INT_IN_RANGE. I think it is very unprofessional to mix English and German words and I have tried to find a solution. Am I correct that you had to make the translation entries manually (because the T() search doesn't look in gluon)? I assume that the current logic was written with the intention of passing in error_message=T(something); does that work too? I wonder whether there isn't a general solution that would let us use T() in gluon code that's invoked by applications. I have changed the following lines (file validators.py, class IS_INT_IN_RANGE) def __init__( self, minimum=None, maximum=None, error_message=None, *T=lambda x:x,* ): self.minimum = self.maximum = None if minimum is None: if maximum is None: if error_message is None: self.error_message = *T('enter an integer')* else: self.maximum = int(maximum) if error_message is None: error_message = *T('enter an integer less than or equal to %(max)g')* self.error_message = error_message % dict(max=self.maximum-1) elif maximum is None: self.minimum = int(minimum) if error_message is None: error_message = *T('enter an integer greater than or equal to %(min)g')* self.error_message = error_message % dict(min=self.minimum) else: self.minimum = int(minimum) self.maximum = int(maximum) if error_message is None: error_message = *T('enter an integer between %(min)g and %(max)g')* self.error_message = error_message % dict(min=self.minimum, max=self.maximum-1) And I have used it: Field('number', type='integer', requires=IS_INT_IN_RANGE(2,5,*T=T*), label=T('number')), It's full compatible. Are there any disadvantages in my solution? Or is there any other solution? Of course the whole file validators.py has to be changed. Maybe the file tools.py too? Is it possible to use this proposal in the next release? -- 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: comet for web2py (give it a try) - and happy new year
... and this requires the latest web2py_ajax.html from welcome in trunk else it does not work. Please give it a try, I have not tested it that much! Massimo On Dec 31, 1:19 pm, mdipierro mdipie...@cs.depaul.edu wrote: Sorry Mistake: http://code.google.com/p/web2py/source/browse/gluon/contrib/comet_mes... On Dec 31, 1:14 pm, mdipierro mdipie...@cs.depaul.edu wrote: Should be self explanatory: http://code.google.com/p/web2py/source/browse/scripts/comet_messaging.py
Re: [web2py] Re: comet for web2py (give it a try) - and happy new year
Setting up right now. I need trunk web2py_ajax or will latest work? Can I just copy that single file from trunk? Thx. On 12/31/10 2:21 PM, mdipierro wrote: ... and this requires the latest web2py_ajax.html from welcome in trunk else it does not work. Please give it a try, I have not tested it that much! Massimo On Dec 31, 1:19 pm, mdipierromdipie...@cs.depaul.edu wrote: Sorry Mistake: http://code.google.com/p/web2py/source/browse/gluon/contrib/comet_mes... On Dec 31, 1:14 pm, mdipierromdipie...@cs.depaul.edu wrote: Should be self explanatory: http://code.google.com/p/web2py/source/browse/scripts/comet_messaging.py
Re: [web2py] Re: Translation problem
On Dec 31, 2010, at 9:23 AM, Jonathan Lundell wrote: On Dec 31, 2010, at 8:54 AM, DenesL wrote: The problem is that those messages are defined internally in the validator and can not be set via error_message. Actually, they can, except that there's a bug for the first one, 'enter an integer' that needs to be fixed. Here's a patch for the bug: self.minimum = self.maximum = None if minimum is None: if maximum is None: -if error_message is None: -self.error_message = 'enter an integer' +self.error_message = error_message or 'enter an integer' else: self.maximum = int(maximum) if error_message is None:
Re: [web2py] Legacy table
If I understood well you need to do: person = db.define_table('another_name',Field(...),Field(...),migrate=False) so you have 'person' object. person.insert(name='blablabla') rows = db(person.name=='blablabla').select() 2010/12/31 Marcello Parra parro...@gmail.com Hello, I have a legacy database, and want to access it with web2py. One table is called another_name in the database (mysql). But I want to use it in web2py as: db.define_table('person', Field('name')) I read docs, but could not figure this out Thanks for any help... Marcello -- Bruno Rocha http://about.me/rochacbruno/bio
[web2py] Re: comet for web2py (give it a try) - and happy new year
yes On Dec 31, 1:25 pm, David J. da...@styleflare.com wrote: Setting up right now. I need trunk web2py_ajax or will latest work? Can I just copy that single file from trunk? Thx. On 12/31/10 2:21 PM, mdipierro wrote: ... and this requires the latest web2py_ajax.html from welcome in trunk else it does not work. Please give it a try, I have not tested it that much! Massimo On Dec 31, 1:19 pm, mdipierromdipie...@cs.depaul.edu wrote: Sorry Mistake: http://code.google.com/p/web2py/source/browse/gluon/contrib/comet_mes... On Dec 31, 1:14 pm, mdipierromdipie...@cs.depaul.edu wrote: Should be self explanatory: http://code.google.com/p/web2py/source/browse/scripts/comet_messaging.py
Re: [web2py] Translation problem
On Dec 31, 2010, at 11:20 AM, Martin Weissenboeck wrote: No, I did not not want to translate these sentences manually. The error_message=T(..) does not work, because there are some if-statements inside the class IS_INT_IN_RANGE (and in some other classes). One solution could be a list of error messages for these classes. You don't need a list, because for any given instance, only one of the error messages is used, depending on which combination of min max you set. My proposal uses T as an addition parameter of the __init__ methode of class IS_INT_IN_RANGE (and all other classes) in validators.py and therefore there is not compatiblity problem. I can use everything as before and the translation method (T-search) works with every internal error_message. I think the T-search would have to change, since it doesn't look in gluon. Not a big change. This usage of T has another advantage: Currenty error_messages are defined twice: 1st inside validators.py, e.g.: def __init__(self, expression, error_message='invalid expression'): ... self.error_message = error_message 2nd on using the class, e.g. a=IS_MATCH(...,error_message=T('invalid expression') I think, this is against the rule Don't repeat yourself With an additional T-parameter these lines could be written as follows: 1st inside validators.py, e.g.: def __init__(self, expression, error_message='invalid expression', T=lambda x:x): ... self.error_message = T(error_message) 2nd on using the class, e.g. a=IS_MATCH(...,T=T) # if you like the default message Now the default error message appears only once, but could be changed by the user. But I don't know whether this will slow down web2py. The ideal solution would be one that allowed using T() normally in gluon (at least in code that's invoked from an application); that avoids the T=T requirement. My conjecture is when Python compiles the gluon code, it binds T references (to what? that's the hole in my theory) at compile time, and thus ignores the presence of T in globals. Making T an argument forces Python to defer binding. 2010/12/31 Jonathan Lundell jlund...@pobox.com On Dec 31, 2010, at 6:18 AM, Martin Weissenboeck wrote: I want to translate my web page to German. The T()operator is very fine, but I could not find any way to translate message like enter an integer less than or equal to %(max)g in class IS_INT_IN_RANGE. I think it is very unprofessional to mix English and German words and I have tried to find a solution. Am I correct that you had to make the translation entries manually (because the T() search doesn't look in gluon)? I assume that the current logic was written with the intention of passing in error_message=T(something); does that work too? I wonder whether there isn't a general solution that would let us use T() in gluon code that's invoked by applications. I have changed the following lines (file validators.py, class IS_INT_IN_RANGE) def __init__( self, minimum=None, maximum=None, error_message=None, T=lambda x:x, ): self.minimum = self.maximum = None if minimum is None: if maximum is None: if error_message is None: self.error_message = T('enter an integer') else: self.maximum = int(maximum) if error_message is None: error_message = T('enter an integer less than or equal to %(max)g') self.error_message = error_message % dict(max=self.maximum-1) elif maximum is None: self.minimum = int(minimum) if error_message is None: error_message = T('enter an integer greater than or equal to %(min)g') self.error_message = error_message % dict(min=self.minimum) else: self.minimum = int(minimum) self.maximum = int(maximum) if error_message is None: error_message = T('enter an integer between %(min)g and %(max)g') self.error_message = error_message % dict(min=self.minimum, max=self.maximum-1) And I have used it: Field('number', type='integer', requires=IS_INT_IN_RANGE(2,5,T=T), label=T('number')), It's full compatible. Are there any disadvantages in my solution? Or is there any other solution? Of course the whole file validators.py has to be changed. Maybe the file tools.py too? Is it possible to use this proposal in the next release? -- 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: comet for web2py (give it a try) - and happy new year
... and it requires Chrome! On Dec 31, 1:28 pm, mdipierro mdipie...@cs.depaul.edu wrote: yes On Dec 31, 1:25 pm, David J. da...@styleflare.com wrote: Setting up right now. I need trunk web2py_ajax or will latest work? Can I just copy that single file from trunk? Thx. On 12/31/10 2:21 PM, mdipierro wrote: ... and this requires the latest web2py_ajax.html from welcome in trunk else it does not work. Please give it a try, I have not tested it that much! Massimo On Dec 31, 1:19 pm, mdipierromdipie...@cs.depaul.edu wrote: Sorry Mistake: http://code.google.com/p/web2py/source/browse/gluon/contrib/comet_mes... On Dec 31, 1:14 pm, mdipierromdipie...@cs.depaul.edu wrote: Should be self explanatory: http://code.google.com/p/web2py/source/browse/scripts/comet_messaging.py
Re: [web2py] comet for web2py (give it a try) - and happy new year
On Dec 31, 2010, at 11:14 AM, mdipierro wrote: Should be self explanatory: http://code.google.com/p/web2py/source/browse/scripts/comet_messaging.py It got checked into gluon/contrib, not scripts.
[web2py] any idea how hide downloads
i have something like this def download(): download_id = request.args(0) download = db.post(download_id) if str(download) == None: redirect(URL(r=request,c=home,f=index)) form = FORM(Download: + str(download_id) ,INPUT(_type='submit', _value=Download)) form.insert(1,captcha) if form.accepts(request.vars, session): return redirect(URL(r=request,c='default',f='download/db', args=download.file)) elif form.errors: response.flash = T(Houston we have a problem) return dict(form=form) then this redirects to def download(): return response.download(request,db) and i get something like this http://127.0.0.1:8000/init/default/download/db/post.file.998824c8547a4dd4.313239333035323337373332312e6a7067.jpg catpcha fail in this case, i will be able to download from this URL any idea how can i hide the downloads? =D
[web2py] Re: comet for web2py (give it a try) - and happy new year
Fixed a couple of bugs and moved it to gluon/contrib/ comet_messaging.py I included more examples.
Re: [web2py] Re: comet for web2py (give it a try) - and happy new year
I tried rochacbr...@macubuntu:~/projects/web2py/gluon/contrib$ sudo easy_install tornado[sudo] password for rochacbruno: install_dir /usr/local/lib/python2.6/dist-packages/ Searching for tornado Best match: tornado 0.2 tornado 0.2 is already the active version in easy-install.pth rochacbr...@macubuntu:~/projects/web2py/gluon/contrib$ python comet_messaging.py -k 1234 -p Traceback (most recent call last): File comet_messaging.py, line 68, in module import tornado.websocket ImportError: No module named websocket rochacbr...@macubuntu:~/projects/web2py/gluon/contrib$ What can I do to have tornado.websocket? -- Bruno Rocha http://about.me/rochacbruno/bio
Re: [web2py] Re: comet for web2py (give it a try) - and happy new year
My tornado instalation on UBuntu has not websocket rochacbr...@macubuntu:/usr/lib/pymodules/python2.6/tornado$ ls auth.py database.py httpclient.py __init__.py iostream.py options.pytemplate.py wsgi.py auth.pycdatabase.pyc httpclient.pyc __init__.pyc iostream.pyc options.pyc template.pyc wsgi.pyc autoreload.py escape.py httpserver.py ioloop.py locale.py s3server.py web.py autoreload.pyc escape.pychttpserver.pyc ioloop.pyclocale.pyc s3server.pyc web.pyc 2010/12/31 Bruno Rocha rochacbr...@gmail.com I tried rochacbr...@macubuntu:~/projects/web2py/gluon/contrib$ sudo easy_install tornado[sudo] password for rochacbruno: install_dir /usr/local/lib/python2.6/dist-packages/ Searching for tornado Best match: tornado 0.2 tornado 0.2 is already the active version in easy-install.pth rochacbr...@macubuntu:~/projects/web2py/gluon/contrib$ python comet_messaging.py -k 1234 -p Traceback (most recent call last): File comet_messaging.py, line 68, in module import tornado.websocket ImportError: No module named websocket rochacbr...@macubuntu:~/projects/web2py/gluon/contrib$ What can I do to have tornado.websocket? -- Bruno Rocha http://about.me/rochacbruno/bio -- Bruno Rocha http://about.me/rochacbruno/bio
Re: [web2py] Re: comet for web2py (give it a try) - and happy new year
On Dec 31, 2010, at 12:29 PM, Bruno Rocha wrote: I tried rochacbr...@macubuntu:~/projects/web2py/gluon/contrib$ sudo easy_install tornado[sudo] password for rochacbruno: install_dir /usr/local/lib/python2.6/dist-packages/ Searching for tornado Best match: tornado 0.2 tornado 0.2 is already the active version in easy-install.pth rochacbr...@macubuntu:~/projects/web2py/gluon/contrib$ python comet_messaging.py -k 1234 -p Traceback (most recent call last): File comet_messaging.py, line 68, in module import tornado.websocket ImportError: No module named websocket rochacbr...@macubuntu:~/projects/web2py/gluon/contrib$ What can I do to have tornado.websocket? 1.1 appears to be current: http://www.tornadoweb.org/
Re: [web2py] Re: comet for web2py (give it a try) - and happy new year
1.1 appears to be current: http://www.tornadoweb.org/ I used apt-get in ubuntu 10.10 and it instals tornado 0.2 I take websocket from here https://github.com/finiteloop/tornado/raw/master/tornado/websocket.py https://github.com/finiteloop/tornado/raw/master/tornado/websocket.pyand now it is running well. Thanks
Re: [web2py] Re: comet for web2py (give it a try) - and happy new year
Updated to tornado 1.1 and it is working very well, thank you so much! I will use this on my new system of inventory control, receiving new requests for products and a feeding a table with powerTable. Very cool! -- Bruno Rocha http://about.me/rochacbruno/bio
[web2py] Re: comet for web2py (give it a try) - and happy new year
can you make a video of powertable? On Dec 31, 3:00 pm, Bruno Rocha rochacbr...@gmail.com wrote: Updated to tornado 1.1 and it is working very well, thank you so much! I will use this on my new system of inventory control, receiving new requests for products and a feeding a table with powerTable. Very cool! -- Bruno Rochahttp://about.me/rochacbruno/bio
Re: [web2py] Re: comet for web2py (give it a try) - and happy new year
2010/12/31 mdipierro mdipie...@cs.depaul.edu can you make a video of powertable? OK, nice idea, I'll finish some functions in plugin then test the comet queue as datasource and I'll create a screencast soon.
[web2py] RFC: new URL routing facility
I've been working on a new URL routing facility that provides fairly powerful rewriting with very simple configuration and no regexes. The configuration is described below. Features: * remove default application/controller names from URLs * support domain-app mapping (no visible app names) * support language codes embedded in URLs: /app/en/ctlr/fcn/args * handle static files, including root-based files like favicon.ico, automatically * make full URL-legal character set available for args and vars (This was the original driver for making the changes, since it was essentially impossible to retrofit into the existing rewrite system. The secondary goal was to address 99% of required functionality while keeping configuration as close to trivial as possible.) * app-specific routing The new logic is selected in routes.py. The old regex logic remains available, though not simultaneously. I'd like to get some feedback before submitting the patch, with respect to the feature set especially: what's missing? Is the language support of use to anyone? It needs to be tied into the existing header-driven language logic, but that should be relatively easy. # router is a dictionary of URL routing parameters. # # For each request, the effective router is the default router (below), # updated by the base router (if any) from routes.py, # updated by the relevant application-specific router (if any) # from applications/app/routes.py. # # Optional members of base router: # # default_application: default application name # applications: list of all recognized applications, # or 'ALL' to use all currently installed applications # map_domain: dict used to map domain names to application names # # These values may be overridden by app-specific routers: # # default_controller: name of default controller # default_function: name of default function (all controllers) # root_static: list of static files accessed from root # (mapped to the selected application's static/ directory) # # # Optional members of application-specific router: # # These values override those in the base router: # # default_controller # default_function # root_static # # When these appear in the base router, they apply to the default application only: # # controllers: list of valid controllers in selected app # or DEFAULT to use all controllers in the selected app plus 'static' # or [] to disable controller-name omission # languages: list of all supported languages # default_language # The language code (for example: en, it-it) optionally appears in the URL following # the application (which may be omitted). For incoming URLs, the code is copied to # request.language; for outgoing URLs it is taken from request.language. # If languages=[], language support is disabled. # The default_language, if any, is omitted from the URL. # check_args: set to False to suppress arg checking # request.raw_args always contains a list of raw args from the URL, not unquoted # request.args are the same values, unquoted # By default (check_args=True), args are required to match r'([\w@ -][=.]?)+$'. # # # The built-in default router supplies default values (undefined members are None): # # router = dict( # default_application = 'init', # default_controller = 'default', # default_function = 'index', # applications = 'ALL', # controllers = 'DEFAULT', # languages = [], # default_language = None, # root_static = ['favicon.ico', 'robots.txt'], # check_args = True, # map_domain = dict(), # ) # # See rewrite.map_url_in() and rewrite.map_url_out() for implementation details. # This simple router overrides only the default application name, # but provides full rewrite functionality. # # router = dict( # default_application = 'welcome', # )
[web2py] Happy New Year in 2011
Well, here it's already 1AM, so: Happy New Year in 2011 to all of you guys. I wish you a productive and satisfying year! -- Branko Vukelic stu...@brankovukelic.com http://www.brankovukelic.com/
[web2py] Re: Happy New Year in 2011
Happy new year everybody! On Dec 31, 6:06 pm, Branko Vukelić stu...@brankovukelic.com wrote: Well, here it's already 1AM, so: Happy New Year in 2011 to all of you guys. I wish you a productive and satisfying year! -- Branko Vukelic stu...@brankovukelic.comhttp://www.brankovukelic.com/
Re: [web2py] Re: Happy New Year in 2011
+1 Happy New Year, many successful commits, and no tracebacks for you all! 2010/12/31 mdipierro mdipie...@cs.depaul.edu Happy new year everybody! On Dec 31, 6:06 pm, Branko Vukelić stu...@brankovukelic.com wrote: Well, here it's already 1AM, so: Happy New Year in 2011 to all of you guys. I wish you a productive and satisfying year! -- Branko Vukelic stu...@brankovukelic.comhttp://www.brankovukelic.com/ -- Bruno Rocha http://about.me/rochacbruno/bio
[web2py] Re: Happy New Year in 2011
+1 Happy New Year everyone. I'll be joining you in 2011 in 4 hours and 38 minutes. :D Anthony On Friday, December 31, 2010 7:06:19 PM UTC-5, stu...@brankovukelic.com wrote: Well, here it's already 1AM, so: Happy New Year in 2011 to all of you guys. I wish you a productive and satisfying year! -- Branko Vukelic stu...@brankovukelic.com http://www.brankovukelic.com/
Re: [web2py] Re: Happy New Year in 2011
=D Happy New Year On Fri, Dec 31, 2010 at 9:22 PM, Anthony abasta...@gmail.com wrote: +1 Happy New Year everyone. I'll be joining you in 2011 in 4 hours and 38 minutes. :D Anthony On Friday, December 31, 2010 7:06:19 PM UTC-5, stu...@brankovukelic.com wrote: Well, here it's already 1AM, so: Happy New Year in 2011 to all of you guys. I wish you a productive and satisfying year! -- Branko Vukelic stu...@brankovukelic.com http://www.brankovukelic.com/
[web2py] RFC: new URL routing facility
Cool!
[web2py] Re: Happy New Year in 2011
+1 On Dec 31, 8:06 pm, Felixdm || Augusto Félix Dal Mas joi@gmail.com wrote: =D Happy New Year
[web2py] Re: Happy New Year in 2011
+1
[web2py] Re: eclipse: getting it to ignore db
I decided to dispense with putting all that junk in my controllers and models and instead, I built an ignore list that I put in my preferences. It's a much cleaner approach IMHO. On Dec 31, 1:56 pm, Thadeus Burgess thade...@thadeusb.com wrote: Add to your list... if 0: from gluon.dal import DAL db = DAL() -- Thadeus On Thu, Dec 30, 2010 at 4:46 AM, weheh richard_gor...@verizon.net wrote: I'm trying to get eclipse to ignore undefined var: db using the if 0: import gluon from ... import ... trick, but I'm not sure where db is coming from?
[web2py] Re: Translation problem
On Dec 31, 2:34 pm, Jonathan Lundell jlund...@pobox.com wrote: On Dec 31, 2010, at 11:20 AM, Martin Weissenboeck wrote: No, I did not not want to translate these sentences manually. The error_message=T(..) does not work, because there are some if-statements inside the class IS_INT_IN_RANGE (and in some other classes). One solution could be a list of error messages for these classes. You don't need a list, because for any given instance, only one of the error messages is used, depending on which combination of min max you set. True. My proposal uses T as an addition parameter of the __init__ methode of class IS_INT_IN_RANGE (and all other classes) in validators.py and therefore there is not compatiblity problem. I can use everything as before and the translation method (T-search) works with every internal error_message. I think the T-search would have to change, since it doesn't look in gluon. Not a big change. This usage of T has another advantage: Currenty error_messages are defined twice: 1st inside validators.py, e.g.: def __init__(self, expression, error_message='invalid expression'): ... self.error_message = error_message 2nd on using the class, e.g. a=IS_MATCH(...,error_message=T('invalid expression') I think, this is against the rule Don't repeat yourself With an additional T-parameter these lines could be written as follows: 1st inside validators.py, e.g.: def __init__(self, expression, error_message='invalid expression', T=lambda x:x): ... self.error_message = T(error_message) 2nd on using the class, e.g. a=IS_MATCH(...,T=T) # if you like the default message Now the default error message appears only once, but could be changed by the user. But I don't know whether this will slow down web2py. The ideal solution would be one that allowed using T() normally in gluon (at least in code that's invoked from an application); that avoids the T=T requirement. My conjecture is when Python compiles the gluon code, it binds T references (to what? that's the hole in my theory) at compile time, and thus ignores the presence of T in globals. Making T an argument forces Python to defer binding. The funny part is that T is in environment (!!!?) so exec ccode in environment should work, I don't see why it does not. 2010/12/31 Jonathan Lundell jlund...@pobox.com On Dec 31, 2010, at 6:18 AM, Martin Weissenboeck wrote: I want to translate my web page to German. The T()operator is very fine, but I could not find any way to translate message like enter an integer less than or equal to %(max)g in class IS_INT_IN_RANGE. I think it is very unprofessional to mix English and German words and I have tried to find a solution. Am I correct that you had to make the translation entries manually (because the T() search doesn't look in gluon)? I assume that the current logic was written with the intention of passing in error_message=T(something); does that work too? I wonder whether there isn't a general solution that would let us use T() in gluon code that's invoked by applications. I have changed the following lines (file validators.py, class IS_INT_IN_RANGE) def __init__( self, minimum=None, maximum=None, error_message=None, T=lambda x:x, ): self.minimum = self.maximum = None if minimum is None: if maximum is None: if error_message is None: self.error_message = T('enter an integer') else: self.maximum = int(maximum) if error_message is None: error_message = T('enter an integer less than or equal to %(max)g') self.error_message = error_message % dict(max=self.maximum-1) elif maximum is None: self.minimum = int(minimum) if error_message is None: error_message = T('enter an integer greater than or equal to %(min)g') self.error_message = error_message % dict(min=self.minimum) else: self.minimum = int(minimum) self.maximum = int(maximum) if error_message is None: error_message = T('enter an integer between %(min)g and %(max)g') self.error_message = error_message % dict(min=self.minimum, max=self.maximum-1) And I have used it: Field('number', type='integer', requires=IS_INT_IN_RANGE(2,5,T=T), label=T('number')), It's full compatible. Are there any disadvantages in my solution? Or is there any other solution? Of course the whole file validators.py has to be changed. Maybe the file tools.py too? Is it possible to use this proposal in the next release? -- Mit freundlichen Grüßen / With kind regards Martin Weissenböck Gregor-Mendel-Str. 37,
Re: [web2py] Re: Translation problem
On Dec 31, 2010, at 8:06 PM, DenesL wrote: The ideal solution would be one that allowed using T() normally in gluon (at least in code that's invoked from an application); that avoids the T=T requirement. My conjecture is when Python compiles the gluon code, it binds T references (to what? that's the hole in my theory) at compile time, and thus ignores the presence of T in globals. Making T an argument forces Python to defer binding. The funny part is that T is in environment (!!!?) so exec ccode in environment should work, I don't see why it does not. Neither do I, but I think that T must already be bound (to what? dunno), before the environment is created.
Re: [web2py] Re: Translation problem
On Dec 31, 2010, at 8:06 PM, DenesL wrote: The ideal solution would be one that allowed using T() normally in gluon (at least in code that's invoked from an application); that avoids the T=T requirement. My conjecture is when Python compiles the gluon code, it binds T references (to what? that's the hole in my theory) at compile time, and thus ignores the presence of T in globals. Making T an argument forces Python to defer binding. The funny part is that T is in environment (!!!?) so exec ccode in environment should work, I don't see why it does not. OK, here's part of the riddle solved. If I call T in gluon.validators, and run web2py: File /Users/jlundell/Projects/web2py/web2py-hg/gluon/validators.py, line 123, in IS_MATCH def __init__(self, expression, error_message=T('invalid expression')): NameError: name 'T' is not defined So no funny business with binding; it just doesn't compile.
[web2py] 3rd party library import error
My app uses Google's gdata client library: http://code.google.com/p/gdata-python-client/ modules/ gdata/ atom/ test.py test.py imports gdata, which in turn imports atom. Running test.py directly works fine. But within a web2py app I get *ImportError: No module named atom* * * How can I import this module?
Re: [web2py] 3rd party library import error
are you using local_import() ? http://www.web2py.com/book/default/chapter/04#Third-Party-Modules http://www.web2py.com/book/default/chapter/04#Third-Party-Modules 2011/1/1 Plumo richar...@gmail.com My app uses Google's gdata client library: http://code.google.com/p/gdata-python-client/ modules/ gdata/ atom/ test.py test.py imports gdata, which in turn imports atom. Running test.py directly works fine. But within a web2py app I get *ImportError: No module named atom* * * How can I import this module? -- Bruno Rocha http://about.me/rochacbruno/bio
Re: [web2py] 3rd party library import error
yes. The error is gdata trying to import atom.
[web2py] Re: Happy New Year in 2011
+1 and in one more hour here