Re: [web2py] Re: date widget broken in trunk?
Yes it's fixed and the new skin is really slick! Great Massimo! 2011/12/4 Massimo Di Pierro massimo.dipie...@gmail.com: I believe this is now fixed. Please check it. On Dec 3, 5:04 pm, Angelo Compagnucci angelo.compagnu...@gmail.com wrote: Yes, I can confirm there is a bug. With this model: db.define_table('testdb',Field('test','datetime', requires=IS_DATETIME())) I have this html using SQLFORM: [...] input class=string id=testdb_test name=test type=text value= / [..] class should be datetime, not string! 2011/12/3 Carlos carlosgali...@gmail.com: Hi, Is DATE widget broken in trunk?. Previously when I had a 'date' type field (with no widget), it was automatically assigned the 'date' class with a date picker. Now, even if I explicitly assign a DATE widget (SQLFORM.widgets.date.widget), it generates an input with 'string' class and no date picker. Can you please check into this?. Thanks, Carlos -- Profile:http://www.gild.com/compagnucciangelo Register on Gild:http://www.gild.com/referral/compagnucciangelo -- Profile: http://www.gild.com/compagnucciangelo Register on Gild: http://www.gild.com/referral/compagnucciangelo
Re: [web2py] Re: Pass multiple arguments to URL through javascript
On Dec 3, 2011, at 11:32 PM, Vineet wrote: @Anthony, thanks. Your method worked. Secondly, if I want to pass arguments by name, would it be okay to do something like this {{=URL(...)}} + '/' + 'p1=' + param1 + '/' + 'p2=' + param2 Almost. You want: {{=URL(...)}} + '?p1=' + param1 + 'p2=' + param2 ...then look for p1 p2 in request.vars.
[web2py] Re: How to make a simple upload form with just one field - a file name?
Thank you, it was GAE specific.
[web2py] Re: How to make address bar to correspond to the _next link redirection? /user/login still shows after login
The login is here: /user/login auth.settings.login_next = URL('default', args='index') I expect the address bar after redirection to show in routes.py routers = dict( BASE = dict( default_application = 'my_dev', default_controller='default' ), ) routes_in = ( ('/default/user/$anything', '/my_dev/default/user/$anything'), ('/$c/$f', '/my_dev/$c/$f'), ('/favicon.ico', '/my_dev/static/favicon.ico'), ('/robots.txt', '/my_dev/static/robots.txt'), ) routes_out = ( ('/my_dev/default/user/$anything', '/default/user/$anything'), ('/my_dev/$c/$f', '/$c/$f'), ('/static/$anything', '/my_dev/static/$anything'), )
Re: [web2py] Re: web2py hosting
Ok, I have installed web2py on pythonanywhere and myname.pythonanywhere.comis running. But I need *https*://myname.pythonanywhere.com for the Administrative interface. It is not possible to use https. Any ideas? Regards, Martin 2011/10/13 GoldenTiger goldenboy...@gmail.com I posted in http://web2py.pythonanywhere.com On Oct 12, 5:36 am, Bryan Barnard bmbarn...@gmail.com wrote: I just got a beta account with pythonanywhere, and want to test it out. I'm new to web2py. Can you provide any info on how you went about setting it up? On Sat, Oct 8, 2011 at 3:42 AM, GoldenTiger goldenboy...@gmail.com wrote: I beta tester of a future specific python hosting http:/ www.pythonanywhere.com WEB Shell Ipython, Bash, Git, Code Editor, installing web2py tooks me 3 min, I configured DEMO MODE and MULTI USER so you can test http://web2py.pythonanywhere.com -- Bryan M. Barnard bmbarn...@gmail.com
[web2py] Re: Expire date for Web2Py applications
Thanks Anthony, Let me try this and update you. Best Regards Shiv
[web2py] Re: RESTful API error: no matching pattern
Hi Massimo, Yep, I tried all the combinations. When I set patterns to auto and go to http://127.0.0.1/myapp/default/api/patterns, no all pattern even appears. In my simple case, I have a single table called task with two fields: name and description. A pattern of auto generates two expressions; the output is ['/task/id/{task.id}', '/task/id/ {task.id}/:field']. None of that looks like listing all task rows. If I manually add a pattern equal to /task[task] and navigate to it, I get the no matching pattern error. Not sure where to go from there. On Nov 29, 1:37 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Have you tried http://127.0.0.1/myapp/default/api/person.json without the s On Nov 28, 5:19 am, Oliver Lade piemaste...@gmail.com wrote: I've been following the documentation regarding RESTful web services (very cool), and it mostly works except for one annoying thing. Every time I try a URL that's supposed to match the whole table and return all results (e.g.http://127.0.0.1/myapp/default/api/persons.jsonin the example) I get an error message saying no matching pattern. This happens both copying the example patterns, using auto patterns, and when trying my own patterns (in my case /task[task] should get all rows of the db.task table, but no luck athttp://127.0.0.1:8000/myapp/default/api/task; specifying an ID returns an individual result however). Any idea what might be causing this? Running web2py v1.99.2 (2011-09-26 06:55:33) stable on Windows 7 x64, using the standard Rocket 1.2.4 and SQLite DBs.
[web2py] Re: Requesting Feedback for Web2py Instant Admin
is there any progress in including it in admin? I couldn't download the compiled plugin but downloaded and from the excellent docs, was able to include into my app. But making it part of admin will be great. Joseph
Re: [web2py] Re: SQLFORM grid
On 2 December 2011 19:36, Anthony abasta...@gmail.com wrote: Please submit an issue: http://code.google.com/p/web2py/issues/list On Friday, December 2, 2011 11:35:01 AM UTC-5, peter wrote: I have discovered that the error only occurs when one is editing records that are returned from a query Maybe related to issue 489? Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
Re: [web2py] Problem understanding imports
I had same problem and I found out that it worked fine with source code version (1.99.2) of the web2py. That's why with compiled version (1.99.2) I copied the gluon directory from the library.zip to root and that solved the problem. I'm new to web2py so could somebody explain what is the actual reason for this behaviour ? In the documentation there was no mention that I need to unzip the library.zip ?
[web2py] Re: How to make address bar to correspond to the _next link redirection? /user/login still shows after login
Not sure it has anything to do with your problem, but you cannot mix the parameter based and pattern based rewrite systems -- if you're using routers, you cannot also use routes_in/routes_out (I think the presences of routers will cause routes_in/routes_out to be ignored). Regarding the address bar issue, it sounds like a jQuery Mobile issue -- you'll have to figure out how to get it to deal with your URLs appropriately. web2py is sending standard http responses to whatever URL requests it is receiving. Anthony On Sunday, December 4, 2011 3:58:48 AM UTC-5, Constantine Vasil wrote: The login is here: /user/login auth.settings.login_next = URL('default', args='index') I expect the address bar after redirection to show in routes.py routers = dict( BASE = dict( default_application = 'my_dev', default_controller='default' ), ) routes_in = ( ('/default/user/$anything', '/my_dev/default/user/$anything'), ('/$c/$f', '/my_dev/$c/$f'), ('/favicon.ico', '/my_dev/static/favicon.ico'), ('/robots.txt', '/my_dev/static/robots.txt'), ) routes_out = ( ('/my_dev/default/user/$anything', '/default/user/$anything'), ('/my_dev/$c/$f', '/$c/$f'), ('/static/$anything', '/my_dev/static/$anything'), )
[web2py] Re: How to make address bar to correspond to the _next link redirection? /user/login still shows after login
Note, you might consider asking about this in the jQuery Mobile forum: http://forum.jquery.com/jquery-mobile On Sunday, December 4, 2011 8:42:34 AM UTC-5, Anthony wrote: Not sure it has anything to do with your problem, but you cannot mix the parameter based and pattern based rewrite systems -- if you're using routers, you cannot also use routes_in/routes_out (I think the presences of routers will cause routes_in/routes_out to be ignored). Regarding the address bar issue, it sounds like a jQuery Mobile issue -- you'll have to figure out how to get it to deal with your URLs appropriately. web2py is sending standard http responses to whatever URL requests it is receiving. Anthony On Sunday, December 4, 2011 3:58:48 AM UTC-5, Constantine Vasil wrote: The login is here: /user/login auth.settings.login_next = URL('default', args='index') I expect the address bar after redirection to show in routes.py routers = dict( BASE = dict( default_application = 'my_dev', default_controller='default' ), ) routes_in = ( ('/default/user/$anything', '/my_dev/default/user/$anything'), ('/$c/$f', '/my_dev/$c/$f'), ('/favicon.ico', '/my_dev/static/favicon.ico'), ('/robots.txt', '/my_dev/static/robots.txt'), ) routes_out = ( ('/my_dev/default/user/$anything', '/default/user/$anything'), ('/my_dev/$c/$f', '/$c/$f'), ('/static/$anything', '/my_dev/static/$anything'), )
[web2py] Re: Converting mongodb collection to row
But what if you pass the default return value of dict.get? Does the function raise exceptions? i.e. Result.get(my_field, None) And you could catch invalid returned object exceptions with try-except blocks, and replacing them with a default value (i.e. None) This is what i understood so far: parse() DAL.BaseAdapter (wich is called by dal's instance .select() method) receives a rows argument (suposedly a dict returned by ._select()?) and a colnames (a list of fields retrieved from the adapter) in parse(): -each dictionary creates a Row instance to be passed to the Rows object returned by the function -the Rows object is intantiated with a python list of Row instances as argument This is however a very simplified and incomplete description of the parse function. It's complete working implementation can be read here: http://web2py.com/examples/static/epydoc/web2py.gluon.dal-pysrc.html (From line 1391) From then on, you should be able to process the query output basically On Dec 4, 3:51 am, Mark Breedveld markbr...@hotmail.com wrote: That was indeed a bit help full, but I think the parse() functions takes care of that. Do I'm not sure what that function is expecting, but more tomorrow. I'm from Europe, so a bit of a hour gab there. Regards Mark, -Oorspronkelijk bericht- Van: web2py@googlegroups.com [mailto:web2py@googlegroups.com] Namens Alan Etkin Verzonden: zondag 4 december 2011 2:21 Aan: web2py-users Onderwerp: [web2py] Re: Convertingmongodbcollection torow I see your point now, you meant a Rows instance (kind of a subset of a table) Would you post the exception (if any), when trying to read the query result? The point is that the select method has to instantiate properly a Rows object Have you read this web2py API section?http://web2py.com/examples/static/epydoc/web2py.gluon.dal.Rows-class I think it could help. That is the object wich is to be returned by a correct select Note that the Rows instance is normally returned by this web2py statement: dal_instance(query_object).select(*arguments) On Dec 3, 7:36 pm, Alan Etkin spame...@gmail.com wrote: When you say that you try to convert a collection to arow, isn't there a conflict with database systems? I looking for the first time themongodbdatabase design, and i assume there is got to be some sort of mapping of objects: - A DAL Table is like a Collection - A DALRowis (more or less) like a Document - A DAL Field is like any object stored inside the Document at the root Document level As long as there is not more depth in themongodbobject than the described, the parsing by using a json like simplejson or similar interface should be straightforward. I think this goes beyond my database skills but i would like to see the interface implemented if it is available (and shared) somewhere. Thanks for your feedback On Dec 3, 12:35 pm, Mark Breedveld markbr...@hotmail.com wrote: I'm currently modifing the DAL.py file to get DAL working withmongoDB. I got the insert part working, but the of the select method. So __select is working, but select() ain't. Because I need to convert a pymongo collection to arow. The line I point to has been written by Massimo, but isn't working. I have no idea's at the moment to do this in a general way. The returned value is a dict or a list of dict's, but of course not formatted in a DAL way. -Oorspronkelijk bericht- Van: web2py@googlegroups.com [mailto:web2py@googlegroups.com] Namens Alan Etkin Verzonden: zaterdag 3 december 2011 17:14 Aan: web2py-users Onderwerp: [web2py] Re: Convertingmongodbcollection torow Mark, i don't understand your post. Did you modify web2py code? Could you provide a little background on the interface you are working on? Thank you On Nov 30, 10:50 am, Mark Breedveld m.breedv...@solcon.nl wrote: I have got the select function ofmongodbadapter working, but know I need to convert a pymongo cursor torow. The point is the pymongo supports nested documents and that can be a bit hard to convert for a parameter of the parse method. Here is the select function a have ajusted, but this one won't work with yours because I also altered a lot of other functions. But this is to get the idea. The line that has to be changed is pointed to with -- def select(self,query,fields,attributes): #if not isinstance(query,Query): # raise SyntaxError, Not Supported definition = self._select(query,fields,attributes) ctable = self.connection[str(definition['tablename'])] if ((definition['sort'] == None) (definition['skip'] == None)): result = ctable.find(definition['query']) elif((definition['sort'] != None) (definition['skip'] == None)): result = ctable.find(definition['query']).sort(definition['sort'])
[web2py] Re: Converting mongodb collection to row
Sorry for the repeated posts: There is a a couple of mistakes in the last message. parse() DAL.BaseAdapter (wich is called by dal's instance .select() parse() in called by the adapter instance method) receives a rows argument (suposedly a dict returned by ._select()?) and a colnames (a list of fields retrieved from the the rows parse argument is a row dictionary sequence converted in a enumerated sequence ((0, first_row_dict), ... (n, nth_row_dict)) I recommend you to follow the actual code, because this can be inaccurate
[web2py] Re: Post-login redirection issues
Great- thanks for the update. I submitted a ticket about the session behavior. On Dec 2, 4:29 pm, Anthony abasta...@gmail.com wrote: On Friday, December 2, 2011 12:09:25 AM UTC-5, Yarin wrote: I think the duality of this behavior is confusing and inconsistent: a) It would make more sense for all post-login behavior to follow the same set of rules. b) The default post-login behavior should in all cases be to redirect to the referring URL. Yes, that might be a good idea (at least as an option). Actually, I forgot, but this has actually been in trunk for a couple weeks. Specifically, the auth.navbar() links will automatically include the '_next' variable in the query string so all auth.navbar actions will result in redirection back to the original page. Note, this only works for links generated by auth.navbar() -- you'll still have to handle it on your own if you're generating your own auth action links. Anthony
[web2py] Re: Pass multiple arguments to URL through javascript
what's wrong with? {{=URL(...,vars=dict(p1=param1,p2=param2))}} On Dec 4, 2:14 am, Jonathan Lundell jlund...@pobox.com wrote: On Dec 3, 2011, at 11:32 PM, Vineet wrote: @Anthony, thanks. Your method worked. Secondly, if I want to pass arguments by name, would it be okay to do something like this {{=URL(...)}} + '/' + 'p1=' + param1 + '/' + 'p2=' + param2 Almost. You want: {{=URL(...)}} + '?p1=' + param1 + 'p2=' + param2 ...then look for p1 p2 in request.vars.
[web2py] Re: Pass multiple arguments to URL through javascript
Ignore my comment... I missed the context. On Dec 4, 12:33 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: what's wrong with? {{=URL(...,vars=dict(p1=param1,p2=param2))}} On Dec 4, 2:14 am, Jonathan Lundell jlund...@pobox.com wrote: On Dec 3, 2011, at 11:32 PM, Vineet wrote: @Anthony, thanks. Your method worked. Secondly, if I want to pass arguments by name, would it be okay to do something like this {{=URL(...)}} + '/' + 'p1=' + param1 + '/' + 'p2=' + param2 Almost. You want: {{=URL(...)}} + '?p1=' + param1 + 'p2=' + param2 ...then look for p1 p2 in request.vars.
[web2py] Re: Is this a in custom imports?
Sorry. I do not understand the problem. :-( On Dec 4, 2:19 am, Constantine Vasil thst...@gmail.com wrote: I managed to transfer a very big app initially developed for Django+GAE+JQuery Mobile to web2py. Managed to set up my Eclipse environment to work with web2py and now I can debug my web2py + GAE hybrid app. Works excellent. The issues I see is because my app is big it runs slower than on my former configuration. After extensive debugging I see web2py executes in every request the .py files in models folder. Because there are a lot of table definitions this slows down execution considerably. Researching what to do I found the following article very useful: Optimize your web2py app using the new import methodhttp://martin.tecnodoc.com.ar/default/tag?name=import Then I learned about custom imports. I found the following bug in the example above: In def define_auth(self): db.auth_user.first_name.writable = db.auth_user.first_name.readable = False db.auth_user.last_name.writable = db.auth_user.last_name.readable =False auth.messages.verify_password_comment = '' does not works, but works in init_auth after self.auth_def() #the auth definition Is this is bug in web2py? Regards, --Constantine
[web2py] Re: How to make address bar to correspond to the _next link redirection? /user/login still shows after login
I understand that now about not mixing routing. OK I am using routes.example.py default_application = 'my_app'# ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py routes_app = ((r'/(?Pappwelcome|admin|app)\b.*', r'\gapp'), (r'(.*)', r'my_app'), (r'/?(.*)', r'my_app')) I see I can get rid of the my_app but how to get rid from default? and when addressing the new rules what URL I have to use URL('default','user') or URL('user')? {{try:}}{{=current.app.auth.navbar(action=URL('default','user'))}}{{except:pass}}
[web2py] Re: SQLForm.grid - How do I use it properly?
Hi Massimo and all the team! First all: Thanks very much for this feature!I it's really amazing! I have a question: It's possible to call a function after *update* or *edit* that take the id of the record created or updated? (or any other parameter) thanks very much! pepe.
[web2py] Re: SQLForm.grid - How do I use it properly?
yes. SQLFORM.grid(,oncreate=lambda form: do_something_with(form)) SQLFORM.grid(,onupdate=lambda form: do_something_with(form)) the record id is in form.vars.id On Dec 4, 1:22 pm, Pepe Araya pepea...@gmail.com wrote: Hi Massimo and all the team! First all: Thanks very much for this feature!I it's really amazing! I have a question: It's possible to call a function after *update* or *edit* that take the id of the record created or updated? (or any other parameter) thanks very much! pepe.
Re: [web2py] Re: Expire date for Web2Py applications
Better yet Imagine i have 10 apps running in 1 web2py server. Then one user detects a big bug in one of the apps. What do i do? Stop the web2py server? what about the other 9 apps runnig ok? Imagine that the programmer is on vacations. Their coworkers cannot correct the bug and cannot shutdown the web2py server. Big problem.. What about an On/OFF button in admin to disable individualy every app( or all) redirecting automaticly the user the a default page. Without the need of the programmer. I see the importance of this in a production server. 2011/12/4 Shiv shiv.veerashe...@gmail.com Thanks Anthony, Let me try this and update you. Best Regards Shiv
[web2py] Re: One Queue
It seems that you are resetting the q object (because controller code executes on each request) It could be solved storing the object in session. session.q = ... (session supports only pickleable objects) On 4 dic, 07:40, Martin Weissenboeck mweis...@gmail.com wrote: Hi Alan, I have tried to decorate two functions. But it notwork as I expected. Name of the application: queuetest, controller: default.py: from Queue import * @service.run def pp(): # Producer q.put(request.now.isoformat()) return dict(size=q.qsize()) @service.run def cc(): # Consumer s = q.get() return dict(time=s, size=q.qsize()) @service.run def pc(): # call producer two times, consumer once return [pp(), pp(), cc()] And in db.py: from Queue import * q=Queue() A call ofhttp://127.0.0.1:8000/queuetest/default/call/run/pcreturns: [{'size': 1}, {'size': 2}, {'size': 1, 'time': '2011-12-04T13:30:33.283000'}] That's ok. But I think the next call creates a NEW queue, starting with size 1 [{'size': 1}, {'size': 2}, {'size': 1, 'time': '2011-12-04T13:33:45.126000'}] What shall I do to have ONE queue? Regards, martin 2011/12/2 Alan Etkin spame...@gmail.com Depending on the type of data maybe you could use web2py services interface. First you define the set/get actions in some of the apps and decorate them as services. Then from any application you can consume this services for data transactions. The web2py book covers services and RPC in 9th chapter Apps can share session objects too and you could store a sequence on a common session: (web2py chapter 4) ...One app can load the session of another app using the command: 1 session.connect(request, response, masterapp='appname', db=db) Here appname is the name of the master application, the one that sets the initial session_id in the cookie. db is a database connection to the database that contains the session table (web2py_session). All apps that share sessions must use the same database for session storage. On Dec 1, 6:06 pm, Martin Weissenboeck mweis...@gmail.com wrote: Hi, I want to use one and only one queue (q). Some applications/controllers should act as producers (q.put(item)) and some applications/controllers as consumers (item=q.get()), but with only one queue. How can this be done? Regards, Martin
[web2py] Re: One Queue
On Sunday, December 4, 2011 4:28:19 PM UTC-5, Alan Etkin wrote: It seems that you are resetting the q object (because controller code executes on each request) It could be solved storing the object in session. session.q = ... Note, the session is unique per user, so that only works if each user should have their own session. Otherwise, may store in cache or db.
Re: [web2py] Re: Expire date for Web2Py applications
On Sunday, December 4, 2011 4:12:03 PM UTC-5, Ramos wrote: What about an On/OFF button in admin to disable individualy every app( or all) redirecting automaticly the user the a default page. Without the need of the programmer. Actually, that's in trunk now (a disable/enable button for each app in admin). I think it can be improved though -- right now it just shows a fixed default down for maintenance message. We should make it more customizable. Of course, if you have access to 'admin', you can easily edit the db.py model file for any app to redirect all traffic to a static page or some default function (possibly in another app). Anthony
[web2py] Re: Is this a in custom imports?
Hi Massimo, I will try to explain better, posting the annotated code below. I want to define the *auth_user* in a module and configure it as: == Configuration == db.auth_user.first_name.writable = db.auth_user.first_name.readable = False db.auth_user.last_name.writable = db.auth_user.last_name.readable =False # get rid of please input your password again auth.messages.verify_password_comment = '' == e.g. to not show the first, last name and to not see verify password. * * I am using to custom import Main in *user(). *Main executes *common_services * which executes *init_auth*, which executes *define_auth*, where *auth_user* is defined and should be configured (Configuration). Configuration do not works in *define_auth, *but works in* **init_auth *in the code below. I believe the code in *define_auth * called in *init_auth as *self.*auth_def*() #the auth definition, never executes so I have to do it in *init_auth.* * * *Regards,* *--Constantine* * * *controllers/default.py* # -*- coding: utf-8 -*- ### required - do no delete def *user*(): from main import Main current.app.myapp = Main() current.app.myapp.*common_services*() return dict(form=current.app.auth()) *modules/main.py* #!/usr/bin/env python # coding: utf8 from gluon import * class Main(object): def __init__(self): self.auth_def = lambda: self.define_auth def connect_to_db(self): response = current.response request = current.request session = current.session #connect to db if request.env.web2py_runtime_gae:# if running on Google App Engine current.app.db = DAL('gae') # connect to Google BigTable session.connect(request, response, db = current.app.db) # and store sessions and tickets there else: # else use a normal relational database current.app.db = DAL(current.app.settings.database_uri) # if not, use SQLite or other DB return current.app.db def init_service(self): from gluon.tools import Service current.app.service = Service() return current.app.service def *init_auth*(self): from gluon.tools import Auth settings = current.app.settings request = current.request auth = Auth(current.app.db) #authentication/authorization auth.settings.hmac_key = settings.security_key # before define_tables() self.*auth_def*() #the auth definition auth.define_tables(migrate=settings.migrate) # creates all needed tables db = current.app.db ### # config - these statements below *do work here*, but do not id executed in *define_table* ### db.auth_user.first_name.writable = db.auth_user.first_name.readable = False db.auth_user.last_name.writable = db.auth_user.last_name.readable =False # get rid of please input your password again auth.messages.verify_password_comment = '' ### def *define_auth*(self): # called in init_auth db = current.app.db request = current.request settings = current.app.settings auth = current.app.auth #Add your own users fields db.*define_table*('*auth_user*', Field('id','id', represent=lambda id:SPAN(id,' ',A('view',_href=URL('auth_user_read',args=id, 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', 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='',
[web2py] Re: SQLForm.grid - How do I use it properly?
Thanks! Massimo, I noticed that this line of *gluon/sqlhtml.py* 1754: message = error or T('%(nrows)s records found') % dict(nrows=nrows) add a new entry in the language file for every different search result. (1 records found, 2 records found ) I think that %(nrows)s should be outside the T() helper. regards! pepe.
[web2py] Re: Pass multiple arguments to URL through javascript
Vineet, My copy of jQuery.query.js is attached - I'm assuming since it's released under the WTFPL the author won't mind :D You may also want to look at these: http://stackoverflow.com/questions/2053157/how-to-use-jquery-to-manipulate-the-querystring http://stackoverflow.com/questions/4344405/jquery-url-builder-parser http://stackoverflow.com/questions/1090948/change-url-parameters-with-jquery Brian jquery.query.js Description: JavaScript source
[web2py] Re: SQLForm.grid - How do I use it properly?
It odes not work that way. It will translate the string before the substitution: python web2py.py -S welcome -M -N T.force('it') import os print os.path.getsize('applications/welcome/languages/it.py') 4833 T('%(test)s') % dict(test=1) '1' print os.path.getsize('applications/welcome/languages/it.py') 4857 T('%(test)s') % dict(test=2) '2' print os.path.getsize('applications/welcome/languages/it.py') 4857 T('%(test)s') % dict(test=3) '3' print os.path.getsize('applications/welcome/languages/it.py') 4857 as you can see the file size only grows the first time then it does not grow any more. On Dec 4, 6:43 pm, Pepe Araya pepea...@gmail.com wrote: Thanks! Massimo, I noticed that this line of *gluon/sqlhtml.py* 1754: message = error or T('%(nrows)s records found') % dict(nrows=nrows) add a new entry in the language file for every different search result. (1 records found, 2 records found ) I think that %(nrows)s should be outside the T() helper. regards! pepe.
[web2py] date and sum
Hi, I've a stack of records where records with the same date has different values, eg: record.date[0] = 2011-12-01 record.value[0] = 10 record.date[1] = 2011-12-01 record.value[1] = 20 record.date[3] = 2011-12-02 record.value[3] = 10 And now I want to summarize the values that are recorded for respective date: sumlist.date[0] = 2011-12-01 sumlist.value[0] = 30 sumlist.date[1] = 2011-12-02 sumlist.value[1] = 10 I suppose I should use filter and sum, but I don't know how. Any ideas? Thanks in advance for help!
[web2py] Re: date and sum
rows = db(...).select(db.table.date,db.table.value.sum(),groupby=db.table.date) for row in rows: print row.table.date, row(db.table.value.sum()) mind that 'date' and 'value' are not good field names. Will work with sqlite but will break with other engines. On Dec 4, 8:00 pm, Rick sababa.sab...@gmail.com wrote: Hi, I've a stack of records where records with the same date has different values, eg: record.date[0] = 2011-12-01 record.value[0] = 10 record.date[1] = 2011-12-01 record.value[1] = 20 record.date[3] = 2011-12-02 record.value[3] = 10 And now I want to summarize the values that are recorded for respective date: sumlist.date[0] = 2011-12-01 sumlist.value[0] = 30 sumlist.date[1] = 2011-12-02 sumlist.value[1] = 10 I suppose I should use filter and sum, but I don't know how. Any ideas? Thanks in advance for help!
[web2py] Re: date and sum
I tried to apply the solution to my code, but it still doesn't work. Here is the code: prerecords = db().select(db.day.ALL, orderby=db.day.thedate)for prerecord in prerecords:if prerecord.theauth==auth.user_id: if session.adate==prerecord.thedate: records.append(prerecord) rows = select(records.thedate,records.value.sum(),orderby=records.thedate) for row in rows:print row.records.thedate, row(records.value.sum()) On Dec 5, 3:04 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: rows = db(...).select(db.table.date,db.table.value.sum(),groupby=db.table.date) for row in rows: print row.table.date, row(db.table.value.sum()) mind that 'date' and 'value' are not good field names. Will work with sqlite but will break with other engines. On Dec 4, 8:00 pm, Rick sababa.sab...@gmail.com wrote: Hi, I've a stack of records where records with the same date has different values, eg: record.date[0] = 2011-12-01 record.value[0] = 10 record.date[1] = 2011-12-01 record.value[1] = 20 record.date[3] = 2011-12-02 record.value[3] = 10 And now I want to summarize the values that are recorded for respective date: sumlist.date[0] = 2011-12-01 sumlist.value[0] = 30 sumlist.date[1] = 2011-12-02 sumlist.value[1] = 10 I suppose I should use filter and sum, but I don't know how. Any ideas? Thanks in advance for help!
[web2py] websocket for python
article http://gehrcke.de/2011/10/python-websocket-server-powered-by-gevent-and-ws4py/ https://github.com/Lawouach/WebSocket-for-Python
[web2py] Re: How to make address bar to correspond to the _next link redirection? /user/login still shows after login
For the record - this was only an issue for IE desktop. I had to switch off ajax in jQuery and now it works. That means I have to make two different templates - one for IE, and one for everything else. Does web2py has a function to recognize if the browser is any IE browser?
[web2py] Re: date and sum
please resend indented better... On Dec 4, 8:33 pm, Rick sababa.sab...@gmail.com wrote: I tried to apply the solution to my code, but it still doesn't work. Here is the code: prerecords = db().select(db.day.ALL, orderby=db.day.thedate) for prerecord in prerecords: if prerecord.theauth==auth.user_id: if session.adate==prerecord.thedate: records.append(prerecord) rows = select(records.thedate,records.value.sum(),orderby=records.thedate) for row in rows: print row.records.thedate, row(records.value.sum()) On Dec 5, 3:04 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: rows = db(...).select(db.table.date,db.table.value.sum(),groupby=db.table.date) for row in rows: print row.table.date, row(db.table.value.sum()) mind that 'date' and 'value' are not good field names. Will work with sqlite but will break with other engines. On Dec 4, 8:00 pm, Rick sababa.sab...@gmail.com wrote: Hi, I've a stack of records where records with the same date has different values, eg: record.date[0] = 2011-12-01 record.value[0] = 10 record.date[1] = 2011-12-01 record.value[1] = 20 record.date[3] = 2011-12-02 record.value[3] = 10 And now I want to summarize the values that are recorded for respective date: sumlist.date[0] = 2011-12-01 sumlist.value[0] = 30 sumlist.date[1] = 2011-12-02 sumlist.value[1] = 10 I suppose I should use filter and sum, but I don't know how. Any ideas? Thanks in advance for help!
[web2py] Re: web2py for dummies
I've been thinking along these same lines. I would like to see a workbook to go along with the web2py book in which the concepts in the book are illustrated in a sample in the workbook. Perhaps it could be a progressive sample that builds on one of the samples begun in the earlier chapters. Mike
Re: [web2py] Re: How to make address bar to correspond to the _next link redirection? /user/login still shows after login
On 5 December 2011 05:55, Constantine Vasil thst...@gmail.com wrote: For the record - this was only an issue for IE desktop. I had to switch off ajax in jQuery and now it works. That means I have to make two different templates - one for IE, and one for everything else. Does web2py has a function to recognize if the browser is any IE browser? I you look in layout.html of the welcome app near the top you will see that provision is made for detecting IE and acting on it. You can add your code there for the alternatives.: Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)