[web2py] "requires" outside field definition - unexpected behaviour
I have something like: form=SQLFORM.factory( Field('f1', requires=IS_IN_SET(choices)), Field('f2'), requires=IS_IN_SET(choices)) If the requires parameter is inadvertently placed outside a field definition it doesn't generate an error, and the form will "kinda" work - but not as expected "Requires" is not a parameter of sqlform so why doesn't it raise an exception?
[web2py] contrib.populate and uuid
On Web2Py v 1.94.5: db.define_table('person',Field('person_uuid', notnull=True, default=uuid.uuid4(), writable=False, unique=True)) from gluon.contrib.populate import populate populate(db.person, 50) Calling contrib.populate generates an error: "IntegrityError: column person_uuid is not unique" because it doesn't create the necessary uuid for each record it creates for said table. I tried it without the 'unique=True' parameter and records are generated but all the records share the same uuid.
Re: [web2py] we need a few more good people!
In the country list there is a 'None' country, I think this is a bug
[web2py] Re: routing maps underscore to hyphens
Perhaps at least it can be fixed to accept hyphens in the app name? The only problem is with function names, correct?
Re: [web2py] Re: strange behavior
On Mar 30, 2011, at 10:09 PM, VP wrote: > > Where would I issue this function call? Would it be easier if admin > is modified so as this call is issued whenever an app is created/ > deleted ? I'll send Massimo a patch for admin, but of course admin isn't always around. Just create a function in some controller that does nothing but make that call and then redirect anywhere you like. That should do the trick. > > Thanks. > > On Mar 30, 11:58 pm, Jonathan Lundell wrote: >> On Mar 30, 2011, at 9:43 PM, VP wrote: >> >> >> >>> i'm using 1.94.6 with router. When I created a new application, I >>> must restart apache in order for the application to get recognized. >>> Otherwise, its URL is not accessible. >> >> You ought to be able to just reload the routing table, I think: >> gluon.rewrite.load(). The router needs to discover the names of your apps in >> order to properly do the defaults. >> >> We were talking about adding a command to the admin app to do that, but I >> don't think we ever got around to it.
[web2py] Re: routing maps underscore to hyphens
Thanks. On Mar 30, 11:52 pm, Jonathan Lundell wrote: > On Mar 30, 2011, at 9:15 PM, VP wrote: > > > > > Thanks. > > > Is there a way to turn this off globally for all apps? Or do I have > > to turn it off for each app by specifying hyphen_map=False for each > > app dictionary? > > Just put hyphen_map=False in the BASE dictionary, and it'll set the default > for all your apps. > > > > > > > > > > > Thanks. > > > On Mar 30, 9:35 pm, Jonathan Lundell wrote: > >> On Mar 30, 2011, at 7:25 PM, VP wrote: > > >>> I actually found the opposite of this. Namely, it maps underscores to > >>> hyphens, as I described above. Note that, my app's name has > >>> underscores; but my controllers have none. > > >> At any rate, you can turn the mapping off. > > >> The mapping is between hyphens in the URL to underscores internally. > > >>> On Mar 30, 6:08 pm, Jonathan Lundell wrote: > On Mar 30, 2011, at 3:59 PM, VP wrote: > > > I think this is whatt he new routing mechanism does. Is this right? > > Is there a technical reason why? > > > My app's name has a hyphen in it. And the links are all broken. > > By default, the new router maps hyphens in URLs (for the > app/controller/function) to underscores, to make them valid Python > identifiers. > > Put map_hyphen = False in the routing dictionary to disable the > translation.
[web2py] Re: strange behavior
Where would I issue this function call? Would it be easier if admin is modified so as this call is issued whenever an app is created/ deleted ? Thanks. On Mar 30, 11:58 pm, Jonathan Lundell wrote: > On Mar 30, 2011, at 9:43 PM, VP wrote: > > > > > i'm using 1.94.6 with router. When I created a new application, I > > must restart apache in order for the application to get recognized. > > Otherwise, its URL is not accessible. > > You ought to be able to just reload the routing table, I think: > gluon.rewrite.load(). The router needs to discover the names of your apps in > order to properly do the defaults. > > We were talking about adding a command to the admin app to do that, but I > don't think we ever got around to it.
Re: [web2py] strange behavior
On Mar 30, 2011, at 9:43 PM, VP wrote: > > i'm using 1.94.6 with router. When I created a new application, I > must restart apache in order for the application to get recognized. > Otherwise, its URL is not accessible. You ought to be able to just reload the routing table, I think: gluon.rewrite.load(). The router needs to discover the names of your apps in order to properly do the defaults. We were talking about adding a command to the admin app to do that, but I don't think we ever got around to it.
Re: [web2py] Re: routing maps underscore to hyphens
On Mar 30, 2011, at 9:15 PM, VP wrote: > > Thanks. > > Is there a way to turn this off globally for all apps? Or do I have > to turn it off for each app by specifying hyphen_map=False for each > app dictionary? Just put hyphen_map=False in the BASE dictionary, and it'll set the default for all your apps. > > Thanks. > > On Mar 30, 9:35 pm, Jonathan Lundell wrote: >> On Mar 30, 2011, at 7:25 PM, VP wrote: >> >> >> >>> I actually found the opposite of this. Namely, it maps underscores to >>> hyphens, as I described above. Note that, my app's name has >>> underscores; but my controllers have none. >> >> At any rate, you can turn the mapping off. >> >> The mapping is between hyphens in the URL to underscores internally. >> >> >> >> >> >> >> >> >> >>> On Mar 30, 6:08 pm, Jonathan Lundell wrote: On Mar 30, 2011, at 3:59 PM, VP wrote: >> > I think this is whatt he new routing mechanism does. Is this right? > Is there a technical reason why? >> > My app's name has a hyphen in it. And the links are all broken. >> By default, the new router maps hyphens in URLs (for the app/controller/function) to underscores, to make them valid Python identifiers. >> Put map_hyphen = False in the routing dictionary to disable the translation.
[web2py] Re: routing maps underscore to hyphens
I'm not either. Many apps often have underscores, and if I use router as routes.py, the default behavior breaks it. On Mar 30, 11:37 pm, pbreit wrote: > I'm still not sure I'm comfortable with this as default functionality but > maybe that's my bias on URLs being sacred!I'
[web2py] strange behavior
i'm using 1.94.6 with router. When I created a new application, I must restart apache in order for the application to get recognized. Otherwise, its URL is not accessible.
Re: [web2py] Re: routing maps underscore to hyphens
I'm still not sure I'm comfortable with this as default functionality but maybe that's my bias on URLs being sacred!
[web2py] Re: routing maps underscore to hyphens
Thanks. Is there a way to turn this off globally for all apps? Or do I have to turn it off for each app by specifying hyphen_map=False for each app dictionary? Thanks. On Mar 30, 9:35 pm, Jonathan Lundell wrote: > On Mar 30, 2011, at 7:25 PM, VP wrote: > > > > > I actually found the opposite of this. Namely, it maps underscores to > > hyphens, as I described above. Note that, my app's name has > > underscores; but my controllers have none. > > At any rate, you can turn the mapping off. > > The mapping is between hyphens in the URL to underscores internally. > > > > > > > > > > > On Mar 30, 6:08 pm, Jonathan Lundell wrote: > >> On Mar 30, 2011, at 3:59 PM, VP wrote: > > >>> I think this is whatt he new routing mechanism does. Is this right? > >>> Is there a technical reason why? > > >>> My app's name has a hyphen in it. And the links are all broken. > > >> By default, the new router maps hyphens in URLs (for the > >> app/controller/function) to underscores, to make them valid Python > >> identifiers. > > >> Put map_hyphen = False in the routing dictionary to disable the > >> translation.
[web2py] odata
what do you think about this? http://www.odata.org/developers/protocols/uri-conventions perhaps the new db.parse_as_rest(patterns,args,vars) should also support odata formats db.parse_as_rest('odata',args,vars) It would not take that much work. Is it valuable?
[web2py] Re: getting json output with variables/args
On Mar 31, 10:05 am, Anthony wrote: > You can also apply the as_dict() method to the row before returning it, as > described here:http://web2py.com/book/default/chapter/06#as_dict-and-as_list > > Anthony > > Thanks guys. That worked. I tried as_list, and didn't consider as_dict. > > > > > > On Wednesday, March 30, 2011 10:00:05 PM UTC-4, DenesL wrote: > > > You are returning a whole record, which contains un-serializable > > objects. > > Try returning specific fields only: > > > return dict(name=db.table.name, age=db.table.age, ...) > > > On Mar 30, 9:05 pm, kedai wrote: > > > On Mar 30, 11:45 pm, Jonathan Lundell wrote: > > > > > On Mar 30, 2011, at 8:28 AM, kedai wrote: > > > > > > tried that, returned no json. that was my first guess too > > > > > Is the controller getting invoked? What does it do? > > > > > That ought to work, unless there's a routing problem or the like. I > > think... > > > > Here's the controller > > > > default.py > > > > def single(): > > > record = db(db.table_name.dun_id == > > > request.args(0)).select().first() > > > return dict(record=record) > > > > if I do /controller/single/N3, I got the expected result. If I do / > > > controller/single.json/N3, I got no json > > > > tia > > > > > > On Mar 30, 10:43 pm, DenesL wrote: > > > > >> controller/myfunction.json/arg > > > > > >> On Mar 30, 10:01 am, kedai wrote: > > > > > >>> hey guys. > > > > > >>> Q: If I have controller/myfunction; I know i can get json by doing > > > > >>> this controller/myfunction.json > > > > >>> However, I have controller/function/arg; how do I get json output > > when > > > > >>> arg will be determined when we call the function. > > > > > >>> Thanks for any pointers/help
[web2py] Re: PluginMModal in plugin_wiki page
Hello : it works fine thank you!! and thanks for flexibility of Web2py. On 3月31日, 午前2:24, mart wrote: > Here's an example (assumes you have the modal resources - I.e. the > modalPlugin): > > ... whatever happens here > > `` > {{stuffYouWantInTheModal=plugin_wiki.widget('update', > table='recipe', > record_id='name', > message=\ > 'stuffRecord updated')}}``:template`` > > {{a=PluginMModal(title='some title', > content=stuffYouWantInTheModal, > close='close', > callback="URL(load_action)", > width=30, > height=40)}}``:template`` > {{=a}} > {{=a.link('[name for this link]')}} > > Hope it helps, > Mart :) > > On Mar 30, 9:28 am, danto wrote: > > > > > 2011/3/29 kawate > > > > Hell: > > > > Please advise me to show PluginMModal window in plugin_wiki page. > > > > Best Regards: > > > Web2py is better than that. You shoud try asking "Heaven" or "Fellowship" > > regards
Re: [web2py] Re: routing maps underscore to hyphens
On Mar 30, 2011, at 7:25 PM, VP wrote: > > I actually found the opposite of this. Namely, it maps underscores to > hyphens, as I described above. Note that, my app's name has > underscores; but my controllers have none. At any rate, you can turn the mapping off. The mapping is between hyphens in the URL to underscores internally. > > > On Mar 30, 6:08 pm, Jonathan Lundell wrote: >> On Mar 30, 2011, at 3:59 PM, VP wrote: >> >> >> >>> I think this is whatt he new routing mechanism does. Is this right? >>> Is there a technical reason why? >> >>> My app's name has a hyphen in it. And the links are all broken. >> >> By default, the new router maps hyphens in URLs (for the >> app/controller/function) to underscores, to make them valid Python >> identifiers. >> >> Put map_hyphen = False in the routing dictionary to disable the translation.
[web2py] Re: routing maps underscore to hyphens
I actually found the opposite of this. Namely, it maps underscores to hyphens, as I described above. Note that, my app's name has underscores; but my controllers have none. On Mar 30, 6:08 pm, Jonathan Lundell wrote: > On Mar 30, 2011, at 3:59 PM, VP wrote: > > > > > I think this is whatt he new routing mechanism does. Is this right? > > Is there a technical reason why? > > > My app's name has a hyphen in it. And the links are all broken. > > By default, the new router maps hyphens in URLs (for the > app/controller/function) to underscores, to make them valid Python > identifiers. > > Put map_hyphen = False in the routing dictionary to disable the translation.
[web2py] Re: getting json output with variables/args
You can also apply the as_dict() method to the row before returning it, as described here: http://web2py.com/book/default/chapter/06#as_dict-and-as_list Anthony On Wednesday, March 30, 2011 10:00:05 PM UTC-4, DenesL wrote: > > You are returning a whole record, which contains un-serializable > objects. > Try returning specific fields only: > > return dict(name=db.table.name, age=db.table.age, ...) > > > On Mar 30, 9:05 pm, kedai wrote: > > On Mar 30, 11:45 pm, Jonathan Lundell wrote: > > > > > On Mar 30, 2011, at 8:28 AM, kedai wrote: > > > > > > tried that, returned no json. that was my first guess too > > > > > Is the controller getting invoked? What does it do? > > > > > That ought to work, unless there's a routing problem or the like. I > think... > > > > Here's the controller > > > > default.py > > > > def single(): > > record = db(db.table_name.dun_id == > > request.args(0)).select().first() > > return dict(record=record) > > > > if I do /controller/single/N3, I got the expected result. If I do / > > controller/single.json/N3, I got no json > > > > tia > > > > > > > > > > > > > > > > > > > > > > On Mar 30, 10:43 pm, DenesL wrote: > > > >> controller/myfunction.json/arg > > > > > >> On Mar 30, 10:01 am, kedai wrote: > > > > > >>> hey guys. > > > > > >>> Q: If I have controller/myfunction; I know i can get json by doing > > > >>> this controller/myfunction.json > > > >>> However, I have controller/function/arg; how do I get json output > when > > > >>> arg will be determined when we call the function. > > > > > >>> Thanks for any pointers/help
[web2py] Re: getting json output with variables/args
You are returning a whole record, which contains un-serializable objects. Try returning specific fields only: return dict(name=db.table.name, age=db.table.age, ...) On Mar 30, 9:05 pm, kedai wrote: > On Mar 30, 11:45 pm, Jonathan Lundell wrote: > > > On Mar 30, 2011, at 8:28 AM, kedai wrote: > > > > tried that, returned no json. that was my first guess too > > > Is the controller getting invoked? What does it do? > > > That ought to work, unless there's a routing problem or the like. I think... > > Here's the controller > > default.py > > def single(): > record = db(db.table_name.dun_id == > request.args(0)).select().first() > return dict(record=record) > > if I do /controller/single/N3, I got the expected result. If I do / > controller/single.json/N3, I got no json > > tia > > > > > > > > > > > > On Mar 30, 10:43 pm, DenesL wrote: > > >> controller/myfunction.json/arg > > > >> On Mar 30, 10:01 am, kedai wrote: > > > >>> hey guys. > > > >>> Q: If I have controller/myfunction; I know i can get json by doing > > >>> this controller/myfunction.json > > >>> However, I have controller/function/arg; how do I get json output when > > >>> arg will be determined when we call the function. > > > >>> Thanks for any pointers/help
[web2py] Re: getting json output with variables/args
On Mar 30, 11:45 pm, Jonathan Lundell wrote: > On Mar 30, 2011, at 8:28 AM, kedai wrote: > > > > > tried that, returned no json. that was my first guess too > > Is the controller getting invoked? What does it do? > > That ought to work, unless there's a routing problem or the like. I think... Here's the controller default.py def single(): record = db(db.table_name.dun_id == request.args(0)).select().first() return dict(record=record) if I do /controller/single/N3, I got the expected result. If I do / controller/single.json/N3, I got no json tia > > > > > > > > > > > On Mar 30, 10:43 pm, DenesL wrote: > >> controller/myfunction.json/arg > > >> On Mar 30, 10:01 am, kedai wrote: > > >>> hey guys. > > >>> Q: If I have controller/myfunction; I know i can get json by doing > >>> this controller/myfunction.json > >>> However, I have controller/function/arg; how do I get json output when > >>> arg will be determined when we call the function. > > >>> Thanks for any pointers/help
Re: [web2py] Re: Error in local_import()
On Mar 30, 2011, at 5:37 PM, contatogilson...@gmail.com wrote: > But doing the import from site-packages, to make deployed on Google App > Engine it will be able to use the modules? We're talking about web2py/site-packages. Create the directory if necessary in the web2py base directory. The modules will have to be compatible with GAE and its Python version, of course.
[web2py] Re: web2py 1.94.6
OK, thanks. Now, it passed brief tests of my project. On 3月31日, 午前5:18, Massimo Di Pierro wrote: > I think this is not fixed. Can you please check it in trunk. If not > please open a googlecode issue > > On Mar 28, 4:51 am, kenji4569 wrote: > > > > > > > > > The virtualfields functionality with join query dosen't work in 1.94.6 > > while it works in 1.94.5, as follows: > > > >>> t1 = db.define_table('t1', Field('val', 'integer')) > > >>> t2 = db.define_table('t2', Field('t1', db.t1), Field('val', 'integer')) > > >>> class VirtualFields(object): > > > ... def val2(self): > > ... return self.t2.val * 2 > > ... > > > >>> t2.virtualfields.append(VirtualFields()) > > >>> t1_id = t1.insert(val=1) > > >>> t2_id = t2.insert(t1=t1_id, val=2) > > >>> record = db(t2.id==t2_id).select().first() > > >>> assert(record.val2==4) #OK > > >>> record = db(t1.val==1)(t2.id==t1.id).select().first() > > >>> assert(record.t2.val2==4) #NG > > > Failed example: > > assert(record.t2.val2==4) #NG > > Exception raised: > > ... > > KeyError: 'val2' > > > I think it's a major bug, > > or is the API changed? > > > On 3月28日, 午前6:24, Praneeth Bodduluri wrote: > > > > Hello Massimo, > > > > I can help maintain the PyPI uploading for every new revision. > > > > -- > > > Praneeth > > > IRC: lifeeth > > > > On Sun, Mar 27, 2011 at 11:17 PM, Massimo Di Pierro > > > > wrote: > > > > I can do it. Do you want to be in charge of it? > > > > > Massimo > > > > > On Mar 27, 2011, at 12:43 PM, Praneeth Bodduluri wrote: > > > > >> python setup.py sdist upload
Re: [web2py] Re: Error in local_import()
But doing the import from site-packages, to make deployed on Google App Engine itwill be able to use the modules? _ *Gilson Filho* *Web Developer http://gilsondev.com* 2011/3/30 Massimo Di Pierro >
[web2py] Re: very slow response (over a minute)
other tips: - if you have lots of data, use the --use_sqlite flag to GAE. (you'll have to re-import your data, so set a new datastore file while you are at it). I find that sqlite is much faster on my linux box once the db is more than a few MB big. - even with the --use_sqlite all the /_ah/... request seem to take a long time, i think they parse the entire DB or something. - blobstore uploads involve a bunch of redirects - make sure they are all going to reachable URLs. good luck! cfh
[web2py] Re: web design
It is a very old app, but look into this: http://www.web2py.com/appliances/default/show/14 You can also use jquery tabs for ... tabs: http://jqueryui.com/demos/tabs/ On Mar 30, 5:26 pm, roachfro wrote: > Pardon me if I'm posting to the wrong area. I've been tasked with > developing a web application which gives folks who aren't familiar > with UNIX access to re-run scripts and view ftp and error logs for > scripts which are kicked off by the AIX crontab. It's been a while > since I made a webpage...the last being made with cherrypy like 7 > years ago. > > I'd like to create a page with a tab for each script, showing the > times it runs, a calendar control to have the script run using a > different date than today's date, a button to re-run the script, and > an area to show ftp, error logs, and probably a listing of a directory > to view what files have been received. > > Would I use a web designer to create the page template (fields, > controls, etc) and refer to it within the web2py application, > programmatically modifying as needed? Or would I create the page in > web2py somehow? I was thinking I'd do a listing of the crontab to > know how many tabs to create and grab other necessary info like times > and script names. > > I'm sorry for needing such elementary help. It seems there are a lot > of paths to web design these days and I'm kinda over whelmed on what's > the easiest way to accomplish my task. I am familiar with python > which is why I chose web2py. Thanks for any help. > > Allen
[web2py] Re: how to deal with hosting?
I run on vps.net and I am very happy with it. I cannot imaging the process being easier. It costs $25/month for a dedicated virtual private server, daily, weekly and monthly backups. Massimo On Mar 30, 6:34 pm, pbreit wrote: > Pythin hosting is not as straightforward as html or php hosting. People like > webfaction. I personally like going cloud (rackspace, amazon, linode). You > also might consider google app engine which is free and supported by web2py.
[web2py] Re: Error in local_import()
You have to look int them and change the imports. For example modules/package/a.py import package.b end modules/package/b.py import package.a end must be changed into modules/package/a.py import b end modules/package/b.py import a end because package is not in path (unless you follow Jonathan advice and you put it in site-packages). for the record, this is because sys.path is not thread safe and we cannot app all apps to sys.path without generating conflicts. On Mar 30, 5:21 pm, "contatogilson...@gmail.com" wrote: > So what can I do to fix this. These modules would have to be in the folder > modulesbecause I'm going to play such an application on Google App Engine. > _ > *Gilson Filho* > *Web Developerhttp://gilsondev.com* > > 2011/3/30 Massimo Di Pierro > > > > > > > > > I believe the problem is that the module expects to be in sys.path. > > Some python modules are very selfish and assume that. > > > On Mar 30, 12:12 pm, "contatogilson...@gmail.com" > > wrote: > > > I researched the list of the error of using local_import (), but without > > > success. I used the "import applications.app.modules.script as Script" > > and > > > other ideas did not work. Howshould I do about it? > > > > The error: ImportError: No module named testapp.modules.FormatTweets > > > > _ > > > *Gilson Filho* > > > *Web Developerhttp://gilsondev.com*
[web2py] web design
Pardon me if I'm posting to the wrong area. I've been tasked with developing a web application which gives folks who aren't familiar with UNIX access to re-run scripts and view ftp and error logs for scripts which are kicked off by the AIX crontab. It's been a while since I made a webpage...the last being made with cherrypy like 7 years ago. I'd like to create a page with a tab for each script, showing the times it runs, a calendar control to have the script run using a different date than today's date, a button to re-run the script, and an area to show ftp, error logs, and probably a listing of a directory to view what files have been received. Would I use a web designer to create the page template (fields, controls, etc) and refer to it within the web2py application, programmatically modifying as needed? Or would I create the page in web2py somehow? I was thinking I'd do a listing of the crontab to know how many tabs to create and grab other necessary info like times and script names. I'm sorry for needing such elementary help. It seems there are a lot of paths to web design these days and I'm kinda over whelmed on what's the easiest way to accomplish my task. I am familiar with python which is why I chose web2py. Thanks for any help. Allen
[web2py] Question about how to customize registration process.
Thanks for reading this question and answering for me! I am currently work on school project and need to customize use registration process.I read through the official document and survey solutions, but it's hardly to answer the question. The reason I need to customize the registration process, because I have several verification process before I create the user. For example, I want to send SMS via twillo and assign specific membership to the user. I also notice there is a register function under gluon/tools.py. It looks possible to customize the registration process there, but I don't it's a good idea to change in core functions. Thanks for answering this question!!! I really appreciate it!
[web2py] how to deal with hosting?
Pythin hosting is not as straightforward as html or php hosting. People like webfaction. I personally like going cloud (rackspace, amazon, linode). You also might consider google app engine which is free and supported by web2py.
[web2py] Re: Join breaks virtual fields in the new web2py
Looks good; change matches my updates. Will reconfirm with the next build, thanks! On Mar 30, 6:01 pm, Massimo Di Pierro wrote: > This was fixed today in trunk. Can you please check it? > > On Mar 30, 4:58 pm, Chris wrote: > > > > > > > > > Hey all, > > > I've been tearing my hair out over this one. I just updated from 1.91 > > to 1.94 and can't get virtual fields to work properly on a join/group > > select. > > > I found where the virtual field gets added in 1.91 - gluon/dal.py/ > > BaseAdapter.parse: 1265 > > for table, virtualfields in virtualtables: > > for item in virtualfields: > > try: > > rowsobj = rowsobj.setvirtualfields(**{table:item}) > > except KeyError: > > # to avoid breaking virtualfields when partial > > select > > pass > > > The problem with the new replacement iterator is that tablename > > doesn't iterate. dal.py:1342: > > for table in virtualtables: > > for item in db[tablename].virtualfields: > > try: > > rowsobj = rowsobj.setvirtualfields(**{table:item}) > > except KeyError: > > # to avoid breaking virtualfields when partial > > select > > pass > > > I've temporarily updated that locally; can that be patched? > > > Thanks, > > Chris
Re: [web2py] routing maps underscore to hyphens
On Mar 30, 2011, at 3:59 PM, VP wrote: > > I think this is whatt he new routing mechanism does. Is this right? > Is there a technical reason why? > > My app's name has a hyphen in it. And the links are all broken. By default, the new router maps hyphens in URLs (for the app/controller/function) to underscores, to make them valid Python identifiers. Put map_hyphen = False in the routing dictionary to disable the translation.
[web2py] Re: routing maps underscore to hyphens
Specifically, i used to have URL('static', 'base.css') which translated to /my-app-name/static/base.css, which is of course an incorrect path (as far as Apache is concerned). On Mar 30, 5:59 pm, VP wrote: > I think this is whatt he new routing mechanism does. Is this right? > Is there a technical reason why? > > My app's name has a hyphen in it. And the links are all broken.
[web2py] routing maps underscore to hyphens
I think this is whatt he new routing mechanism does. Is this right? Is there a technical reason why? My app's name has a hyphen in it. And the links are all broken.
[web2py] Re: ckeditor integration
That's great. But forgive my ignorance, I've no idea how that helps me. From what the book says, plugin-wiki is for creating pages. I just wanna use the wsywig editor aspect of it for (essentially) a comment entry form. I see it has all kinds of nice widgets - that can be used *in* pages. But how, if at all are those applicable in a more generic sense? Again, these are just regular users who I want to allow to embed stuff. As before, I'd also take working Markmin embeds - but when I tried it just renders the player and says 'Loading'. Of course, images and other Markmin markup works fine. thanks! On Mar 30, 2:50 pm, Massimo Di Pierro wrote: > plugin_wiki has an optional flag > > plugins.wiki.mode='html' > > to switch to wysiwyg html. It uses elrte, not ckeditor. > > On Mar 30, 12:50 pm, pbreit wrote: > > > > > A CKEditor implementation would be great to see!
Re: [web2py] Re: Error in local_import()
On Mar 30, 2011, at 3:21 PM, contatogilson...@gmail.com wrote: > So what can I do to fix this. These modules would have to be in the folder > modulesbecause I'm going to play such an application on Google App Engine. Did you try putting them in site-packages?
Re: [web2py] Re: get by date interval
Massimo, I agree. Please open a googlecode issue and I will try add this next > week. > Great, thanks. Issue 226: http://code.google.com/p/web2py/issues/detail?id=226 Dave PS It would be good to have a more obvious link to google code on the website. Maybe a page for Developers with details about the source code etc. -- Dave Warnock: http://42.blogs.warnock.me.uk Cycling Blog: http://42bikes.warnock.me.uk
Re: [web2py] Re: Error in local_import()
So what can I do to fix this. These modules would have to be in the folder modulesbecause I'm going to play such an application on Google App Engine. _ *Gilson Filho* *Web Developer http://gilsondev.com* 2011/3/30 Massimo Di Pierro > I believe the problem is that the module expects to be in sys.path. > Some python modules are very selfish and assume that. > > On Mar 30, 12:12 pm, "contatogilson...@gmail.com" > wrote: > > I researched the list of the error of using local_import (), but without > > success. I used the "import applications.app.modules.script as Script" > and > > other ideas did not work. Howshould I do about it? > > > > The error: ImportError: No module named testapp.modules.FormatTweets > > > > _ > > *Gilson Filho* > > *Web Developerhttp://gilsondev.com*
[web2py] Re: get by date interval
I agree. Please open a googlecode issue and I will try add this next week. Massimo On Mar 30, 5:13 pm, David Warnock wrote: > Massimo, > > They map into one sql query and they execute on each record on the db > > > side. I do not know how efficient they are. > > It appears to me that it would be really helpful if we could set a flag so > that Web2py would log all the SQL statements that it executes. If the log > could include source code reference (to the controller/model) and execution > time then it would be really helpful for performance work as well as working > out what is happening under the covers. > > Without this we are never going to be able to answer the questions about > efficiency. > > Thanks > > Dave > > -- > Dave Warnock:http://42.blogs.warnock.me.uk > Cycling Blog:http://42bikes.warnock.me.uk
Re: [web2py] Re: get by date interval
Massimo, They map into one sql query and they execute on each record on the db > side. I do not know how efficient they are. > It appears to me that it would be really helpful if we could set a flag so that Web2py would log all the SQL statements that it executes. If the log could include source code reference (to the controller/model) and execution time then it would be really helpful for performance work as well as working out what is happening under the covers. Without this we are never going to be able to answer the questions about efficiency. Thanks Dave -- Dave Warnock: http://42.blogs.warnock.me.uk Cycling Blog: http://42bikes.warnock.me.uk
Re: [web2py] Re: get by date interval
The easiest way is probably to test it, now = request.now for i in range(0:10):#or maybe 0,100 records = query return request.now - now Do this with both queries and you´ll see which one is faster. Kenneth They map into one sql query and they execute on each record on the db side. I do not know how efficient they are. Massimo On Mar 30, 4:16 pm, LightOfMooN wrote: I use this query on big massive of records. I don't know what .month() and .year() does. Are they the functions, which works on python level, or are they just a functions, which form some query for database? (I use postgres) So, if .month() and .year() executes on each record, I think, it's too slow. But if it executes one time per query, it can be faster than 1st. On 31 мар, 01:53, Kenneth Lundström wrote: For some reason I think query2 would be faster, but it s just a gut thought. Can t base it on anything, not even experience. And I think your first query doesn t include first day of month at the moment. Kenneth start_date = datetime(year=show_year, month=show_month, day=1, hour=0, minute=0, second=0) if show_month == 12: end_date = datetime(year=show_year+1, month=1, day=1, hour=0, minute=0, second=0) else: end_date = datetime(year=show_year, month=show_month+1, day=1, hour=0, minute=0, second=0) There are two same queries: datequery1 = (db.indications.date>start_date)&(db.indications.date< end_date) datequery2 = (db.indications.date.year()==show_year)&(db.indications.date.month()==show_ month) I think, the first is faster. Am I right?
[web2py] Re: Join breaks virtual fields in the new web2py
This was fixed today in trunk. Can you please check it? On Mar 30, 4:58 pm, Chris wrote: > Hey all, > > I've been tearing my hair out over this one. I just updated from 1.91 > to 1.94 and can't get virtual fields to work properly on a join/group > select. > > I found where the virtual field gets added in 1.91 - gluon/dal.py/ > BaseAdapter.parse: 1265 > for table, virtualfields in virtualtables: > for item in virtualfields: > try: > rowsobj = rowsobj.setvirtualfields(**{table:item}) > except KeyError: > # to avoid breaking virtualfields when partial > select > pass > > The problem with the new replacement iterator is that tablename > doesn't iterate. dal.py:1342: > for table in virtualtables: > for item in db[tablename].virtualfields: > try: > rowsobj = rowsobj.setvirtualfields(**{table:item}) > except KeyError: > # to avoid breaking virtualfields when partial > select > pass > > I've temporarily updated that locally; can that be patched? > > Thanks, > Chris
[web2py] Join breaks virtual fields in the new web2py
Hey all, I've been tearing my hair out over this one. I just updated from 1.91 to 1.94 and can't get virtual fields to work properly on a join/group select. I found where the virtual field gets added in 1.91 - gluon/dal.py/ BaseAdapter.parse: 1265 for table, virtualfields in virtualtables: for item in virtualfields: try: rowsobj = rowsobj.setvirtualfields(**{table:item}) except KeyError: # to avoid breaking virtualfields when partial select pass The problem with the new replacement iterator is that tablename doesn't iterate. dal.py:1342: for table in virtualtables: for item in db[tablename].virtualfields: try: rowsobj = rowsobj.setvirtualfields(**{table:item}) except KeyError: # to avoid breaking virtualfields when partial select pass I've temporarily updated that locally; can that be patched? Thanks, Chris
[web2py] Re: get by date interval
They map into one sql query and they execute on each record on the db side. I do not know how efficient they are. Massimo On Mar 30, 4:16 pm, LightOfMooN wrote: > I use this query on big massive of records. > I don't know what .month() and .year() does. > Are they the functions, which works on python level, or are they just > a functions, which form some query for database? (I use postgres) > So, if .month() and .year() executes on each record, I think, it's too > slow. > But if it executes one time per query, it can be faster than 1st. > > On 31 мар, 01:53, Kenneth Lundström > wrote: > > > > > > > > > For some reason I think query2 would be faster, but it s just a gut > > thought. Can t base it on anything, not even experience. > > > And I think your first query doesn t include first day of month at the > > moment. > > > Kenneth > > > > start_date = datetime(year=show_year, month=show_month, day=1, hour=0, > > > minute=0, second=0) > > > if show_month == 12: > > > end_date = datetime(year=show_year+1, month=1, day=1, hour=0, > > > minute=0, second=0) > > > else: > > > end_date = datetime(year=show_year, month=show_month+1, day=1, > > > hour=0, minute=0, second=0) > > > > There are two same queries: > > > > datequery1 = (db.indications.date> start_date)&(db.indications.date< > > > end_date) > > > datequery2 = > > > (db.indications.date.year()==show_year)&(db.indications.date.month()==show_ > > > month) > > > > I think, the first is faster. Am I right?
[web2py] Re: in-line select for counting purpose
yes. I do not know how to do it with one query. On Mar 30, 3:18 pm, Joaquin Orbe wrote: > On Sat, Mar 26, 2011 at 6:30 PM, Massimo Di Pierro > > > > > > > > > > wrote: > > You an have a nested select in place of a field. > > > I think you want: > > count = db.sales_order.id.count() > > query = db.sales_order.VendorID == db.vendor.id > > rows1 = db(query) > > (db.sales_order.Status==1).select(db.vendor.id,db.vendor.Name,count) > > rows2 = db(query) > > (db.sales_order.Status==2).select(db.vendor.id,db.vendor.Name,count) > > rows3 = db(query) > > (db.sales_order.Status==3).select(db.vendor.id,db.vendor.Name,count) > > > On Mar 26, 3:57 pm, Joaquin Orbe wrote: > >> Hi all, > > >> I'm trying to get a result for this query: > > >> select vendor.id, vendor.Name, > >> (select count(*) from sales_order where [Status] = 1 and vendor.id = > >> sales_order.VendorID), > >> (select count(*) from sales_order where [Status] = 2 and vendor.id = > >> sales_order.VendorID), > >> (select count(*) from sales_order where [Status] = 3 and vendor.id = > >> sales_order.VendorID) > >> from vendor > > >> and for it I do: > > >> countOpen = db((db.sales_order.Status==1)&(db.sales_order.VendorID == > >> db.vendor.id)).count() > >> countProg = db((db.sales_order.Status==2)&(db.sales_order.VendorID == > >> db.vendor.id)).count() > >> countClosed = db((db.sales_order.Status==3)&(db.sales_order.VendorID > >> == db.vendor.id)).count() > > >> rows = db().select(db.vendor.id, > >> db.vendor.Name,countOpen,countProg,countClosed) > > >> but it's not working because I get > > >> (1, vendor1, 1, 4, 1) > >> (2, vendor2, 1, 4, 1) > > >> instead of > > >> (1, vendor1, 1, 4, 1) > >> (2, vendor2, 0, 0, 0) > > >> It seems the result of vendor1 is also applied to vendor2 (vendor2 > >> does not have records in sales_order table). > > >> Does someone know how to solve it? > > >> Thanks in advance, > >> Joaquin. > > Hi Massimo, > sorry for my late answer. > > How should I applied your suggestion? As I can understand, your code > seems to have three row results, and in my case I need only one. Is it > correct my understanding? > > Thanks, > Joaquin.
[web2py] Re: Generating error tickets via admin for testing
Nope. On Mar 30, 2:43 pm, Anthony wrote: > I notice the 'admin' default.py controller includes: > > def error(): > """ Generate a ticket (for testing) """ > raise RuntimeError('admin ticket generator at your service') > > Is there any way to trigger that from the admin interface (I don't see a > link or button anywhere), or do you simply have to manually go to > /admin/error? Is this documented anywhere? > > Thanks. > > Anthony
[web2py] Re: Error in local_import()
I believe the problem is that the module expects to be in sys.path. Some python modules are very selfish and assume that. On Mar 30, 12:12 pm, "contatogilson...@gmail.com" wrote: > I researched the list of the error of using local_import (), but without > success. I used the "import applications.app.modules.script as Script" and > other ideas did not work. Howshould I do about it? > > The error: ImportError: No module named testapp.modules.FormatTweets > > _ > *Gilson Filho* > *Web Developerhttp://gilsondev.com*
[web2py] Re: ckeditor integration
plugin_wiki has an optional flag plugins.wiki.mode='html' to switch to wysiwyg html. It uses elrte, not ckeditor. On Mar 30, 12:50 pm, pbreit wrote: > A CKEditor implementation would be great to see!
[web2py] Re: Bug with error ticket viewing and line numbers
can you please check if this is now fixed in trunk. On Mar 29, 2:42 pm, Chris wrote: > In the error ticket page, my source code is double spaced but the line > numbers aren't. Is that because of *nix line endings or something?
[web2py] Re: Text in admin not bold
Thanks, fixing in trunk On Mar 29, 12:35 pm, "Mr. Electronic" wrote: > Hi > > Minor bug in the web2py admin: > The text: There are no controllers > Is not in bold text like: There are no models > > > > ... > > There are no controllers > > ... > > Br. > Rune Christensen (alias Mr. Electronic)
[web2py] Re: get by date interval
I use this query on big massive of records. I don't know what .month() and .year() does. Are they the functions, which works on python level, or are they just a functions, which form some query for database? (I use postgres) So, if .month() and .year() executes on each record, I think, it's too slow. But if it executes one time per query, it can be faster than 1st. On 31 мар, 01:53, Kenneth Lundström wrote: > For some reason I think query2 would be faster, but it s just a gut > thought. Can t base it on anything, not even experience. > > And I think your first query doesn t include first day of month at the > moment. > > Kenneth > > > > > > > > > start_date = datetime(year=show_year, month=show_month, day=1, hour=0, > > minute=0, second=0) > > if show_month == 12: > > end_date = datetime(year=show_year+1, month=1, day=1, hour=0, > > minute=0, second=0) > > else: > > end_date = datetime(year=show_year, month=show_month+1, day=1, > > hour=0, minute=0, second=0) > > > There are two same queries: > > > datequery1 = (db.indications.date> start_date)&(db.indications.date< > > end_date) > > datequery2 = > > (db.indications.date.year()==show_year)&(db.indications.date.month()==show_ > > month) > > > I think, the first is faster. Am I right?
[web2py] Re: web2py 1.94.6
I think this is not fixed. Can you please check it in trunk. If not please open a googlecode issue On Mar 28, 4:51 am, kenji4569 wrote: > The virtualfields functionality with join query dosen't work in 1.94.6 > while it works in 1.94.5, as follows: > > >>> t1 = db.define_table('t1', Field('val', 'integer')) > >>> t2 = db.define_table('t2', Field('t1', db.t1), Field('val', 'integer')) > >>> class VirtualFields(object): > > ... def val2(self): > ... return self.t2.val * 2 > ... > > >>> t2.virtualfields.append(VirtualFields()) > >>> t1_id = t1.insert(val=1) > >>> t2_id = t2.insert(t1=t1_id, val=2) > >>> record = db(t2.id==t2_id).select().first() > >>> assert(record.val2==4) #OK > >>> record = db(t1.val==1)(t2.id==t1.id).select().first() > >>> assert(record.t2.val2==4) #NG > > Failed example: > assert(record.t2.val2==4) #NG > Exception raised: > ... > KeyError: 'val2' > > I think it's a major bug, > or is the API changed? > > On 3月28日, 午前6:24, Praneeth Bodduluri wrote: > > > > > > > > > Hello Massimo, > > > I can help maintain the PyPI uploading for every new revision. > > > -- > > Praneeth > > IRC: lifeeth > > > On Sun, Mar 27, 2011 at 11:17 PM, Massimo Di Pierro > > > wrote: > > > I can do it. Do you want to be in charge of it? > > > > Massimo > > > > On Mar 27, 2011, at 12:43 PM, Praneeth Bodduluri wrote: > > > >> python setup.py sdist upload
Re: [web2py] Re: in-line select for counting purpose
On Sat, Mar 26, 2011 at 6:30 PM, Massimo Di Pierro wrote: > You an have a nested select in place of a field. > > I think you want: > count = db.sales_order.id.count() > query = db.sales_order.VendorID == db.vendor.id > rows1 = db(query) > (db.sales_order.Status==1).select(db.vendor.id,db.vendor.Name,count) > rows2 = db(query) > (db.sales_order.Status==2).select(db.vendor.id,db.vendor.Name,count) > rows3 = db(query) > (db.sales_order.Status==3).select(db.vendor.id,db.vendor.Name,count) > > > > > > On Mar 26, 3:57 pm, Joaquin Orbe wrote: >> Hi all, >> >> I'm trying to get a result for this query: >> >> select vendor.id, vendor.Name, >> (select count(*) from sales_order where [Status] = 1 and vendor.id = >> sales_order.VendorID), >> (select count(*) from sales_order where [Status] = 2 and vendor.id = >> sales_order.VendorID), >> (select count(*) from sales_order where [Status] = 3 and vendor.id = >> sales_order.VendorID) >> from vendor >> >> and for it I do: >> >> countOpen = db((db.sales_order.Status==1)&(db.sales_order.VendorID == >> db.vendor.id)).count() >> countProg = db((db.sales_order.Status==2)&(db.sales_order.VendorID == >> db.vendor.id)).count() >> countClosed = db((db.sales_order.Status==3)&(db.sales_order.VendorID >> == db.vendor.id)).count() >> >> rows = db().select(db.vendor.id, >> db.vendor.Name,countOpen,countProg,countClosed) >> >> but it's not working because I get >> >> (1, vendor1, 1, 4, 1) >> (2, vendor2, 1, 4, 1) >> >> instead of >> >> (1, vendor1, 1, 4, 1) >> (2, vendor2, 0, 0, 0) >> >> It seems the result of vendor1 is also applied to vendor2 (vendor2 >> does not have records in sales_order table). >> >> Does someone know how to solve it? >> >> Thanks in advance, >> Joaquin. Hi Massimo, sorry for my late answer. How should I applied your suggestion? As I can understand, your code seems to have three row results, and in my case I need only one. Is it correct my understanding? Thanks, Joaquin.
[web2py] Re: ISNULL for sorting NULLs to bottom
Thank you, I am remaning this coalesce_zero and using the coalesce function. Should be more portable. Please check it in trunk in few minutes. Massimo On Mar 29, 2:15 pm, Jim Karsten wrote: > I would like to sort records on a field such that NULL values get > sorted to the end. In MySQL the suggested solution is to use ISNULL. > For example > > SELECT name FROM person ORDER BY ISNULL(name), name; > > I tried other approaches such as sorting the rows returned from a > select but they were not practical as all records need to be retrieved > and in the application I am working on I only want a subset (ie. I am > using limitby) > > I was able to implement this in web2py with the following patch. > > gluon/dal.py > > class BaseAdapter(ConnectionPool): > > def ISNULL(self,first): > return 'ISNULL(%s)' % self.expand(first) > > class Expression(object): > > def isnull(self): > return Expression(self.db, self.db._adapter.ISNULL, self, > None, self.type) > > Is there any desire for this feature in the trunk? I haven't given any > consideration to databases other than MySQL. I would be willing to dig > into this further if there is interest.
[web2py] how to deal with hosting?
I would like to use my web2py project as internet site. If it's possible, what are the rules for the operation? And how can I choose correct hosting provider wich will be able to start web2py files?
Re: [web2py] get by date interval
For some reason I think query2 would be faster, but it´s just a gut thought. Can´t base it on anything, not even experience. And I think your first query doesn´t include first day of month at the moment. Kenneth start_date = datetime(year=show_year, month=show_month, day=1, hour=0, minute=0, second=0) if show_month == 12: end_date = datetime(year=show_year+1, month=1, day=1, hour=0, minute=0, second=0) else: end_date = datetime(year=show_year, month=show_month+1, day=1, hour=0, minute=0, second=0) There are two same queries: datequery1 = (db.indications.date> start_date)&(db.indications.date< end_date) datequery2 = (db.indications.date.year()==show_year)&(db.indications.date.month()==show_month) I think, the first is faster. Am I right?
Re: [web2py] Re: get the path from an upload Field
finally I realize that I cannot work with local files... so I have to think to another solution, one could be a real multiple file upload widget that actually is not yet implemented in web2py or work with file archives... other suggestions? thanks a lot Manuele 2011/3/30 pbreit : > I don't totally understand the question but perhaps this will help. Below is > in my model which takes an image and then creates a thumbnail by passing it > to a function (also in the model). > > db.define_table('item', > Field('image', 'upload', uploadfolder=request.folder+'static/uploads'), > Field('image_thumb', 'upload', > uploadfolder=request.folder+'static/uploads', > compute=lambda r: resize_image(r['image'], (150,130), 'thumb'))) > def resize_image(image, size, path): > from PIL import Image > import os.path > try: > img = Image.open('%sstatic/uploads/%s' % (request.folder, image)) > img.thumbnail(size, Image.NEAREST) > root, ext = os.path.splitext(image) > filename = '%s_%s%s' %(root, path, ext) > img.save('%sstatic/uploads/%s' % (request.folder, filename)) > except Exception, e: > return e > else: > return filename -- Manuele Pesenti amicogodzi...@jabber.linux.it https://sites.google.com/site/manuelepesenti/
Re: [web2py] Re: getting json output with variables/args
Perhaps you erased the file "generic.json" in the views folder? Regards, Esteban On Wed, Mar 30, 2011 at 12:45 PM, Jonathan Lundell wrote: > On Mar 30, 2011, at 8:28 AM, kedai wrote: > > > > tried that, returned no json. that was my first guess too > > Is the controller getting invoked? What does it do? > > That ought to work, unless there's a routing problem or the like. I > think... > > > > > On Mar 30, 10:43 pm, DenesL wrote: > >> controller/myfunction.json/arg > >> > >> On Mar 30, 10:01 am, kedai wrote: > >> > >> > >> > >> > >> > >> > >> > >>> hey guys. > >> > >>> Q: If I have controller/myfunction; I know i can get json by doing > >>> this controller/myfunction.json > >>> However, I have controller/function/arg; how do I get json output when > >>> arg will be determined when we call the function. > >> > >>> Thanks for any pointers/help > > >
[web2py] Generating error tickets via admin for testing
I notice the 'admin' default.py controller includes: def error(): """ Generate a ticket (for testing) """ raise RuntimeError('admin ticket generator at your service') Is there any way to trigger that from the admin interface (I don't see a link or button anywhere), or do you simply have to manually go to /admin/error? Is this documented anywhere? Thanks. Anthony
Re: [web2py] Re: get the path from an upload Field
you can store an error instead of filename with this code, you can get such an error if zlib is not installed and you upload a png image On Wed, Mar 30, 2011 at 9:30 PM, Anthony wrote: > That would make a nice slice. :) > > On Wednesday, March 30, 2011 1:55:52 PM UTC-4, pbreit wrote: > >> I don't totally understand the question but perhaps this will help. Below >> is in my model which takes an image and then creates a thumbnail by passing >> it to a function (also in the model). >> >> >> db.define_table('item', >> Field('image', 'upload', >> uploadfolder=request.folder+'static/uploads'), >> Field('image_thumb', 'upload', >> uploadfolder=request.folder+'static/uploads', >> compute=lambda r: resize_image(r['image'], (150,130), >> 'thumb'))) >> >> def resize_image(image, size, path): >> from PIL import Image >> import os.path >> try: >> img = Image.open('%sstatic/uploads/%s' % (request.folder, image)) >> img.thumbnail(size, Image.NEAREST) >> root, ext = os.path.splitext(image) >> filename = '%s_%s%s' %(root, path, ext) >> img.save('%sstatic/uploads/%s' % (request.folder, filename)) >> except Exception, e: >> return e >> else: >> return filename >> >
[web2py] get by date interval
start_date = datetime(year=show_year, month=show_month, day=1, hour=0, minute=0, second=0) if show_month == 12: end_date = datetime(year=show_year+1, month=1, day=1, hour=0, minute=0, second=0) else: end_date = datetime(year=show_year, month=show_month+1, day=1, hour=0, minute=0, second=0) There are two same queries: datequery1 = (db.indications.date > start_date)&(db.indications.date < end_date) datequery2 = (db.indications.date.year()==show_year)&(db.indications.date.month()==show_month) I think, the first is faster. Am I right?
[web2py] Re: get the path from an upload Field
That would make a nice slice. :) On Wednesday, March 30, 2011 1:55:52 PM UTC-4, pbreit wrote: > I don't totally understand the question but perhaps this will help. Below > is in my model which takes an image and then creates a thumbnail by passing > it to a function (also in the model). > > > db.define_table('item', > Field('image', 'upload', uploadfolder=request.folder+'static/uploads'), > Field('image_thumb', 'upload', > uploadfolder=request.folder+'static/uploads', > compute=lambda r: resize_image(r['image'], (150,130), > 'thumb'))) > > def resize_image(image, size, path): > from PIL import Image > import os.path > try: > img = Image.open('%sstatic/uploads/%s' % (request.folder, image)) > img.thumbnail(size, Image.NEAREST) > root, ext = os.path.splitext(image) > filename = '%s_%s%s' %(root, path, ext) > img.save('%sstatic/uploads/%s' % (request.folder, filename)) > except Exception, e: > return e > else: > return filename >
[web2py] issues with session.auth.last_visit for login expiration?
Hi, I'm using web2py locally, v. 1.93.2, win 7, postgres. With respect to login expiration (without using 'remember me'), isn't it applied/validated only after a period of inactivity (e.g. after the default 1 hour) _after_ the last active web request?. Shoudn't the base expiration date/time (session.auth.last_visit) be reset after every web request, such that the user is not suddenly logout as long as he remains 'active'?. I thought this was the current behavior, after checking Auth.__init__ in tools.py, where the following is executed: auth.last_visit = request.now But for some reason that does not get saved in the session, because for every request after login, I can see that session.auth.last_visit remains unchanged, with the original date/time that was set at login (regardless of the subsequent web requests), which affects the login expiration process. Is it only me or is anyone else having this problem too?. Thanks, Carlos
Re: [web2py] Re: Error in local_import()
Thanks Will. Locally it worked, but if I pack and send to GAE? _ *Gilson Filho* *Web Developer http://gilsondev.com* 2011/3/30 pbreit > I am not clear on what you are trying to do and what you have attempted. > The correct usage of local_import is: > > For the module located at: applications/myapp/modules/mymodule.py > In your controller, use: mymodule = local_import('mymodule') >
[web2py] Re: get the path from an upload Field
I don't totally understand the question but perhaps this will help. Below is in my model which takes an image and then creates a thumbnail by passing it to a function (also in the model). db.define_table('item', Field('image', 'upload', uploadfolder=request.folder+'static/uploads'), Field('image_thumb', 'upload', uploadfolder=request.folder+'static/uploads', compute=lambda r: resize_image(r['image'], (150,130), 'thumb'))) def resize_image(image, size, path): from PIL import Image import os.path try: img = Image.open('%sstatic/uploads/%s' % (request.folder, image)) img.thumbnail(size, Image.NEAREST) root, ext = os.path.splitext(image) filename = '%s_%s%s' %(root, path, ext) img.save('%sstatic/uploads/%s' % (request.folder, filename)) except Exception, e: return e else: return filename
[web2py] Re: ckeditor integration
A CKEditor implementation would be great to see!
[web2py] Re: Error in local_import()
I am not clear on what you are trying to do and what you have attempted. The correct usage of local_import is: For the module located at: applications/myapp/modules/mymodule.py In your controller, use: mymodule = local_import('mymodule')
[web2py] Re: very slow response (over a minute)
OK, I think I have figured it out and I'll add it here in case it saves someone from being as mystified as me: Chrome sometimes uses multiple http connections. dev_appserver only uses a single connection. If you use chrome to access your development server you will very likely end up with it intermittently hanging, timing out or just responding really slowly. The quick fix: don't use chrome on the development server. link to a source discussing the issue: https://groups.google.com/group/google-appengine-python/browse_thread/thread/619d46a1e3d08c67 Best, Alex. On Mar 30, 1:53 am, "Jason (spot) Brower" wrote: > Do you have an internet connection when you are working locally? If not it > may be pausing because it is looking some file that is not accessable and > needs to time out. Is you app somewhere that we could test it? > On 29 Mar 2011 22:45, "Chris" wrote: > > > Have you tried running it with the profiler and viewing a log for one > > page request? > > http://groups.google.com/group/web2py/browse_thread/thread/8e38fc1c17... > > > > > > > > > > > On Mar 29, 1:03 pm, Alex Darlington wrote: > > > Hi, > > > I am using web2py for google app engine and doing development on > > > windows 7 and XP machines. > > > I recently changed some code to start using the blob store (in case > > > this is relevant?) and now have a pretty unusable development > > > environment. > > > > The first time I visit a page it takes over a minute to appear. If I > > > go back to it, it usually appears instantly. > > > If anything changes, the page will once again take over a minute to > > > load. Also after a certain amount of time/visits the response will > > > slow down again. > > > > The problems do not appear when the code is running on Google's > > > servers. > > > > I'm at a bit of a loss as to how to work out what is causing the slow > > > response. This is my first go with python/web2py/appengine (all of > > > them). > > > > Any suggestions gratefully received! > > > > Thanks, > > > Alex.
[web2py] Re: Error in local_import()
Try putting your module in 'web2py/site-packages' and reference it with a normal import and see if that works. If it does, good, but it wont help us understand the problem. If it doesn't, it may give you some more insight into why your module is not importing using local_import(). On Mar 30, 1:12 pm, "contatogilson...@gmail.com" wrote: > I researched the list of the error of using local_import (), but without > success. I used the "import applications.app.modules.script as Script" and > other ideas did not work. Howshould I do about it? > > The error: ImportError: No module named testapp.modules.FormatTweets > > _ > *Gilson Filho* > *Web Developerhttp://gilsondev.com*
[web2py] Re: PluginMModal in plugin_wiki page
Here's an example (assumes you have the modal resources - I.e. the modalPlugin): ... whatever happens here `` {{stuffYouWantInTheModal=plugin_wiki.widget('update', table='recipe', record_id='name', message=\ 'stuffRecord updated')}}``:template`` {{a=PluginMModal(title='some title', content=stuffYouWantInTheModal, close='close', callback="URL(load_action)", width=30, height=40)}}``:template`` {{=a}} {{=a.link('[name for this link]')}} Hope it helps, Mart :) On Mar 30, 9:28 am, danto wrote: > 2011/3/29 kawate > > > Hell: > > > Please advise me to show PluginMModal window in plugin_wiki page. > > > Best Regards: > > Web2py is better than that. You shoud try asking "Heaven" or "Fellowship" > regards
[web2py] Error in local_import()
I researched the list of the error of using local_import (), but without success. I used the "import applications.app.modules.script as Script" and other ideas did not work. Howshould I do about it? The error: ImportError: No module named testapp.modules.FormatTweets _ *Gilson Filho* *Web Developer http://gilsondev.com*
[web2py] Re: OpenID on GAE
It is worth noting that you will need to get the python-openid package from (http://pypi.python.org/pypi/python-openid/) and add the 'openid' folder to the folder 'web2py/site-packages' in your project so it can be referenced by 'openid_auth.py' On Mar 30, 1:03 pm, Will Stevens wrote: > Ya, I had setup Janrain previously and it worked, but my application > needs control (or at least awareness) of which login types are being > used and are associated with a user. > > The good new is that I JUST FIGURED IT OUT!!! :) > > My setup: > I have both the regular auth setup as well asopenid, so on the login > page, you will have both forms. On the profile page, you can > associate anopenidwith your account, after which you will be able to > login using thatopenid. > > *** NOTE: *** > I had to fix two bugs in 'gluon/contrib/login_methods/openid_auth.py' > to get this working... > > gluon/contrib/login_methods/openid_auth.py on line 243 > - print "[DB] %s authenticated" % oid > + #print "[DB] %s authenticated" % oid > (this print statement was ok with the built in server, but on GAE > caused the redirect to not work because the print was output before > the headers were sent.) > > gluon/contrib/login_methods/openid_auth.py on line 244 > - self.db.alt_logins.insert(username=oid, user=user) > + self.db.alt_logins.insert(username=oid, user=user.id) #changed user > to user.id to fix insert error > > In my application: > > == db.py == > from gluon.contrib.login_methods.openid_auth import OpenIDAuth > openid_login_form = OpenIDAuth(auth) > > == controller == > def user(): > if 'janrain_nonce' in request.vars: # ifopenidform has been > submitted > auth.settings.login_form = openid_login_form > return dict(form=auth()) > > if 'login' in request.args: # if we are on the login page > form = DIV( > DIV(auth()), > DIV(openid_login_form.login_form())) > else: > form = auth() > > if 'profile' in request.args: # if we are on the profile page > form = DIV(form, openid_login_form.list_user_openids()) # append > theopenid'sfor this user to the login form (also appends the 'addopenid' form) > > return dict(form=form) > > Thats it... I hope this will save others the hassle I have gone > through getting this working. > > Cheers, > > Will > > On Mar 30, 12:45 pm, Arbie Samong wrote: > > > > > > > > > Hey man you may want to use janrain which also supportsopenid. I use > > it for my app and it works fine. Massimo explained the setup here: > > >http://blip.tv/file/4912976 > > > Regards, > > Arbie > > > On Mar 31, 12:08 am, Will Stevens wrote: > > > > I have continued battling with this. Still no luck... > > > > Any input would be appreciated... > > > > ws > > > > On Mar 29, 4:07 pm, Will Stevens wrote: > > > > > I have continued testing and I have further confirmed that the only > > > > time I am having the redirect issue of: > > > > [DB] profiles.google.com/williamstevens authenticated > > > > Status: 303 SEE OTHER > > > > Set-Cookie: > > > > session_id_cloudops="292:7dfe3917-16a3...etc...a0077e6f94f6"; Path=/ > > > > Content-Type: text/html; charset=UTF-8 > > > > Location: /cloudops/dashboard/user/profile > > > > > You are being redirected here > > > > > Is when the 'user' controller is called with the following > > > > 'request.vars': > > > > > > > '_formkey': '6085d1f2-295d-4cce-aef4-27591a06898e', > > > > 'oid': 'https://profiles.google.com/williamstevens', > > > > '_formname': 'default', > > > > '_next': '/cloudops/dashboard/user/profile' > > > > > }> > > > > > This is when the 'list_user_openids()' form is submitted... > > > > > On Mar 29, 2:54 pm, Will Stevens wrote: > > > > > > in the initial post, i change my app name to init and controller to > > > > > default cause that is what you would be expecting. > > > > > > it is actually cloudops and dashboard, but i have everything > > > > > configured for that to work... > > > > > > i did not change the urls in the latest printout, so i wanted to make > > > > > a note of that. > > > > > > On Mar 29, 2:47 pm, Will Stevens wrote: > > > > > > > I have continued debugging, so I figured I would add some more > > > > > > details. > > > > > > > In the controller here... > > > > > > if 'janrain_nonce' in request.vars: > > > > > > auth.settings.login_form = openid_login_form > > > > > > return dict(form=auth() > > > > > > > I printed out the value of 'request.vars' in a debugger. > > > > > > > => request.vars > > > > > > > > > > > 'openid.op_endpoint': 'https://www.google.com/accounts/o8/ud? > > > > > > source=profiles', > > > > > > 'openid.sig': 'QRnWCdVM...etc...KhepWnPUMXg=', > > > > > > 'openid.return_to': > > > > > > 'http://localhost:8080/cloudops/dashboard/user/ > > > > > > login?_next=/cloudops/dashboard/user/ > > > > > > profile&janrain_nonce=2011-03-29T18%3A30%3A01ZLZP3X9', > > > > > > 'openid.response_nonce': '2011-03-29T18:30:02Z7_7VbUEUzcArkQ', > > > > > > 'janra
[web2py] Re: Auth with OpenId
I have spent the last two days battling with this. I was so close for so long that I could not leave it alone until I figured it out. I am happy to say that I have OpenID working both on the basic server and GAE. You can see my struggles and the final result here: http://groups.google.com/group/web2py/browse_thread/thread/4a8efd13814358b9 Hope this helps... On Feb 24, 11:10 pm, KMax wrote: > I thinks openid feature will be very usefull. > I'l happy to help you with it. > > On 19 фев, 17:03, drebbin wrote: > > > > > > > > > At first I struggled with OpenId myself, using the python-openid lib. It did > > cost me several nerves and reading many other implementations was necessary > > before I understood the inner workings. But now I do - it was worth it, and > > I got a simple login working. Then I wanted to combine it with web2py's auth > > mechanisms -- when I realised that web2py already has such, in > > contrib/login_methods. Well... > > > Unfortunately, the above mentioned issues stop the show. > > So, I would like to debug that module and am currently stuck in > > understanding the DAL, *sigh* Sources are sparsely documented. The exception > > throws in method `represent()'. What does it do? I am planning to read > > through the sources from bottom to top, following the backtrace. > > > Considering success, I also would like to extend that module. OpenId also > > allows to query the provider about some information about the user (called > > attribute exchange), like name, email address (user is asked, of course, if > > she allows to disclose these). It would be nice if web2py's openid module > > would also have this feature. > > > Any help here is greatly appreciated. :) > > > KR, drebbin
[web2py] Re: OpenID on GAE
Ya, I had setup Janrain previously and it worked, but my application needs control (or at least awareness) of which login types are being used and are associated with a user. The good new is that I JUST FIGURED IT OUT!!! :) My setup: I have both the regular auth setup as well as openid, so on the login page, you will have both forms. On the profile page, you can associate an openid with your account, after which you will be able to login using that openid. *** NOTE: *** I had to fix two bugs in 'gluon/contrib/login_methods/openid_auth.py' to get this working... gluon/contrib/login_methods/openid_auth.py on line 243 - print "[DB] %s authenticated" % oid + #print "[DB] %s authenticated" % oid (this print statement was ok with the built in server, but on GAE caused the redirect to not work because the print was output before the headers were sent.) gluon/contrib/login_methods/openid_auth.py on line 244 - self.db.alt_logins.insert(username=oid, user=user) + self.db.alt_logins.insert(username=oid, user=user.id) #changed user to user.id to fix insert error In my application: == db.py == from gluon.contrib.login_methods.openid_auth import OpenIDAuth openid_login_form = OpenIDAuth(auth) == controller == def user(): if 'janrain_nonce' in request.vars: # if openid form has been submitted auth.settings.login_form = openid_login_form return dict(form=auth()) if 'login' in request.args: # if we are on the login page form = DIV( DIV(auth()), DIV(openid_login_form.login_form())) else: form = auth() if 'profile' in request.args: # if we are on the profile page form = DIV(form, openid_login_form.list_user_openids()) # append the openid's for this user to the login form (also appends the 'add openid' form) return dict(form=form) Thats it... I hope this will save others the hassle I have gone through getting this working. Cheers, Will On Mar 30, 12:45 pm, Arbie Samong wrote: > Hey man you may want to use janrain which also supports openid. I use > it for my app and it works fine. Massimo explained the setup here: > > http://blip.tv/file/4912976 > > Regards, > Arbie > > On Mar 31, 12:08 am, Will Stevens wrote: > > > > > > > > > I have continued battling with this. Still no luck... > > > Any input would be appreciated... > > > ws > > > On Mar 29, 4:07 pm, Will Stevens wrote: > > > > I have continued testing and I have further confirmed that the only > > > time I am having the redirect issue of: > > > [DB] profiles.google.com/williamstevens authenticated > > > Status: 303 SEE OTHER > > > Set-Cookie: > > > session_id_cloudops="292:7dfe3917-16a3...etc...a0077e6f94f6"; Path=/ > > > Content-Type: text/html; charset=UTF-8 > > > Location: /cloudops/dashboard/user/profile > > > > You are being redirected here > > > > Is when the 'user' controller is called with the following > > > 'request.vars': > > > > > '_formkey': '6085d1f2-295d-4cce-aef4-27591a06898e', > > > 'oid': 'https://profiles.google.com/williamstevens', > > > '_formname': 'default', > > > '_next': '/cloudops/dashboard/user/profile' > > > > }> > > > > This is when the 'list_user_openids()' form is submitted... > > > > On Mar 29, 2:54 pm, Will Stevens wrote: > > > > > in the initial post, i change my app name to init and controller to > > > > default cause that is what you would be expecting. > > > > > it is actually cloudops and dashboard, but i have everything > > > > configured for that to work... > > > > > i did not change the urls in the latest printout, so i wanted to make > > > > a note of that. > > > > > On Mar 29, 2:47 pm, Will Stevens wrote: > > > > > > I have continued debugging, so I figured I would add some more > > > > > details. > > > > > > In the controller here... > > > > > if 'janrain_nonce' in request.vars: > > > > > auth.settings.login_form = openid_login_form > > > > > return dict(form=auth() > > > > > > I printed out the value of 'request.vars' in a debugger. > > > > > > => request.vars > > > > > > > > > 'openid.op_endpoint': 'https://www.google.com/accounts/o8/ud? > > > > > source=profiles', > > > > > 'openid.sig': 'QRnWCdVM...etc...KhepWnPUMXg=', > > > > > 'openid.return_to': 'http://localhost:8080/cloudops/dashboard/user/ > > > > > login?_next=/cloudops/dashboard/user/ > > > > > profile&janrain_nonce=2011-03-29T18%3A30%3A01ZLZP3X9', > > > > > 'openid.response_nonce': '2011-03-29T18:30:02Z7_7VbUEUzcArkQ', > > > > > 'janrain_nonce': '2011-03-29T18:30:01ZLZP3X9', > > > > > 'openid.ns': 'http://specs.openid.net/auth/2.0', > > > > > 'openid.claimed_id': 'https://profiles.google.com/williamstevens', > > > > > 'openid.mode': 'id_res', > > > > > '_next': '/cloudops/dashboard/user/profile', > > > > > 'openid.signed': > > > > > 'op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle', > > > > > 'openid.assoc_handle': 'AOQobUfNex0ZNZ...etc...V8nfOdio9KotL- > > > > > XnWCGoWB1b9IwN', > > > > > 'ope
[web2py] Re: OpenID on GAE
Hey man you may want to use janrain which also supports openid. I use it for my app and it works fine. Massimo explained the setup here: http://blip.tv/file/4912976 Regards, Arbie On Mar 31, 12:08 am, Will Stevens wrote: > I have continued battling with this. Still no luck... > > Any input would be appreciated... > > ws > > On Mar 29, 4:07 pm, Will Stevens wrote: > > > I have continued testing and I have further confirmed that the only > > time I am having the redirect issue of: > > [DB] profiles.google.com/williamstevens authenticated > > Status: 303 SEE OTHER > > Set-Cookie: > > session_id_cloudops="292:7dfe3917-16a3...etc...a0077e6f94f6"; Path=/ > > Content-Type: text/html; charset=UTF-8 > > Location: /cloudops/dashboard/user/profile > > > You are being redirected here > > > Is when the 'user' controller is called with the following > > 'request.vars': > > > '_formkey': '6085d1f2-295d-4cce-aef4-27591a06898e', > > 'oid': 'https://profiles.google.com/williamstevens', > > '_formname': 'default', > > '_next': '/cloudops/dashboard/user/profile' > > > }> > > > This is when the 'list_user_openids()' form is submitted... > > > On Mar 29, 2:54 pm, Will Stevens wrote: > > > > in the initial post, i change my app name to init and controller to > > > default cause that is what you would be expecting. > > > > it is actually cloudops and dashboard, but i have everything > > > configured for that to work... > > > > i did not change the urls in the latest printout, so i wanted to make > > > a note of that. > > > > On Mar 29, 2:47 pm, Will Stevens wrote: > > > > > I have continued debugging, so I figured I would add some more > > > > details. > > > > > In the controller here... > > > > if 'janrain_nonce' in request.vars: > > > > auth.settings.login_form = openid_login_form > > > > return dict(form=auth() > > > > > I printed out the value of 'request.vars' in a debugger. > > > > > => request.vars > > > > > > > 'openid.op_endpoint': 'https://www.google.com/accounts/o8/ud? > > > > source=profiles', > > > > 'openid.sig': 'QRnWCdVM...etc...KhepWnPUMXg=', > > > > 'openid.return_to': 'http://localhost:8080/cloudops/dashboard/user/ > > > > login?_next=/cloudops/dashboard/user/ > > > > profile&janrain_nonce=2011-03-29T18%3A30%3A01ZLZP3X9', > > > > 'openid.response_nonce': '2011-03-29T18:30:02Z7_7VbUEUzcArkQ', > > > > 'janrain_nonce': '2011-03-29T18:30:01ZLZP3X9', > > > > 'openid.ns': 'http://specs.openid.net/auth/2.0', > > > > 'openid.claimed_id': 'https://profiles.google.com/williamstevens', > > > > 'openid.mode': 'id_res', > > > > '_next': '/cloudops/dashboard/user/profile', > > > > 'openid.signed': > > > > 'op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle', > > > > 'openid.assoc_handle': 'AOQobUfNex0ZNZ...etc...V8nfOdio9KotL- > > > > XnWCGoWB1b9IwN', > > > > 'openid.identity': 'https://profiles.google.com/williamstevens' > > > > > }> > > > > > Does anyone see anything in this that seems wrong??? > > > > > Thanks, > > > > > Will > > > > > On Mar 29, 1:21 pm, Will Stevens wrote: > > > > > > I am trying to get both the basic auth and open id working together on > > > > > GAE. I have managed to get it working on the web2py.py server, but I > > > > > still have some minor issues with GAE. It has taken me about 2 days > > > > > to get to this point, and I am SOO close to having a perfectly working > > > > > setup. > > > > > > My configuration is as follows: > > > > > == db.py == > > > > > from gluon.contrib.login_methods.openid_auth import OpenIDAuth > > > > > openid_login_form = OpenIDAuth(auth) > > > > > > == controller == > > > > > def user(): > > > > > if 'janrain_nonce' in request.vars: # if openid form has been > > > > > submitted > > > > > auth.settings.login_form = openid_login_form > > > > > return dict(form=auth()) > > > > > > if 'login' in request.args: # if we are on the login page > > > > > form = DIV( > > > > > DIV(auth()), > > > > > DIV(openid_login_form.login_form())) > > > > > else: > > > > > form = auth() > > > > > > if 'profile' in request.args: # if we are on the profile page > > > > > form = DIV(form, openid_login_form.list_user_openids()) # append > > > > > the openid's for this user to the login form (also appends the 'add > > > > > openid' form) > > > > > > return dict(form=form) > > > > > > This appends the OpenID login form to the 'login' page. It also > > > > > appends the 'list openids' to the profile page. If the openid form is > > > > > submitted it will be caught by the first if statement in the > > > > > controller and get handled by auth. > > > > > > NOTE: > > > > > On line 244 of gluon/contrib/login_methods/openid_auth.py there is bug > > > > > that I had to fix in order for this to work. > > > > > - self.db.alt_logins.insert(username=oid, user=user) > > > > > + self.db.alt_logins.insert(username=oid, user=user.id) #changed user > > > > > to u
[web2py] Re: OpenID on GAE
I have continued battling with this. Still no luck... Any input would be appreciated... ws On Mar 29, 4:07 pm, Will Stevens wrote: > I have continued testing and I have further confirmed that the only > time I am having the redirect issue of: > [DB] profiles.google.com/williamstevens authenticated > Status: 303 SEE OTHER > Set-Cookie: > session_id_cloudops="292:7dfe3917-16a3...etc...a0077e6f94f6"; Path=/ > Content-Type: text/html; charset=UTF-8 > Location: /cloudops/dashboard/user/profile > > You are being redirected here > > Is when the 'user' controller is called with the following > 'request.vars': > '_formkey': '6085d1f2-295d-4cce-aef4-27591a06898e', > 'oid': 'https://profiles.google.com/williamstevens', > '_formname': 'default', > '_next': '/cloudops/dashboard/user/profile' > > }> > > This is when the 'list_user_openids()' form is submitted... > > On Mar 29, 2:54 pm, Will Stevens wrote: > > > > > > > > > in the initial post, i change my app name to init and controller to > > default cause that is what you would be expecting. > > > it is actually cloudops and dashboard, but i have everything > > configured for that to work... > > > i did not change the urls in the latest printout, so i wanted to make > > a note of that. > > > On Mar 29, 2:47 pm, Will Stevens wrote: > > > > I have continued debugging, so I figured I would add some more > > > details. > > > > In the controller here... > > > if 'janrain_nonce' in request.vars: > > > auth.settings.login_form = openid_login_form > > > return dict(form=auth() > > > > I printed out the value of 'request.vars' in a debugger. > > > > => request.vars > > > > > 'openid.op_endpoint': 'https://www.google.com/accounts/o8/ud? > > > source=profiles', > > > 'openid.sig': 'QRnWCdVM...etc...KhepWnPUMXg=', > > > 'openid.return_to': 'http://localhost:8080/cloudops/dashboard/user/ > > > login?_next=/cloudops/dashboard/user/ > > > profile&janrain_nonce=2011-03-29T18%3A30%3A01ZLZP3X9', > > > 'openid.response_nonce': '2011-03-29T18:30:02Z7_7VbUEUzcArkQ', > > > 'janrain_nonce': '2011-03-29T18:30:01ZLZP3X9', > > > 'openid.ns': 'http://specs.openid.net/auth/2.0', > > > 'openid.claimed_id': 'https://profiles.google.com/williamstevens', > > > 'openid.mode': 'id_res', > > > '_next': '/cloudops/dashboard/user/profile', > > > 'openid.signed': > > > 'op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle', > > > 'openid.assoc_handle': 'AOQobUfNex0ZNZ...etc...V8nfOdio9KotL- > > > XnWCGoWB1b9IwN', > > > 'openid.identity': 'https://profiles.google.com/williamstevens' > > > > }> > > > > Does anyone see anything in this that seems wrong??? > > > > Thanks, > > > > Will > > > > On Mar 29, 1:21 pm, Will Stevens wrote: > > > > > I am trying to get both the basic auth and open id working together on > > > > GAE. I have managed to get it working on the web2py.py server, but I > > > > still have some minor issues with GAE. It has taken me about 2 days > > > > to get to this point, and I am SOO close to having a perfectly working > > > > setup. > > > > > My configuration is as follows: > > > > == db.py == > > > > from gluon.contrib.login_methods.openid_auth import OpenIDAuth > > > > openid_login_form = OpenIDAuth(auth) > > > > > == controller == > > > > def user(): > > > > if 'janrain_nonce' in request.vars: # if openid form has been > > > > submitted > > > > auth.settings.login_form = openid_login_form > > > > return dict(form=auth()) > > > > > if 'login' in request.args: # if we are on the login page > > > > form = DIV( > > > > DIV(auth()), > > > > DIV(openid_login_form.login_form())) > > > > else: > > > > form = auth() > > > > > if 'profile' in request.args: # if we are on the profile page > > > > form = DIV(form, openid_login_form.list_user_openids()) # append > > > > the openid's for this user to the login form (also appends the 'add > > > > openid' form) > > > > > return dict(form=form) > > > > > This appends the OpenID login form to the 'login' page. It also > > > > appends the 'list openids' to the profile page. If the openid form is > > > > submitted it will be caught by the first if statement in the > > > > controller and get handled by auth. > > > > > NOTE: > > > > On line 244 of gluon/contrib/login_methods/openid_auth.py there is bug > > > > that I had to fix in order for this to work. > > > > - self.db.alt_logins.insert(username=oid, user=user) > > > > + self.db.alt_logins.insert(username=oid, user=user.id) #changed user > > > > to user.id to get rid of db error... > > > > > With this configuration I have been able to successfully (on default > > > > server): > > > > - login using the basic auth form. > > > > - view my profile and see the openid list (with form). > > > > - in the profile, add an open id to the list. > > > > - in the profile, remove an open id from the list. > > > > - login using the associated openid for a specific user.
Re: [web2py] Re: getting json output with variables/args
On Mar 30, 2011, at 8:28 AM, kedai wrote: > > tried that, returned no json. that was my first guess too Is the controller getting invoked? What does it do? That ought to work, unless there's a routing problem or the like. I think... > > On Mar 30, 10:43 pm, DenesL wrote: >> controller/myfunction.json/arg >> >> On Mar 30, 10:01 am, kedai wrote: >> >> >> >> >> >> >> >>> hey guys. >> >>> Q: If I have controller/myfunction; I know i can get json by doing >>> this controller/myfunction.json >>> However, I have controller/function/arg; how do I get json output when >>> arg will be determined when we call the function. >> >>> Thanks for any pointers/help
[web2py] ckeditor integration
The ultimate goal is to allow users to embed video, audio, images, etc. in comment-like posts. I tried using Markmin video tags - but all I end up with are blank players that say 'Loading' - if someone has done it successfully with Markmin, that'd be fine. But I moved on trying to get ckeditor integrated with the form (as per this slice http://www.web2pyslices.com/main/slices/take_slice/18) But am not having much success. Anyway, as it is now, the form loads via ajax (Dunno if that's part of the problem?) But I get my plain old Textarea and no ckeditor. It's loading the js for the editor, I know that much. It just never applies it to the Textarea. Anyway, anyone with any other info or examples, I'd really appreciate it. TIA!
[web2py] Re: getting json output with variables/args
tried that, returned no json. that was my first guess too On Mar 30, 10:43 pm, DenesL wrote: > controller/myfunction.json/arg > > On Mar 30, 10:01 am, kedai wrote: > > > > > > > > > hey guys. > > > Q: If I have controller/myfunction; I know i can get json by doing > > this controller/myfunction.json > > However, I have controller/function/arg; how do I get json output when > > arg will be determined when we call the function. > > > Thanks for any pointers/help
[web2py] Re: getting json output with variables/args
controller/myfunction.json/arg On Mar 30, 10:01 am, kedai wrote: > hey guys. > > Q: If I have controller/myfunction; I know i can get json by doing > this controller/myfunction.json > However, I have controller/function/arg; how do I get json output when > arg will be determined when we call the function. > > Thanks for any pointers/help
[web2py] get the path from an upload Field
Hi *, I'm trying to implement a form for upload in one time more than one file. Sometimes file format specifications contemplate more than one file with the same name in the same directory with different extentions such as in the case of shape files for GIS poroposes. Is it possible to use the upload field, let select the principal file (for example the one with .shp ext) and than look in the same path other possible related files? I cannot find out how to extract the path of a selected file of an upload field. Other better ideas to solve it? thankyou very much Cheers Manuele
[web2py] Re: Restriction Fields
Thanks you, but I don´t know how to apply this to my model, is there any example? On 30 mar, 13:12, Anthony wrote: > On Tuesday, March 29, 2011 1:33:40 PM UTC-4, luifran wrote: > > > as I can do that? > > to insert into the table I use crud.create > > You can specify an onvalidation function with crud via the crud > settings:http://web2py.com/book/default/chapter/07#Settings > > onvalidation is explained in more detail > here:http://web2py.com/book/default/chapter/07#onvalidation > > Anthony
[web2py] getting json output with variables/args
hey guys. Q: If I have controller/myfunction; I know i can get json by doing this controller/myfunction.json However, I have controller/function/arg; how do I get json output when arg will be determined when we call the function. Thanks for any pointers/help
[web2py] Fwd: sqlform.widget.radio.widget problem getting value
Hi again, Sorry to have bothered you, found the solution - removed the 'boolean' type from the Field definition in the model, and everything works fine. May I suggest a radio widget example in the book perhaps? Anyhow, thanks for making web2py, I'm getting things done with it :-) // Jens -- Forwarded message -- From: Jens Örtenholm Date: 2011/3/29 Subject: sqlform.widget.radio.widget problem getting value To: web2py@googlegroups.com Hi, I've been trying to add a radio button set to one of my web forms. I'm generating the form with SQLFORM.factory, because I'm adding a non db field to it. Example model: db.define_table('mytable', Field('name', 'string', requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db, ' mytable.name')]), # some fields omitted Field('radiofield', 'boolean', widget=SQLFORM.widgets.radio.widget, requires=IS_IN_SET({True : 'On', False : 'Off', None : 'Neither'}))) In the controller: def new(): form = SQLFORM.factory(db.mytable, Field('specialfield', 'string'), labels={'specialfield' : 'Special Field'}) if form.accepts(request.vars, session): # do some handling of special field, then a manual db insert, here omitted return dict(form=form, radio=form.vars.radiofield) # when not debugging this is a redirect to another controller return dict(form=form) The form shows with three radio buttons: On, Off and Neither. But no matter which one I choose, form.vars.radiofield is always True after calling form.accepts. Examining request.vars.radiofield variable, the correct chosen value is shown there. Am I doing something wrong here, or is it a bug? // Jens
Re: [web2py] PluginMModal in plugin_wiki page
2011/3/29 kawate > Hell: > > Please advise me to show PluginMModal window in plugin_wiki page. > > Best Regards: > Web2py is better than that. You shoud try asking "Heaven" or "Fellowship" regards
[web2py] Re: time datatype widget is broken?
Yes, the drop down time widget had some problems. The new widget is more accessible to be used from the keyboard. On Mar 29, 10:14 pm, danto wrote: > I remember that the Time datatype widget in DAL can deploy a kind of > dropdown menu showing the hours, but not anymore. This is how it should be > or is something wrong? I'm using 1.94.5
[web2py] Re: Restriction Fields
On Tuesday, March 29, 2011 1:33:40 PM UTC-4, luifran wrote: > > as I can do that? > to insert into the table I use crud.create You can specify an onvalidation function with crud via the crud settings: http://web2py.com/book/default/chapter/07#Settings onvalidation is explained in more detail here: http://web2py.com/book/default/chapter/07#onvalidation Anthony
[web2py] Re: Restriction Fields
Hi! See: http://groups.google.com/group/web2py/browse_thread/thread/4eebaf795d43e171/7ba6a2e79e1db2bf?lnk=gst&q=composite+key#7ba6a2e79e1db2bf On 29 mar, 19:12, luifran wrote: > I have not explained very well, I will not prevent the value of a and > b are equal, I want to avoid the insertion of identical records, for > example: > Record 1 -> a: 4 b: 5 > Record 2 -> a: 4 b: 5 > > This is what I want to avoid > Sorry for my words, I'm Spanish, not fluent in English. > > On 28 mar, 20:40, luifran wrote: > > > Thanks, I'll try that way > > > On Mar 28, 8:59 am, Massimo Di Pierro > > wrote: > > > > db.define_table ('t', Field ('a'), Field ('b',requires=IS_EXPR('value!= > > > %s'% repr(request.vars.a))) > > > > On Mar 28, 10:37 am, luifran wrote: > > > > > I have the following table, for example: > > > > db.define_table ('t', Field ('a '), Field ('b')) > > > > I want to impose the following restriction, to avoid insertion of > > > > duplicate records > > > > not allow insertion of a pair of identical values (a y b). > > > > How I can do this?, I know how to restrict a single field, but not > > > > both at once. > >