[web2py] Re: Passing a Variable into a Query
observation: db_name is a table name. What do you expect to be returned by .select(db_field)? it is a list of rows, where row is a DAL object. usually written like this: rows = db(query).select() It seems you haven't noticed this yet since your code uses a singular form db_record. You then take the entire first element of this list (an entire row, or record) and convert it to string. This is very definitely the hard way to do it. The row object allows very convenient access to fields which it contains. please see http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#select -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] DAL ignoring accents
Hello! Is there any way to do searches with DAL (sqlite database) ignoring accents? Thank you very much in advance! Wonton. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] pg8000 driver that comes with web2py 2.8.2 is not supporting JSON field type?
Hi Mariano -- I'd like to encourage you to keep making pg8000 a viable alternative for web2py. I started with it but had to change to psycopg2 because of some issues that postgres handled better under the psy driver. But I think pypy could be the future of python and it won't support a driver like psycopg2 -- but it could support pg8000 since it is all python. It's just good to have an alternative because no driver does it all. -- Joe B. On Tuesday, February 25, 2014 6:55:17 PM UTC-8, Mariano Reingart wrote: Hi Horst: Sadly there have been a lot of changes in pg8000, so it is not backward compatible with the current custom version in web2py. First, you need to delete the pg8000 folder in contrib, and put the new pg8000 folder (the one with __init__.py) directly in the web2py top level folder (at the same level as gluon). Note that the new pg8000 uses absolute imports that will not work if pg8000 is in contrib folder (or it should be added to the PYTHONPATH) Second, you need to apply the attached patch to gluon/dal.py to: * change the import (and add a missing __version__ attribute) * change connection to pass individual parameters (dsn string is not supported anymore) * change after_connection set_client_encoding to execute SQL * change server_version to _server_version I'll propose (again) to the pg8000 group the changes I've introduced for web2py, so the latest version could be used as a direct drop-in replacement for psycopg2 IIRC, at some stage the author gave me commit access, but I didn't have time to pull my changes and missed some discussions about the project internals. Best regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Tue, Feb 25, 2014 at 5:46 PM, Horst Horst spamf...@gmail.comjavascript: wrote: I've tried the latest pg8000 as a drop-in replacement, but it seems web2py can't import it: type 'exceptions.RuntimeError' Failure to connect, tried 5 times: Traceback (most recent call last): File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 7766, in __init__ File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 2756, in __init__ File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 795, in find_driver RuntimeError: no driver available ('psycopg2', 'pg8000') I didn't step through it in the debugger, but the module's __init__.pyc got compiled, so I know web2py attempted an import. The latest pg8000/__init__.py contains a section which matches the former interface # For compatibility with 1.8 import pg8000 as dbapi DBAPI = dbapi pg8000_dbapi = DBAPI so I'd guess it's a minor problem, nonetheless I'm lost at this point. On Monday, February 24, 2014 9:32:05 PM UTC+1, Mariano Reingart wrote: You could try to update pg8000 from the official: https://github.com/mfenniak/pg8000 Let us know if that works, so we could update the one distributed with web2py The one currently distributed in contrib is an older version with custom patches (as it was not being mantained at the time it was included to web2py), but now the official site has updates that could help you in this case. Best regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Mon, Feb 24, 2014 at 10:18 AM, Horst Horst spamf...@gmail.comwrote: I'm getting a: class 'gluon.contrib.pg8000.errors.NotSupportedError' type oid 114 not mapped to py type I'm wondering what's the best thing to do now? Currently I'm considering: - using TEXT instead. But my former JSON strings are then enclosed by | which leads to new errors - updating gp8000 (there seems to be a newer version, but the version numbering is confusing) - using psycopg2. How can I install this into an Mac OS standalone version of web2py? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py
[web2py] Re: run web2y scheduler instances on 2 or more servers
On Friday, February 28, 2014 10:04:59 PM UTC+1, Andrey K wrote: Thank Niphlod for your answer. it is already great if it is possible even theoretically! it does even in the real world :-P Regarding implementation. Correct me please if I am wrong in following understanding - am I right that I need to: 1)copy the whole web2py and myapp with necessary libs to another server . 2)set up db connection in the 2nd box's web2py myapp to remote DB (first server) like: db= DAL('postgres://postgres:a...@196.xx.xx.xx/test', lazy_tables=False, migrate=True, fake_migrate=False) 3) run web2py scheduler on the second box as: web2py.py -K appname exactly Is that all???It is sounds like magic How the second server job scheduler get understanding of calling task? exactly as the one in the original server. All needed informations are right on the scheduler_* tables, nothing else is required. If it works I wonder how to control what server (not worker) get next task - like what should I put in the model to force job be assigned to the the box I want? The workers will coordinate themselves and pick up a new task whenever it's ready to be processed. The whole point of the scheduler is having a task processed ASAP, no matter who processes it: the first available worker will do the job. Usually given that a task is queued and is ready to be processed, you don't even want to know who processes it, as long as it is processed: that's how scheduler works with default settings. That being said, if you want to send a specific task to a worker that exists only in a specific server, you can do so with group_name(s). The concept is having different group of tasks to be processed from schedulers being able to do so (i.e. one has all the libs, other one has only a few, or first one is more powerful, other one is less powerful, etc) You can then specify that a worker has to process only one group of tasks and the other one only another group of tasks. As specified in the book, the syntax to launch schedulers with one or more group_name is python web2py.py -K myapp:group1:group2,myotherapp:group1 in that case, you'd launch python web2py.py -K myapp:original on the original server and python web2py.py -K myapp:additional on the additional one. You can then queue tasks to be processed from the original box as mysched.queue_task(.., group_name='original') and tasks to be processed from the additional one as mysched.queue_task(.., group_name='additional') PS: all combinations of scheduler and group_names are allowedlet's say the additional box will need to help the original one too , then you'll have - 1 worker from the original box processing original - 1 worker from the additional box processing additional AND original then if you launch python web2py.py -K myapp:original on the first box and python web2py.py -K myapp:original:additional on the additional the workers will coordinate to let BOTH workers process tasks with original group_name and only the additional box to process tasks with the additional group. Another example (more complicated): you have a set of tasks that needs precedence (i.e. near real-time execution) and a set of tasks that can be executed with more relax, and 3 boxesyou can do some serious math :-P box1) python web2py.py -K myapp:fast,myapp:fast,myapp:fast box2) python web2py.py -K myapp:relax box3) python web2py.py -K myapp:fast,myapp:fast,myapp:fast:relax now you have fast) 3 workers from box1, 2.5 workers on box1 -- 5.5 workers relax) 1 worker from box2, 0.5 workers on box3 -- 1.5 workers Now, for speech's sake, if all of your tasks take the same time to be executed, and 100 fast and 100 relax tasks have been queued, in the long run you'd observe that: - ~ 54 fast tasks executed by box1 (100 / 5.5 * 3) - ~ 46 fast tasks executed by box3 (100 / 5.5 * 2.5) - ~ 66 relax tasks executed by box2 (100 / 1.5 * 1) - ~ 34 relax tasks executed by box3 (100 / 1.5 * 0.5) Also, you'd observe that to have the last relax task to be executed at the same time of the last fast task, you **can** queue up to 366 fast tasks to match 100 relax tasks (because 5.5 workers are assigned to fast and only 1.5 are assigned to relax tasks)... Hope the whole concept is clear: feel free to ask for more details if needed. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid to update page
type 'exceptions.TypeError' redirect() got an unexpected keyword argument 'vars' On Friday, 28 February 2014 18:34:54 UTC-5, Tim Richardson wrote: In my slice on inline-editable grid ( http://www.web2pyslices.com/slice/show/1928/basic-inline-editing-in-sqlformgrid-no-plugin-no-javascript ) I do this to reload redirect(URL('default','editable_grid',vars=request._get_vars)), ) #preserving _get_vars means user goes back to same grid page, same sort options etc On Saturday, 1 March 2014 04:28:59 UTC+11, horridohobbyist wrote: I have a SQLFORM.grid and I would like to add a link or function to each row that will do something and immediately refresh/update the webpage. Is this possible? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Passing a Variable into a Query
Assuming by db_name you really mean the table name, maybe you want something like this: def db_query(tablename, fieldname): query = (db[tablename].Financial_Institution == auth.user.id) (db[ tablename].Completed == 1) return db(query).select(db[tablename][fieldname]).first()[fieldname] Do you really have multiple tables with Finacial_Institution and Completed fields, and do you really need to do the same query on these tables, except for returning different field values? Otherwise, it's not clear how useful this function is? Note, if you have a DAL table or field name in a variable, you can use db[tablename][fieldname] and row[fieldname] syntax rather than db.tablename.fieldname and row.fieldname (the latter syntax using dot separators represents attribute retrieval and requires the literal attribute names, not variables holding the names). Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid to update page
Notice in Tim's example, vars is an argument of URL(). On Saturday, March 1, 2014 7:40:36 AM UTC-5, horridohobbyist wrote: type 'exceptions.TypeError' redirect() got an unexpected keyword argument 'vars' On Friday, 28 February 2014 18:34:54 UTC-5, Tim Richardson wrote: In my slice on inline-editable grid ( http://www.web2pyslices.com/slice/show/1928/basic-inline-editing-in-sqlformgrid-no-plugin-no-javascript ) I do this to reload redirect(URL('default','editable_grid',vars=request._get_vars)), ) #preserving _get_vars means user goes back to same grid page, same sort options etc On Saturday, 1 March 2014 04:28:59 UTC+11, horridohobbyist wrote: I have a SQLFORM.grid and I would like to add a link or function to each row that will do something and immediately refresh/update the webpage. Is this possible? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: parse_as_rest combined with accessible_query
I've been looking at parse_as_rest(...) myself lately for use as a REST api for AngularJS and after studying the code in DAL I've discovered there are some undocumented features to the parse_as_rest method(...). I'm guessing they are undocumented because it is still considered as experimental and could change in future versions of web2py so YMMV. Basically an item in the `patterns` list can be a tuple with the first item being the pattern as a string and the second item being a DAL query object like so: db.define_table('person',Field('name'),Field('info')) db.define_table('pet',Field('ownedby',db.person),Field('name'),Field('info')) ... patterns = [ /friends[person], /{person.name}/:field, /{person.name}/pets[pet.ownedby], /{person.name}/pets[pet.ownedby]/{pet.name}, /{person.name}/pets[pet.ownedby]/{pet.name}/:field, (/dogs[pet], db.pet.info=='dog'), (/dogs[pet]/{pet.name.startswith}, db.pet.info=='dog'), ] When the pattern is matched the provided query object is included. Since auth.accessible_query(...) returns a DAL query object I'm guessing you could use the patterns list just like any other DAL query. The tuple can also take a third item which can be a list of field names to limit what you want returned from the query: patterns = [ ... (/dogs[pet], db.pet.info=='dog', ['name']), ... ] You can experiment around with this and see if it gets you what you need. But like I stated earlier... it is an experimental feature, so use caution as this could change in future versions of web2py and break your app. FYI: It also looks like a list of queries can be passed into the parse_as_rest(...) method, but I haven't studied the code closely enough to work out exactly how its intended to be used. parse_as_rest(self, patterns, args, vars, queries=None, nested_select=True) Maybe someone who has a better understanding of the current state of the parse_as_rest(...) method can chime in here and add to this and/or correct anything I may be wrong about. On Friday, February 28, 2014 8:50:58 AM UTC-5, Zbigniew Pomianowski wrote: I know I can build standard queries, but is it possible to combine *parse_as_rest(patterns, args, vars)* with *auth.accessible_query(action, table)*? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid to update page
Okay, then, I see another issue... Right now, I'm trying to execute the function by using a link: links=[lambda row: A('Add',_href=URL('add',args=[db.videos,row.id,user_id]))], But this means a new request in the Add function. I really should execute a function *in-place* on the current webpage. How do I do that? Thanks. On Saturday, 1 March 2014 08:30:33 UTC-5, Anthony wrote: Notice in Tim's example, vars is an argument of URL(). On Saturday, March 1, 2014 7:40:36 AM UTC-5, horridohobbyist wrote: type 'exceptions.TypeError' redirect() got an unexpected keyword argument 'vars' On Friday, 28 February 2014 18:34:54 UTC-5, Tim Richardson wrote: In my slice on inline-editable grid ( http://www.web2pyslices.com/slice/show/1928/basic-inline-editing-in-sqlformgrid-no-plugin-no-javascript ) I do this to reload redirect(URL('default','editable_grid',vars=request._get_vars)), ) #preserving _get_vars means user goes back to same grid page, same sort options etc On Saturday, 1 March 2014 04:28:59 UTC+11, horridohobbyist wrote: I have a SQLFORM.grid and I would like to add a link or function to each row that will do something and immediately refresh/update the webpage. Is this possible? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Date format and date picker
Hello all. I'm a little bit disappointed by the date format and datepicker. First my field was like that: Field('concert_date', type='date'), On Firefox no problem. It give me automaticly the possibility to put in the field the local %d/m/%Y format, and this format was accepted by the DAL. When I open this row, date is ok. As Firefox 27 for Windows is incredibly slow, I'm still using Chrome from this morning. With Chrome if I open again this row date it's ok but with the US format %Y-%m-%d. For example 12/03/2014 change in 2014-03-12. It's the default SQL Lite date format, why not. But if I open datepicker, it shows me on the calendar September 4 2017, and calendar is wrong, it shows me April 18 2014 as a Saturday, but it's a Friday. What I want to do is: Choose with datepicker the date format always like %d/m/%Y. Saving the date in DAL as US format %Y-%m-%d Showing in the row the date format as local (%Y-%m-%d or %d/m/%Y) Can you help me ? Thanks, regards. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] current trunk using memdb results in crash
The current trunk does not support using memcache as session store on GAE: session.connect calls memdb.Table.__call__(recordid, unique_key=unique_key) however unique_key is not supported by memdb.Table, it is only supported by dal.Table -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] help with jsonrpc
So I'm trying to connect an android application to my web2py website back end database by using json remote procedure calls. Currently, I am trying to make a simple test function to remotely add entries in the db. Additionally, I am running on GAE. What I have right now is: db.py db.define_table('testing', Field('number_sum','string'), ) default.py def call(): return service() @service.jsonrpc def test_add(a,b): sum = a+b db.testing.insert(numer_sum=sum) return a+b when I run the following in terminal, curl http://domain/app/default/call/run/test_add?a=3b=4 I receive an Object does not exist error. Any help would be appreciated! -Trevor -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: help with jsonrpc
db.testing.insert(numer_sum=sum) Shouldn't the above be number_sum? On Saturday, March 1, 2014 2:46:59 PM UTC-5, Trevor Overman wrote: So I'm trying to connect an android application to my web2py website back end database by using json remote procedure calls. Currently, I am trying to make a simple test function to remotely add entries in the db. Additionally, I am running on GAE. What I have right now is: db.py db.define_table('testing', Field('number_sum','string'), ) default.py def call(): return service() @service.jsonrpc def test_add(a,b): sum = a+b db.testing.insert(numer_sum=sum) return a+b when I run the following in terminal, curl http://domain/app/default/call/run/test_add?a=3b=4 I receive an Object does not exist error. Any help would be appreciated! -Trevor -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] google docs viewer rendered size issue
{{=XML(expand_one( 'http://www.official-notebook.com/notebook/default/download/'+str(update[ 'file']),cache.ram('mycache',lambda:dict(),3600)))}} update['file'] is a file uploaded to my app with a .docx extension which means that it's supposed to open in a google docs viewer. That works fine, but the width and height are fixed and I can't seem to find where to change it. I tried altering the values in the autolinks.py file but i saw no change, I put a div around the xml expand_one code above in hopes of it affecting the rendered iframe, nope! that didn't work too (seems obvious). not sure exactly where to make the uploaded files render in a frame size specified by me or change the size of the youtube embeds... Please help -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: help with jsonrpc
ah you're right.. x.x... unfortunately, I am still receiving the same error. Another thing, when I try accessing the url with a specific port, ex. http://domain:port/app/default/call/run/test_add?a=3b=4http://domain/app/default/call/run/test_add?a=3b=4GAE is sending me a timeout error. hmm... On Saturday, March 1, 2014 3:51:32 PM UTC-5, Anthony wrote: db.testing.insert(numer_sum=sum) Shouldn't the above be number_sum? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] help with jsonrpc
On 1 Mar 2014, at 11:46 AM, Trevor Overman trover...@gmail.com wrote: So I'm trying to connect an android application to my web2py website back end database by using json remote procedure calls. Currently, I am trying to make a simple test function to remotely add entries in the db. Additionally, I am running on GAE. What I have right now is: db.py db.define_table('testing', Field('number_sum','string'), ) default.py def call(): return service() @service.jsonrpc def test_add(a,b): sum = a+b db.testing.insert(numer_sum=sum) return a+b when I run the following in terminal, curl http://domain/app/default/call/run/test_add?a=3b=4 I receive an Object does not exist error. Any help would be appreciated! Change 'run' to 'jsonrpc', since that's how you declared test_add. But curl isn't going to create a jsonrpc request for you, so that part won't work. If you want the curl request to work (with /run/), you need @service.run rather than @service.jsonrpc. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] help with jsonrpc
Finally got things working. For anyone out there reading this, I fixed the problem by utilizing urlfetch in GAE. @service.jsonrpc def test_add(a,b): number_sum = a+b db.testing.insert(number_sum=number_sum) return a+b def test(): from gluon.contrib.simplejsonrpc import ServerProxy from google.appengine.api import urlfetch URL = http://www.conex.us/conexus/default/call/jsonrpc; urlfetch.set_default_fetch_deadline(60) service = ServerProxy(URL, verbose=True) test = service.test_add(1, 2) return test Anyway, thanks for the help! :) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Bug in request_reset_password
Not sure how to report this so posting here, please let me know if there is a separate bug tracking system. Just upgraded an existing web2py installation to 2.8.2-stable+timestamp.2013.11.28.13.54.07 using the 'Check for upgrades' button in Admin. Works fine so far except request_reset_password kept saying 'Invalid username'. I had to do this in gluon/tools.py to fix it: 2918c2918 user = table_user(**{userfield:form.vars.email}) --- user = table_user(**{userfield:form.vars[userfield]}) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid to update page
I'm probably not following you, but if you want the server to do something resulting in new content on the page, you either instigate a new request via a URL (which I think is known as the REST method), or use AJAX to fetch data from the server (and then use javascript to update part of the page). the links method is a REST approach. It has to create a request and a page reload, that's the way it works. Using AJAX is easy with web2py, see the chapter on components. In this case the action on your link can not be a URL since this makes a request page load. You would execute javascript instead. REST is simpler I think. AJAX is a smoother user experience (there is no page reload, for example). On Sunday, 2 March 2014 03:34:41 UTC+11, horridohobbyist wrote: Okay, then, I see another issue... Right now, I'm trying to execute the function by using a link: links=[lambda row: A('Add',_href=URL('add',args=[db.videos,row.id ,user_id]))], But this means a new request in the Add function. I really should execute a function *in-place* on the current webpage. How do I do that? Thanks. On Saturday, 1 March 2014 08:30:33 UTC-5, Anthony wrote: Notice in Tim's example, vars is an argument of URL(). On Saturday, March 1, 2014 7:40:36 AM UTC-5, horridohobbyist wrote: type 'exceptions.TypeError' redirect() got an unexpected keyword argument 'vars' On Friday, 28 February 2014 18:34:54 UTC-5, Tim Richardson wrote: In my slice on inline-editable grid ( http://www.web2pyslices.com/slice/show/1928/basic-inline-editing-in-sqlformgrid-no-plugin-no-javascript ) I do this to reload redirect(URL('default','editable_grid',vars=request._get_vars)), ) #preserving _get_vars means user goes back to same grid page, same sort options etc On Saturday, 1 March 2014 04:28:59 UTC+11, horridohobbyist wrote: I have a SQLFORM.grid and I would like to add a link or function to each row that will do something and immediately refresh/update the webpage. Is this possible? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Bug in request_reset_password
On Sunday, 2 March 2014 14:49:24 UTC+11, pepper_bg wrote: Not sure how to report this so posting here, please let me know if there is a separate bug tracking system. This is supposed to help : reporting bugs: http://web2py.com/books/default/chapter/29/15/helping-web2py#Helping-web2py--Bugs--enhancements-and-documentation which actually encourages you to first discuss it here, and then you may be asked to file an issue on google code. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Bug in request_reset_password
I assume you see this for a specific app. Is this app configured for login via usernames or via email addresses? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Date format and date picker
I try to consider that a field defined as Date is a Date in the python sense, not a string representation. In some backends it may be a stored as a string, but I consider that the private business of the database. The DAL gives back a Date. (If it was stored as a string I would hope that it was ISO format, -MM-DD). But really, it's a Date. You can convert Dates to strings with the Python dateutil library. As for datepicker, this thread may help (or search for datepicker localise): https://groups.google.com/forum/#!searchin/web2py/datepicker$20date$20format/web2py/pvAbhedCPIg/wpj-u_22xG4J On Sunday, 2 March 2014 03:49:36 UTC+11, Gael Princivalle wrote: Hello all. I'm a little bit disappointed by the date format and datepicker. First my field was like that: Field('concert_date', type='date'), On Firefox no problem. It give me automaticly the possibility to put in the field the local %d/m/%Y format, and this format was accepted by the DAL. When I open this row, date is ok. As Firefox 27 for Windows is incredibly slow, I'm still using Chrome from this morning. With Chrome if I open again this row date it's ok but with the US format %Y-%m-%d. For example 12/03/2014 change in 2014-03-12. It's the default SQL Lite date format, why not. But if I open datepicker, it shows me on the calendar September 4 2017. What I want to do is: Choose with datepicker the date format always like %d/m/%Y. Saving the date in DAL as US format %Y-%m-%d Showing in the row the date format as local (%Y-%m-%d or %d/m/%Y) Can you help me ? Thanks, regards. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.