Re: [web2py] Offline Access to web2py manual?
On 10 November 2011 18:11, ~redShadow~ wrote: > > Sure, I was complaining for lack of *wget* documentation, not web2py :) > (although yeah, maybe I should email wget authors about that..) > > 'man wget' is quite good. Did you try http://www.gnu.org/software/wget/manual/ ? Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3)
Re: [web2py] Re: Detecting if a session has ended
On Friday, November 11, 2011 1:21:51 AM UTC-5, rochacbruno wrote: > > > > On Wed, Nov 9, 2011 at 5:14 PM, Massimo Di Pierro > wrote: > >> auth.settings.logout_onlogout = lambda user: do_something_with(user) > > > Why dont we clean the specific session file/registry when user logged out? > > *auth.settings.logout_onlogout = lambda user: remove_session(user)* > > is there a problem on doing that? > Maybe not by default, though -- logging out doesn't necessarily have to end the browser session.
[web2py] Re: help on howto redirect user based on their auth_membership
On Friday, November 11, 2011 1:04:14 AM UTC-5, Massimo Di Pierro wrote: > > It was a long day. :-) > OK, now I'm going to bed. :-)
[web2py] Re: Signature apps
Massimo, hopefully a relevant comment: Should PowerTalk be listed under cms (could also be shown as a plugin)? I believe Martin refers to it as instant press2. Important as cms is a major area. Sorry for the comment. On Sep 26, 7:24 pm, Massimo Di Pierro wrote: > I have not tested them and I am sure I am missing something important > so please add below (do not comment, just add to the list) > > Layouts and Plugin Layouts > ==http://web2py.com/layoutshttp://web2py.com/drupal(converted > from Drupal)http://web2py.com/zengarden(then press top-left button) > > Plugins > == > Plugin > wiki:http://web2py.com/examples/static/web2py.plugin.wiki.w2phttp://dev.s-cubism.com/web2py_pluginshttp://code.google.com/p/web2py-pluginsorhttp://web2py.com/pluginshttp://sramana.in/web2py-instant-admin/https://bitbucket.org/mulonemartin/powerpack/wiki/Homehttp://web2py.com/plugins/plugin_jqmobile/about(jquery.mobile > plugin) > > CMS > http://code.google.com/p/cube2py/http://code.google.com/p/instant-press/ > > Forum > ==http://www.pyforum.org/ > > Q&A (like Stack Overflow) > ==http://beta.qa-stack.com/ > > Conference Management > =http://code.google.com/p/conf2py/ > > Web File Manager > ===http://code.google.com/p/elfinder-web2py/ > > Online Stores > ===http://code.google.com/p/web2py-estore/ > > Issue Tracking > http://code.google.com/p/web2py-issuetracker/https://bitbucket.org/alfonsodg/superticket/ > > Quiz/Survey application > ===https://bitbucket.org/rochacbruno/surveycloud > > Please no-comments, just add below if you know something good and > useful ...
[web2py] Re: CAS auto login for all apps
pepper_bg. You mean @auth.requires_login() ? Cos it works and you are 100% right about what I'm trying to describe :) Thanks! Anthony. Thanks again. It seems separating databases and using CAS is the most suitable for my system.
Re: [web2py] Re: Mixing/supporting CMS with Web2py
This one: http://ourway.ir/pages/blog?u=blouweb IS a very nice facebook clone app! can be extended for a cms. is it open source?
[web2py] Re: web2py with twitter bootstrap - very clean interface ...
Thanks Anthony, I'll try with less.js now :) Rahul On Nov 10, 5:38 pm, Anthony wrote: > LESS is used by Bootstrap but is a completely separate project -- > seehttp://lesscss.org. > > > > > > > > On Thursday, November 10, 2011 12:09:43 AM UTC-5, Rahul wrote: > > > I would like to make it work for me. What all you included? Where? > > what is in the view? > > I tried to include this (below) previously - but less.js is nowhere to > > be found in the bootstrap package - I dont wont it to grab the js > > online .. so that its available for offline use aswell.. > > > > > > > Any suggestions? > > > Rahul D. > > > On Nov 9, 11:13 pm, Angelo Compagnucci > > wrote: > > > It totally rocks! > > > > 2011/11/9 David Watson : > > > > > Sorry, I found it: > > > > >http://groups.google.com/group/web2py-developers/browse_thread/thread... > > > > > On Nov 9, 12:47 pm, David Watson wrote: > > > >> On Sep 26, 5:43 pm, Bruno Rocha wrote: > > > > >> > We are planning to include it in the next web2py version. > > > > >> > I will share the actual w2p after a clean up. > > > > >> Hi, does anybody know if the twitter-bootstrap integration code is > > > >> available for web2py yet? The one shown here: > > > > >>http://labs.blouweb.com/bootstrap/ > > > > >> I was about to embark on some web2py work that requires twitter- > > > >> bootstrap, but I wasn't sure if this was available yet. > > > > >> Thanks, > > > >> David > > > > -- > > > Profile:http://www.gild.com/compagnucciangelo > > > Register on Gild:http://www.gild.com/referral/compagnucciangelo
[web2py] Using "auth.settings.login_onaccept"
Hi All, I want to redirect to a custom html file (NOT Index.html) after user logs in using Auth - auth.settings.login_onaccept = [] What would I need to define and where? I checked online version of book but found it very limited. Please suggest
[web2py] Using "auth.settings.login_onaccept"
Hi All, I want to redirect to a custom html file (NOT Index.html) after user logs in using Auth Login() - auth.settings.login_onaccept = [] Redirect after a successful login to a html file residing here- views \default\samples.html What would I need to define and where? I checked online version of book but found it very limited. Please suggest (if possible with my current example) Also, Where are these tables located in web2py ? I dont seem to find any tables. Please let me know the structure of Auth functionality. Thanks Rahul. (http://www.flockbird.com/)
[web2py] Re: Using "auth.settings.login_onaccept"
1. in your db.py you should define def go_log(object): redirect(URL('default','samples')) #default is the controller, samples is the action. auth.settings.login_onaccept = go_log 2. in your default.py create a action def samples(): return dict() 3. you should have created file samples.html in your views/default dir tables are models. you create them when you call db.define_table()
[web2py] Re: A typo in online book for update_or_insert()
Great!!! I was wondering why it was not working... And if you want to check multiple fields, here is an example : db.table.update_or_insert( (db.table.filename==up['filename']) & (db.table.uploader==uploader.id) , author=ddl['author'] , uploader=uploader.id , filename=ddl['filename'] , description=ddl['description'] ) Will update author and description to the corresponding field with FILENAME and UPLOADER ;) Cheers, Thomas
[web2py] Re: Using "auth.settings.login_onaccept"
Hey All, I got it working with the below code - If you need to redirect to a url - after Auth login - In your controller - (default.py) - Just add the below function and call it with "auth.settings.login_onaccept" as shown below. #-- def afterlogin(form): redirect("http://127.0.0.1:8000/ProjecName/default/main";) auth.settings.login_onaccept = lambda form:afterlogin(form) def main(): #response.view='default/main.html' return dict() # Note: 1. You should have main.html and its corresponding function in default controller. i.e. Where you would like to direct the file 2. You do not need to add anything for this in db.py Just these 3 lines should make it work . It works for me. Thanks All, Cheers, Rahul D (www.flockbird.com - powered by web2py) PS: We can close this thread! On Nov 11, 4:09 pm, Cahya Dewanta wrote: > 1. in your db.py you should define > > def go_log(object): > redirect(URL('default','samples')) #default is the controller, > samples is the action. > > auth.settings.login_onaccept = go_log > > 2. in your default.py create a action > > def samples(): > return dict() > > 3. you should have created file samples.html in your views/default dir > > tables are models. you create them when you call db.define_table()
[web2py] Re: new welcome app - need help with css
Anthony, since IE (any version), in some circumstances, has a behavior different from other browsers, we need to detect it in css rules. So any solution is good. Paolo
[web2py] Re: smartgrid styling
Done. Now the styling for both grid and smartgrid is the same, which is what I wanted. On Nov 10, 4:25 pm, Jim Steil wrote: > Sounds like a good idea. Let us know if you see differences. > > -Jim > > On 11/10/2011 3:18 PM, Cliff wrote: > > > > > > > > > I'm now completely confused. > > > Just to look at the rendered html I used smartgrid in a different > > controller. > > > The styling looks fine. > > > I've got a 1.99.2 zipfile. Maybe I'll unzip it and get the base.css > > just to make sure all is in synch. > > > > > > On Nov 10, 2:27 pm, Jim Steil wrote: > >> Have you started a brand new app and used it, or added it to an an older > >> app? There were a number of css changes/additions at some point. > > >> -Jim > > >> On 11/10/2011 12:45 PM, Cliff wrote: > > >>> Am I missing something? > >>> Running 1.99.2 smartgrid works but definitely needs styling. I see > >>> the styling for web2py grid in base css and grid looks fine. > >>> Smartgrid not so much.
[web2py] Re: Mixing/supporting CMS with Web2py
I cannot help presenting my developing plugin, which has a concrete5- like wysiwyg functionality: http://dev.s-cubism.com/plugin_managed_html/page1/_managed_html_edit(note: use chrome or FF) In this page, you can click highlighed blocks and edit their texts, images, and htmls, and move specified blocks, and also check corresponding the preview and live page. These editable blocks are defined in web2py views using functions and decorators: https://github.com/sqlabs/sqlabs/blob/master/views/plugin_managed_html/page1.html Although it's very experimental and plenty remains to be done, the core logic may be closely related to this discussions. Give it a try and welcome any feedback. On 11月11日, 午後6:28, Bruno Rocha wrote: > This one:http://ourway.ir/pages/blog?u=blouweb > > IS a very nice facebook clone app! can be extended for a cms. is it open > source?
[web2py] Re: Mixing/supporting CMS with Web2py
I cannot help presenting my developing plugin, which has a concrete5- like wysiwyg functionality: http://dev.s-cubism.com/plugin_managed_html/page1/_managed_html_edit (note: use chrome or FF) In this page, you can click highlighed blocks and edit their texts, images, and htmls, and move specified blocks, and also check corresponding the preview and live page. These editable blocks are defined in web2py views using functions and decorators: https://github.com/sqlabs/sqlabs/blob/master/views/plugin_managed_html/page1.html Although it's very experimental and plenty remains to be done, the core logic may be closely related to this discussions. Give it a try and welcome any feedback. On 11月11日, 午後6:28, Bruno Rocha wrote: > This one:http://ourway.ir/pages/blog?u=blouweb > > IS a very nice facebook clone app! can be extended for a cms. is it open > source?
[web2py] grid how to generate user_signature?
Using grid on 1.99.2. After a user creates an object I want to redirect him to edit the object. How do I append a valid user_signature to the redirect url. I can't make the methods in the book work. Also I don't want to turn user_signature off. Any hints?
[web2py] Re: Mixing/supporting CMS with Web2py
This is great. By the way, http://dev.s-cubism.com/ mentions nanahoshi-cms as a web2py based CMS under development. How far along is that? Does it/will it use this plugin_managed_html? Anthony On Friday, November 11, 2011 8:23:24 AM UTC-5, kenji4569 wrote: > > I cannot help presenting my developing plugin, which has a concrete5- > like wysiwyg functionality: > > > http://dev.s-cubism.com/plugin_managed_html/page1/_managed_html_edit > > (note: use chrome or FF) > > In this page, you can click highlighed blocks and edit their texts, > images, and htmls, and move specified blocks, and also check > corresponding the preview and live page. > > These editable blocks are defined in web2py views using functions and > decorators: > > > https://github.com/sqlabs/sqlabs/blob/master/views/plugin_managed_html/page1.html > > > > Although it's very experimental and plenty remains to be done, the > core logic may be closely related to this discussions. > Give it a try and welcome any feedback. > On 11月11日, 午後6:28, Bruno Rocha wrote: > > This one:http://ourway.ir/pages/blog?u=blouweb > > > > IS a very nice facebook clone app! can be extended for a cms. is it open > > source?
[web2py] Re: Mixing/supporting CMS with Web2py
Anthony Thank you for your response. >How far along is that? Does it/will it use this plugin_managed_html? I am now >developing several core plugins for the product, and will publish them soon. >The product itself is currently for domestic, though. On 11月11日, 午後10:46, Anthony wrote: > This is great. By the way,http://dev.s-cubism.com/mentions nanahoshi-cms > as a web2py based CMS under development. How far along is that? Does > it/will it use this plugin_managed_html? > > Anthony > > > > > > > > On Friday, November 11, 2011 8:23:24 AM UTC-5, kenji4569 wrote: > > > I cannot help presenting my developing plugin, which has a concrete5- > > like wysiwyg functionality: > > >http://dev.s-cubism.com/plugin_managed_html/page1/_managed_html_edit > > > (note: use chrome or FF) > > > In this page, you can click highlighed blocks and edit their texts, > > images, and htmls, and move specified blocks, and also check > > corresponding the preview and live page. > > > These editable blocks are defined in web2py views using functions and > > decorators: > > >https://github.com/sqlabs/sqlabs/blob/master/views/plugin_managed_htm... > > > Although it's very experimental and plenty remains to be done, the > > core logic may be closely related to this discussions. > > Give it a try and welcome any feedback. > > On 11月11日, 午後6:28, Bruno Rocha wrote: > > > This one:http://ourway.ir/pages/blog?u=blouweb > > > > IS a very nice facebook clone app! can be extended for a cms. is it open > > > source?
[web2py] Re: Mixing/supporting CMS with Web2py
Anthony Thank you for your response. >How far along is that? Does it/will it use this plugin_managed_html? I am now developing several core plugins for the product, and will publish them soon. The product itself is currently for domestic, though. On 11月11日, 午後10:46, Anthony wrote: > This is great. By the way,http://dev.s-cubism.com/mentions nanahoshi-cms > as a web2py based CMS under development. How far along is that? Does > it/will it use this plugin_managed_html? > > Anthony > > > > > > > > On Friday, November 11, 2011 8:23:24 AM UTC-5, kenji4569 wrote: > > > I cannot help presenting my developing plugin, which has a concrete5- > > like wysiwyg functionality: > > >http://dev.s-cubism.com/plugin_managed_html/page1/_managed_html_edit > > > (note: use chrome or FF) > > > In this page, you can click highlighed blocks and edit their texts, > > images, and htmls, and move specified blocks, and also check > > corresponding the preview and live page. > > > These editable blocks are defined in web2py views using functions and > > decorators: > > >https://github.com/sqlabs/sqlabs/blob/master/views/plugin_managed_htm... > > > Although it's very experimental and plenty remains to be done, the > > core logic may be closely related to this discussions. > > Give it a try and welcome any feedback. > > On 11月11日, 午後6:28, Bruno Rocha wrote: > > > This one:http://ourway.ir/pages/blog?u=blouweb > > > > IS a very nice facebook clone app! can be extended for a cms. is it open > > > source?
[web2py] Re: The -f command line switch seems to break custom_import
The same issue affects the loading of "logging.conf". It is read from the current directory at the beginning of main.py. But using the debian package the cwd is '/usr/share/web2py', and that location is not writable to users, nor can be customized per application server. Probably logging.conf should be reread after parsing the '-f' switch as well.
Re: [web2py] Offline Access to web2py manual?
On Fri, 2011-11-11 at 10:05 +0200, Johann Spies wrote: > 'man wget' is quite good. > > Did you try http://www.gnu.org/software/wget/manual/ ? Yup.. just found out that ``--html-extension`` got renamed into: -E, --adjust-extension save HTML/CSS documents with proper extensions. That's why I didn't find it in the manpage of the new wget, doesn't explain why I didn't find it originally. Anyways, thanks to who suggested use of that option, absolutely needed when creating mirror of any dynamically-served website. -- Samuele ~redShadow~ Santi redshadow[at]hackzine.org - redshadowhack[at]gmail.com Blog: http://hackzine.org GPG Key signature: 050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933 /me recommends: Squadra Informatica - http://www.squadrainformatica.com - Proud ThinkPad T-Series owner - Registered Linux-User: #440008 * GENTOO User since 1199142000 (2008-01-01) * former DEBIAN SID user "Software is like sex: it's better when it's free!" -- Linus Torvalds signature.asc Description: This is a digitally signed message part
[web2py] Some thoughts on the use of web2py's HTML helpers
In case anyone is interested, my response to a Stackoverflow question regarding when to use web2py's HTML helpers (vs. regular HTML markup): http://stackoverflow.com/questions/8091487/what-are-the-benefits-of-building-html-markup-with-html-helpers-in-web2py/8095585#8095585 Anthony
Re: [web2py] Some thoughts on the use of web2py's HTML helpers
On Nov 11, 2011, at 7:05 AM, Anthony wrote: > In case anyone is interested, my response to a Stackoverflow question > regarding when to use web2py's HTML helpers (vs. regular HTML markup): > > http://stackoverflow.com/questions/8091487/what-are-the-benefits-of-building-html-markup-with-html-helpers-in-web2py/8095585#8095585 > > Anthony Nicely done. That'd be useful in the book, too, as an overview (maybe it is; I'm not looking at it right now). XML should be on the list at the end (and maybe TAG?).
Re: [web2py] Some thoughts on the use of web2py's HTML helpers
On Friday, November 11, 2011 10:12:17 AM UTC-5, Jonathan Lundell wrote: > > Nicely done. That'd be useful in the book, too, as an overview (maybe it > is; I'm not looking at it right now). XML should be on the list at the end > (and maybe TAG?). > Thanks. Just added XML and TAG. I'm continuing to work on book edits, so I'll try to incorporate some of this. Anthony
Re: [web2py] Some thoughts on the use of web2py's HTML helpers
Pretty clear explanation Anthony... Thanks to report hear this answer on stackoverflow. Richard On Fri, Nov 11, 2011 at 10:23 AM, Anthony wrote: > On Friday, November 11, 2011 10:12:17 AM UTC-5, Jonathan Lundell wrote: >> >> Nicely done. That'd be useful in the book, too, as an overview (maybe it >> is; I'm not looking at it right now). XML should be on the list at the end >> (and maybe TAG?). >> > Thanks. Just added XML and TAG. I'm continuing to work on book edits, so > I'll try to incorporate some of this. > > Anthony >
[web2py] IS_MATCH()
How would I write a validator validating zipcode with the following format: 4 digits space 2 capitals: e.g. 1000 AZ This is syntactically not correct: IS_MATCH('\d{4}\ \[A-Z] {2}',error_message='no match 4 digits, space, 2 capitals') Kind regards, Annet
[web2py] GAE Contains() issue?
Hi, I am using version 1.99.2 of web2py and am getting an error when trying to run a query with "contains()" in Google App Engine. The Model: db.define_table('Site_Main', Field('site', 'string', length=13), Field('companyID', 'list:integer'), Field('active', 'integer'), Field('syncToPalm', 'integer'), migrate=settings.migrate) The Query: rows = db(db.Site_Main.companyID.contains(session.company_id)).select(db.Site_Main.id) The Error: === Traceback (most recent call last): File "/home/pallav/Desktop/google_appengine/web2py/gluon/ restricted.py", line 194, in restricted exec ccode in environment File "/home/pallav/Desktop/google_appengine/web2py/applications/ samapp/controllers/datasync.py:sites", line 119, in File "/home/pallav/Desktop/google_appengine/web2py/gluon/ globals.py", line 149, in self._caller = lambda f: f() File "/home/pallav/Desktop/google_appengine/web2py/applications/ samapp/controllers/datasync.py:sites", line 42, in sites File "/home/pallav/Desktop/google_appengine/web2py/applications/ samapp/models/datasync/site_data.py", line 67, in read rows = db(db.Site_Main.companyID.contains(session.company_id)).select(db.Site_Main.id) File "/home/pallav/Desktop/google_appengine/web2py/gluon/dal.py", line 5697, in select return self.db._adapter.select(self.query,fields,attributes) File "/home/pallav/Desktop/google_appengine/web2py/gluon/dal.py", line 3351, in select (items, tablename, fields) = self.select_raw(query,fields,attributes) File "/home/pallav/Desktop/google_appengine/web2py/gluon/dal.py", line 3308, in select_raw filters = self.expand(query) File "/home/pallav/Desktop/google_appengine/web2py/gluon/dal.py", line 3192, in expand return expression.op(expression.first) TypeError: CONTAINS() takes exactly 3 arguments (2 given) I have tried looking through the book, and the forums, and searched on Google but found no references to this specific error. Is something broken in the DAL related to GAE in the latest web2py? I am downloading Eclipse to see if I can just debug the DAL myself but any help is appreciated. Thanks Pallav
Re: [web2py] IS_MATCH()
On Nov 11, 2011, at 8:11 AM, annet wrote: > How would I write a validator validating zipcode with the following > format: 4 digits space 2 capitals: e.g. 1000 AZ > > This is syntactically not correct: IS_MATCH('\d{4}\ \[A-Z] > {2}',error_message='no match 4 digits, space, 2 capitals') Don't escape the left bracket (and no need to escape the space). You probably also want to anchor the search. IS_MATCH('^\d{4} [A-Z]{2}$',error_message='no match 4 digits, space, 2 capitals')
[web2py] Re: Id been Shown Instead of Name in dropdown list
>From Burno'e example db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.id') is optiona and automatic. If you add it it overrides the format so you want to do db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.id',format=lambda row: "%s" % row.**VehicleName_id.VehicleName) On Nov 11, 12:17 am, Bruno Rocha wrote: > *or you can try:* > > db.define_table("tblVehicle", > Field("*VehicleName_id*",db.tblVehicleName,label='Vehicle Name'), > Field("VehicleNo", default=None,label='VehicleNo'), > format=*lambda row: "%s" % row.**VehicleName_id.VehicleName* ) > db.tblVehicle.VehicleName.requires=IS_IN_DB(db,'tblVehicleName.id','%( > VehicleName)s') > > * # Creating tblDriver adding Driver name and selecting the name of vehicle > from the dropdown* > > db.define_table("tblDriver", > Field("DriverName",'string',label='Driver Name'), > Field('id_tblVehicle', db.tblVehicle,label='Vehicle Name')) > db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.id') > > By thw way you have problem with the name you give to the fields, try to > name references with *tablename_id* to avoid confusion. > > -- > > Bruno Rocha > [http://rochacbruno.com.br]
[web2py] Re: new welcome app - need help with css
new versions: http://tests.web2py.com/examples http://tests.web2py.com/welcome thanks Anthony for the hard work. (I disabled mobile detection menu because I have not updated the libs yet) On Nov 11, 5:58 am, Paolo Caruccio wrote: > Anthony, > > since IE (any version), in some circumstances, has a behavior different > from other browsers, we need to detect it in css rules. So any solution is > good. > > Paolo
[web2py] Re: Mixing/supporting CMS with Web2py
Kenji, as you know we are building the new web2py web page. I'd rather link your plugins than mine. Would you be able to host some of plugins at http://web2py.com/plugins and provide a service like this: http://web2py.com/plugins/default/plugins.json I would still act as proxy for the service since it is linked by the wizard. Massimo On Nov 11, 8:20 am, kenji4569 wrote: > Anthony > > Thank you for your response. > > >How far along is that? Does it/will it use this plugin_managed_html? > > I am now developing several core plugins for the product, and will > publish them soon. The product itself is currently for domestic, > though. > On 11月11日, 午後10:46, Anthony wrote: > > > > > > > > > This is great. By the way,http://dev.s-cubism.com/mentionsnanahoshi-cms > > as a web2py based CMS under development. How far along is that? Does > > it/will it use this plugin_managed_html? > > > Anthony > > > On Friday, November 11, 2011 8:23:24 AM UTC-5, kenji4569 wrote: > > > > I cannot help presenting my developing plugin, which has a concrete5- > > > like wysiwyg functionality: > > > >http://dev.s-cubism.com/plugin_managed_html/page1/_managed_html_edit > > > > (note: use chrome or FF) > > > > In this page, you can click highlighed blocks and edit their texts, > > > images, and htmls, and move specified blocks, and also check > > > corresponding the preview and live page. > > > > These editable blocks are defined in web2py views using functions and > > > decorators: > > > >https://github.com/sqlabs/sqlabs/blob/master/views/plugin_managed_htm... > > > > Although it's very experimental and plenty remains to be done, the > > > core logic may be closely related to this discussions. > > > Give it a try and welcome any feedback. > > > On 11月11日, 午後6:28, Bruno Rocha wrote: > > > > This one:http://ourway.ir/pages/blog?u=blouweb > > > > > IS a very nice facebook clone app! can be extended for a cms. is it open > > > > source?
Re: [web2py] Python 2.7 on GAE (experimental)
On Nov 10, 2011, at 5:33 PM, pallav wrote: > Thank you. I also appreciate you putting your app.yaml on the code > repository - it helped me get started today (before seeing what you > had done, my own had not been customized for wsgi, just Python 2.7). > > I'm definitely interested in learning the relationship between the > DAL, 2.7, and transactions. I would like to help improve GAE support > in the DAL, so if there is anything I can learn from your experiences, > maybe we can use it to improve web2py code. I believe this is the > killer feature of web2py - being able to deploy to GAE easily while > still being quick to start, and portable. > > Any interest? Yes. The underlying SQL transaction mechanisms (caveat: I'm no expert on this subject) are select for update and begin transaction. The Google Datastore has neither of these as such. What it does have is run_in_transaction(), to which you pass a function, and it runs that function as a transaction. The Datastore doesn't lock, at least not at a level that's visible to us. The way run_in_transaction() works is that if two such transactions collides, one of them succeeds and the other is aborted, but automatically retried. So whatever you put in run_in_transaction() must be idempotent and moreover not have external side effects. (Side note: it seems to me that this makes the relationship between GAE transactions and memcache problematic, since I assume that memcache puts inside a transaction are not visible to the transaction logic, and therefore constitute an undesirable side effect, leading to possible inconsistencies between the cache and the Datastore.) Python 2.7 complicates this because Google has decreed that the use of 2.7 requires the use of the High Replication Datastore. The HR Datastore says that any query in a transaction must be an ancestor query, and the DAL doesn't know anything about ancestors and entity groups. So what do you do if you (like me) want to use GAE with 2.7 and need transaction support? I see three possibilities. 1. Bypass the DAL and use the Datastore API directly. I have a very simple model that maps into the Datastore entity-group model quite naturally, so that's what I did. 2. Use MySQL instead of the Datastore (assuming that this works from 2.7): http://googleappengine.blogspot.com/2011/10/google-cloud-sql-your-database-in-cloud.html 3. Teach the DAL enough about entity groups that it can support transactions. More about option (3) follows. What I have in mind is a decorator for a function in your controller that you want run as a transaction. In the GAE case, it'd use run_in_transaction() to wrap the function; in the standard SQL case it'd execute BEGIN TRANSACTION (in whatever flavor the db requires) before calling the function. This won't work today, partly because we don't have portable BEGIN TRANSACTION support, and partly because our GAE support doesn't have entity groups (I think). I propose to address *that* somewhat crudely, by creating an entity that represents the database, and is the parent of a second-level entity that represents each table. A table entity would be the parent of all its rows. Then any query within a single table would use the table entity as the ancestor, and a query that used >1 table would use the db entity as the ancestor. Three caveats: I don't actually know how the DAL maps SQL to the Datastore. GQL, maybe? So I don't know how well the structure I've described could be supported by the DAL. Second, I'm enough of a novice using the Datastore that I might be missing something about its mechanisms that could make this more or less difficult than I'm implying. Third, I'm implying, effectively, something like table-level or database-level locking; that could have performance issues. (Maybe each row should have its own parent entity, so we can "lock" a row as well.) Last: I've addressed my own situation by bypassing the DAL, and while I'm more than happy to participate in the discussion, I don't have the time or expertise to contribute much to the implementation of (3).
[web2py] Re: The -f command line switch seems to break custom_import
In trunk! Thanks. On Nov 10, 9:51 am, pgergo wrote: > Fix, in case anyone interested: > > --- a/custom_import.py 2011-10-01 12:03:20.0 +0200 > +++ b/custom_import.py 2011-11-10 16:22:29.466847323 +0100 > @@ -11,7 +11,7 @@ > def custom_import_install(web2py_path): > global _web2py_importer > global _web2py_path > - if _web2py_importer: > + if _web2py_path == web2py_path: > return # Already installed > _web2py_path = web2py_path > _web2py_importer = _Web2pyImporter(web2py_path) > --- a/main.py 2011-10-01 12:03:20.0 +0200 > +++ b/main.py 2011-11-10 16:22:06.963343076 +0100 > @@ -751,6 +751,7 @@ > global_settings.applications_parent = path > os.chdir(path) > [add_path_first(p) for p in (path, abspath('site- > packages'), "")] > + custom_import_install(web2py_path) > > save_password(password, port) > self.pid_filename = pid_filename
[web2py] Re: GAE Contains() issue?
session.company_id is None in your case and None cannot be contained in a list of strings. It has to fail in some place. We could catch the error somewhere else and have a more meaningful error but you really want something like: if session.company_id: rows = db(db.Site_Main.companyID.contains(session.company_id)).select(db.Site_Main .id) else: rows = [] On Nov 11, 10:20 am, pallav wrote: > Hi, > > I am using version 1.99.2 of web2py and am getting an error when > trying to run a query with "contains()" in Google App Engine. > > The Model: > > > db.define_table('Site_Main', > Field('site', 'string', length=13), > Field('companyID', 'list:integer'), > Field('active', 'integer'), > Field('syncToPalm', 'integer'), > migrate=settings.migrate) > > The Query: > > > rows = > db(db.Site_Main.companyID.contains(session.company_id)).select(db.Site_Main > .id) > > The Error: > === > Traceback (most recent call last): > File "/home/pallav/Desktop/google_appengine/web2py/gluon/ > restricted.py", line 194, in restricted > exec ccode in environment > File "/home/pallav/Desktop/google_appengine/web2py/applications/ > samapp/controllers/datasync.py:sites", line 119, in > File "/home/pallav/Desktop/google_appengine/web2py/gluon/ > globals.py", line 149, in > self._caller = lambda f: f() > File "/home/pallav/Desktop/google_appengine/web2py/applications/ > samapp/controllers/datasync.py:sites", line 42, in sites > File "/home/pallav/Desktop/google_appengine/web2py/applications/ > samapp/models/datasync/site_data.py", line 67, in read > rows = > db(db.Site_Main.companyID.contains(session.company_id)).select(db.Site_Main > .id) > File "/home/pallav/Desktop/google_appengine/web2py/gluon/dal.py", > line 5697, in select > return self.db._adapter.select(self.query,fields,attributes) > File "/home/pallav/Desktop/google_appengine/web2py/gluon/dal.py", > line 3351, in select > (items, tablename, fields) = > self.select_raw(query,fields,attributes) > File "/home/pallav/Desktop/google_appengine/web2py/gluon/dal.py", > line 3308, in select_raw > filters = self.expand(query) > File "/home/pallav/Desktop/google_appengine/web2py/gluon/dal.py", > line 3192, in expand > return expression.op(expression.first) > TypeError: CONTAINS() takes exactly 3 arguments (2 given) > > I have tried looking through the book, and the forums, and searched on > Google but found no references to this specific error. Is something > broken in the DAL related to GAE in the latest web2py? I am > downloading Eclipse to see if I can just debug the DAL myself but any > help is appreciated. > > Thanks > Pallav
[web2py] Re: IS_MATCH()
Hi Jonathan, Thanks for your reply. What do you mean by anchoring the search? Kind regards, Annet
[web2py] Re: SQLFORM.grid : formstyle, readable and writable control
Richard, You answered my question already. Using your nomenclature it should have been table[1], which would be the created table. On Nov 10, 4:30 pm, Richard Vézina wrote: > Where do you see form[1]? > > What do you want to know? > > What I am doing in my for loop? > > Richard > > > > > > > > On Thu, Nov 10, 2011 at 4:27 PM, Cliff wrote: > > Richard, > > > If you have time, what happens if you substitute form[1] for > > form.create_form[0] ? > > > Thanks, > > Cliff Kachinske > > > On Nov 10, 4:10 pm, Anthony wrote: > > > My mistake -- looks like it always has a .create_form, but set to None in > > > other cases. But in that case: > > > > if form.create_form: > > > > should work, though I think you said that didn't work -- what happened > > when > > > you tried that? > > > > Anthony > > > > On Thursday, November 10, 2011 4:04:00 PM UTC-5, Richard wrote: > > > > > Ok but it's not seem to work... I get this error trace back : > > > > > 1. > > > > 2. > > > > 3. > > > > 4. > > > > 5. > > > > 6. > > > > 7. > > > > 8. > > > > 9. > > > > 10. > > > > > Traceback (most recent call last): > > > > > File "/web2py/gluon/restricted.py", line 194, in restricted > > > > > exec ccode in environment > > > > > File "/web2py/applications/sgddms/controllers/test.py", line 4437, > > in > > > > > File "/web2py/gluon/globals.py", line 149, in > > > > > self._caller = lambda f: f() > > > > > File "/web2py/applications/sgddms/controllers/test.py", line 4396, > > in test_sqlformgrid > > > > > for i in range(0,len(form.create_form[0])): > > > > TypeError: 'NoneType' object is unsubscriptable > > > > > Any idea? > > > > > It really the first time I play with SQLFORM.grid and it not documented > > > > yet so I may ask kind of trivial question... Also I a bit under > > pressure. > > > > > I really appreciate your help. > > > > > Richard > > > > > On Thu, Nov 10, 2011 at 3:57 PM, Anthony wrote: > > > > >> I'd go with the second option -- more fool proof. > > > > >> On Thursday, November 10, 2011 3:11:11 PM UTC-5, Richard wrote: > > > > >>> Ok so this : > > > > >>> "if 'new' in request.args and form.create_form:" > > > > >>> or shorter : > > > > >>> "if hasattr(form, 'create_form'):" > > > > >>> ? > > > > >>> Thank you. > > > > >>> Richard > > > > >>> On Thu, Nov 10, 2011 at 2:58 PM, Anthony wrote: > > > > If you have "if 'new' in request.args:' you should not also need "if > > > form.create_form" (even if you did, you could simply put them in > > the same > > > "if" statement with an "and"). Alternatively, use "if hasattr(form, > > > 'create_form'):" -- all by itself. > > > > Anthony > > > > On Thursday, November 10, 2011 2:48:49 PM UTC-5, Richard wrote: > > > > > Here a working piece of code : > > > > > def test_sqlformgrid(): > > > > form = SQLFORM.grid(db.TABLE, ui='jquery-ui', > > > > editable=auth.has_membership('reviewer'), > > > > deletable=auth.has_membership('reviewer'), formstyle = 'divs') > > > > if 'new' in request.args: > > > > if form.create_form > > > > for i in range(0,len(form.create_form[**0**])): > > > > if len(form.create_form[0][i][2][0]) > 0: > > > form.create_form[0][i][0].**appe**nd(SPAN((helpicon(), > > > > SPAN(form.create_form[0][i][2][0])),_class='tooltip')) > > > > del(form.create_form[0][i][2]) > > > > return dict(form=form) > > > > > Off course the for i in range... Is specific to my need but it the > > way > > > > to manipulate the generated html form before it goes in user > > hand... > > > > > :) > > > > > Richard > > > > > On Thu, Nov 10, 2011 at 2:44 PM, Richard Vézina > >wrote: > > > > >> It was working "if form.create_form:"... > > > > >> I thought that grid use form variable doesn't matter if the > > > >> SQLFORM.grid wasn't in a form variable at all... > > > > >> And my bad because I show form = crud... But it was not my > > > >> SQLFORM.grid... Arrg. > > > > >> Sorry about that... > > > > >> Richard > > > > >> On Thu, Nov 10, 2011 at 1:26 PM, Anthony > > wrote: > > > > >>> On Thursday, November 10, 2011 12:42:49 PM UTC-5, Richard wrote: > > > > "if 'new' in request.args:" works (allow to load the grid) but > > the > > > "if form.create_form:" not work alone or in conjunction with > > the former > > > > >>> Yeah, looks like it would have to be something like "if > > > >>> hasattr(form, 'create_form'):".
Re: [web2py] Re: new welcome app - need help with css
Massimo can you tell me how to design a website, do I have to be a graphic designer to throw a nice little template? On Fri, Nov 11, 2011 at 10:50 AM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > new versions: > > http://tests.web2py.com/examples > http://tests.web2py.com/welcome > > thanks Anthony for the hard work. (I disabled mobile detection menu > because I have not updated the libs yet) > > On Nov 11, 5:58 am, Paolo Caruccio wrote: > > Anthony, > > > > since IE (any version), in some circumstances, has a behavior different > > from other browsers, we need to detect it in css rules. So any solution > is > > good. > > > > Paolo -- *-Furqan Rauf* *Do you love your creator? Love your fellow-beings first. -Prophet Muhammad * *http://www.amway.com/furqanrauf*
Re: [web2py] Re: IS_MATCH()
On Nov 11, 2011, at 9:12 AM, annet wrote: > Thanks for your reply. What do you mean by anchoring the search? In a regular expression, ^ matches the beginning of the string, and $ matches the end; I'm referring to those as anchors. So ^xyz$ matches only "xyz", but the pattern xyz matches (for example) abcxyzdef. IS_MATCH is a little confusing in this regard, because it has some options for automatically anchoring the search, and those options are a little different in the trunk than in stable. But if you want an anchored search, it never hurts to make it explicit with ^ and/or $.
[web2py] application installation problem
I have dropped my application folder in web2py's application folder, but when i go to the administrative interface, the framework can not find it. Is there a way to make web2py aware of this new application, so I can see it in the admin interface and be able to run it? Thank you
[web2py] Re: Random Selection Issue
Anyone able to help with this? No pressure, just hoping I can get some insight from one of the Gurus :-) *cheers On Thu, Nov 10, 2011 at 11:22 AM, Andrew Evans wrote: > Hello I am trying to randomly select from entries in my database then > store that random result. The problem is its storing the wrong result (I > think its storing the previous random selection) > > Any ideas how I can achieve my goal? > > > @auth.requires_login() > def xreflection(): > game_id = request.args(0) > reflection_id = request.args(1) > if reflection_id == None: > return dict(redirect(URL('error','invalid'))) > if (game_id == None): > return dict(redirect(URL('error','invalid'))) > gameDB = db(db.xgame.id == int(game_id)).select() or > redirect(URL('error','invalid')) > cardDB = db(db.xcard.type == > int(reflection_id)).select(orderby='',limitby=(0,1)) or > redirect(URL('error','invalid')) > for xcard in cardDB: > for xgame in gameDB: > > form = SQLFORM(db.xreflection) > db.xreflection.game.default = xgame.id > #weird stuff happens here! > db.xreflection.card.default = xcard.id > > db.xreflection.reflection_type.default = reflection_id > if form.accepts(request.vars, session): > db.notification.insert(receptient = xgame.userinfo, title > = form.vars.title, description = 'has responded to',type = > reflection_id,xgame=xgame.id) > session.flash = 'You have successfully reflected.' > return dict(redirect(URL('view','xgame',args=xgame.id))) > elif form.errors: > response.flash = 'Please correct the highlighted fields' > return dict(form=form, xgame=xgame,xcard=xcard) > else: > return dict(form=form, xgame=xgame,xcard=xcard) > >
[web2py] Re: Random Selection Issue
Try setting the defaults before creating the form. On Friday, November 11, 2011 12:54:02 PM UTC-5, Andrew wrote: > > Anyone able to help with this? No pressure, just hoping I can get some > insight from one of the Gurus :-) > > *cheers > > On Thu, Nov 10, 2011 at 11:22 AM, Andrew Evans wrote: > >> Hello I am trying to randomly select from entries in my database then >> store that random result. The problem is its storing the wrong result (I >> think its storing the previous random selection) >> >> Any ideas how I can achieve my goal? >> >> >> @auth.requires_login() >> def xreflection(): >> game_id = request.args(0) >> reflection_id = request.args(1) >> if reflection_id == None: >> return dict(redirect(URL('error','invalid'))) >> if (game_id == None): >> return dict(redirect(URL('error','invalid'))) >> gameDB = db(db.xgame.id == int(game_id)).select() or >> redirect(URL('error','invalid')) >> cardDB = db(db.xcard.type == >> int(reflection_id)).select(orderby='',limitby=(0,1)) or >> redirect(URL('error','invalid')) >> for xcard in cardDB: >> for xgame in gameDB: >> >> form = SQLFORM(db.xreflection) >> db.xreflection.game.default = xgame.id >> #weird stuff happens here! >> db.xreflection.card.default = xcard.id >> >> db.xreflection.reflection_type.default = reflection_id >> if form.accepts(request.vars, session): >> db.notification.insert(receptient = xgame.userinfo, title >> = form.vars.title, description = 'has responded to',type = >> reflection_id,xgame=xgame.id) >> session.flash = 'You have successfully reflected.' >> return dict(redirect(URL('view','xgame',args=xgame.id))) >> elif form.errors: >> response.flash = 'Please correct the highlighted fields' >> return dict(form=form, xgame=xgame,xcard=xcard) >> else: >> return dict(form=form, xgame=xgame,xcard=xcard) >> >> > >
[web2py] Re: ATR
Marcelo, Por favor disculpame la demora en responder, estoy bastante atareado con el trabajo, trabajos de la facu y parciales. Paso a responder lo mas ordenado posible: Arduino vs Placa Paralelo: En principio la idea era no sacar al micro de la placa arduino, tomando la ventaja de utilizar el usb para alimentar el prototipo. Ademas de eso, la placa arduino viene con un micro de comuniaciones que te permite enviar y recibir datos por usb. Por lo que conviene utlizar esa ventaja y dejar el micro ahi. Lo que vos decis es cierto, y en el caso de una implementacion de campo hay que tenerlo en cuenta, pero como en esta materia hacemos prototipos , no creo que haya problema en dejar el micro en la arduino y ahorrarnos el disenio de una placa de control. Proyecto GNAT: Lo dejamos asi entonces, solamente queria estar seguro de que no estaba haciendo nada mal. Hay un modulo GNAT.Serial_Communications que permite enviar datos por usb, esta muy poco docuemntado asi que es cuestrion de investigar mas profundamente cuando logre tener algo de tiempo. Efectivamente estoy en: web2py-usuar...@googlegroups.com y web2py@googlegroups.com. Estuve en mi trabajo trabajando en un proyecto que permita a los interesados subscribirse o desuscribirse de la notificacion de deploy de aplicaciones , ya sea por instancia, server o la combinacion de ambas. Lamentablemente mi jefe se fue a otra parte de la compania y el proyecto quedo en la nada. [Soy Systems Engineer, seria como administrador de sistemas pero orientado a las aplicaciones, mi equipo mantiene el entorno de QA de lastminute.com] Nuevamente gracias por responder, Nicolas Palumbo 2011/11/5 Marcelo Zabaljauregui : > Hola Nicolas!!! > Bien, son varias cositas para explicar y por mail va hacer algo > complicado así que voy a tratar de ser lo mas claro posible. > Arduino vs Placa Paralelo > Si quered reemplazar la placa paralela por una arduino se te va a compliar > bastante, porque la arduino tiene su propio microcontrolador que requiere > que su código sea escrito en c con la interfaz de desarrollo que proporciona > arduino, el usb solo cumple la funcion para subir el micro-código escrito > por esa IDE y para alimentar la placa, que una vez que se sube el > micro-código uno si la alimenta con una bateria o con una fuente la placa se > independiza de la PC, que es es la idea principal de los microcontroladores. > Atravez del USB creo que no vas a poder leer datos del controlador. > Por lo menos eso es lo que entendí de la arduino cuando el profesor me > comento que también la iban a utilizar en la cátedra y me puse a investigar > en el sitio. > > Proyecto GNAT > Me asombre con eso que tuviste que poner en el código para que te funcione > "La Teoría" diría que no deberías hacerlo, pero bueno sera cuestión de > analizar mas porque esto, pero si funciona para que modificarlo ;). > Como todo sistema informático no hay una única manera de solucionarlo, a mi > se me ocurriría simplificar mas las tareas en sentido que crearía una > una tarea que sea surtidor y en esa tarea pondría las cosas necesarias para > operar el surtidor, guardar sus datos y como leerlos, luego seria mas > sencillo cuando uno tiene mas de un surtidor para operar... > Pero seria de sentarse unos segundos charlarlo y verlo. > Por ahí en un par de semanas me pueda volver a dar una vuelta por la > facultad a la hora del laboratorio coordinamos y lo charlamos. > Pero insisto que lo que tenes esta bien y para esta instancia de la materia > te recomendaría dejarlo así (Es lo que yo haría :P ). > Bueno espero no haberte aburrido con las contestaciones, nos estamos viendo. > Ahora algo fuera de la materia, puede ser que vos estés en el grupo de > web2py? > > > > El 3 de noviembre de 2011 23:01, Nicolas Palumbo > escribió: >> >> Marcelo, >> En principio gracias por contestar. >> Te adjunto mi proyecto de GNAT en un archivo .zip. Por favor >> renombralo xq sino gmail no me lo deja enviar. >> El problema es que en principio tuve que agregar un delay a todas las >> tareas de Ada que corren permanentemente a la espera de un comando, ya >> que sino no continuaban con el loop.. por ejemplo: >> >> task body tarea_motor_valvula is >> begin >> loop >> -- Put_Line("Pasa por tarea_motor_valvula"); >> select >> >> when (boquilla.getEstadoBoquilla = retirada) >> . >> or >> accept terminar; >> exit; >> or >> delay(0.1); >> end select; >> end loop; >> end tarea_motor_valvula; >> >> La verdad si a esto le sacas el delay(X) en cualquiera de las tareas >> no funciona. Queria saber si esta bien hecho aunque tenga el delay y >> que contra/problemas nos puede traer y/o cual es la forma correcta de >> hacer lo mismo. >> >> Con respecto a lo que mando el profesor mazzeo en el mail anterior. Me >> gustaria usar en principio comunicacion serial por usb desde ada (pc >> linux) a un arduino, reemplazando el arduino lo que se
Re: [web2py] Re: new welcome app - need help with css
On Friday, November 11, 2011 12:27:19 PM UTC-5, Furqan wrote: > > Massimo can you tell me how to design a website, do I have to be a graphic > designer to throw a nice little template? > There are lots of free templates, CSS frameworks, and front-end boilerplates out there. And if you've got a few dollars, there are some nice themes here: http://themeforest.net/. Also, check out: http://twitter.github.com/bootstrap/ http://foundation.zurb.com/ Anthony
[web2py] Implementing unari relationships in web2py
I am trying to implement a unari relationship in one of my tables.(Course for example) I am declaring a field has_prerequisites and have it reference it's own table. Is this the best way to do this, or is there a better way to solve the problem
Re: [web2py] Re: Random Selection Issue
hmm that did not work any other ideas *cheers this is what we did def xreflection(): game_id = request.args(0) reflection_id = request.args(1) if reflection_id == None: return dict(redirect(URL('error','invalid'))) if game_id == None: return dict(redirect(URL('error','invalid'))) gameDB = db(db.xgame.id == int(game_id)).select() or redirect(URL('error','invalid')) cardDB = db(db.xcard.type == int(reflection_id)).select(orderby='',limitby=(0,1)) or redirect(URL('error','invalid')) for xcard in cardDB: for xgame in gameDB: db.xreflection.game.default = xgame.id #weird stuff happens here! db.xreflection.card.default = xcard.id db.xreflection.reflection_type.default = reflection_id form = SQLFORM(db.xreflection) if form.accepts(request.vars, session): db.notification.insert(receptient = xgame.userinfo, title = form.vars.title, description = 'has responded to',type = reflection_id,xgame=xgame.id) session.flash = 'You have successfully reflected.' return dict(redirect(URL('view','xgame',args=xgame.id))) elif form.errors: response.flash = 'Please correct the highlighted fields' return dict(form=form, xgame=xgame,xcard=xcard) else: return dict(form=form, xgame=xgame,xcard=xcard)
[web2py] columns option removed from sqlform.grid?
Hi , could anyone give me an hint on this one please: i've been playing with sqlform.grid and noticed that in web2py Version 1.99.3 (2011-11-11 10:27:54) dev i cannot use the columns option any more (TypeError: grid() got an unexpected keyword argument 'colums') This did work in previous version of web2py. Should i use an other option to select the columns i want to display or just revert back to older version of web2py? Thanks in advance for any help! Jaap
[web2py] Re: web2py with twitter bootstrap - very clean interface ...
Great job! On Sep 26, 11:10 am, David Marko wrote: > http://labs.blouweb.com/bootstrap/default/index
Re: [web2py] columns option removed from sqlform.grid?
This was due to a non-backward-compatible change that Massimo implemented a day or so ago. You should be able to substitute your usage of columns with fields. However, the syntax is a bit different. Here is an example. Using columns - no longer supported columns = ['table.field1', 'table.field2'] Using fields - fields = [db.table.field1, db.table.field2] grid = SQLFORM.grid(query, fields=fields) I'm still having some issues when using fields in SQLFORM.smartgrid, but I think it should work fine in SQLFORM.grid. -Jim On 11/11/2011 12:22 PM, JaapP wrote: Hi , could anyone give me an hint on this one please: i've been playing with sqlform.grid and noticed that in web2py Version 1.99.3 (2011-11-11 10:27:54) dev i cannot use the columns option any more (TypeError: grid() got an unexpected keyword argument 'colums') This did work in previous version of web2py. Should i use an other option to select the columns i want to display or just revert back to older version of web2py? Thanks in advance for any help! Jaap
[web2py] Re: columns option removed from sqlform.grid?
Thanks a lot, works perfect! And now i even can set the order in which the columns are displayed; this did not work with 'columns' Bye, Jaap On 11 nov, 19:43, Jim Steil wrote: > This was due to a non-backward-compatible change that Massimo > implemented a day or so ago. You should be able to substitute your > usage of columns with fields. However, the syntax is a bit different. > Here is an example. > > Using columns - no longer supported > > columns = ['table.field1', 'table.field2'] > > Using fields - > > fields = [db.table.field1, db.table.field2] > > grid = SQLFORM.grid(query, fields=fields) > > I'm still having some issues when using fields in SQLFORM.smartgrid, but > I think it should work fine in SQLFORM.grid. > > -Jim > > On 11/11/2011 12:22 PM, JaapP wrote: > > > Hi , > > > could anyone give me an hint on this one please: > > > i've been playing with sqlform.grid and noticed that in web2py Version > > 1.99.3 (2011-11-11 10:27:54) dev i cannot use the columns option any > > more (TypeError: grid() got an unexpected keyword argument 'colums') > > > This did work in previous version of web2py. > > > Should i use an other option to select the columns i want to display > > or just revert back to older version of web2py? > > > Thanks in advance for any help! > > > Jaap > >
[web2py] Re: .hgignore and updating welcome/admin
bump
Re: [web2py] Re: .hgignore and updating welcome/admin
Maybe is differents repo?? One for web2py And One for each app Richard On Fri, Nov 11, 2011 at 2:25 PM, pbreit wrote: > bump
Re: [web2py] Re: new welcome app - need help with css
Congrats!!! I just got in love of the new tempalte! Wow, beautiful!!! When could we test it? On Fri, Nov 11, 2011 at 12:19 PM, Anthony wrote: > On Friday, November 11, 2011 12:27:19 PM UTC-5, Furqan wrote: >> >> Massimo can you tell me how to design a website, do I have to be a >> graphic designer to throw a nice little template? >> > > There are lots of free templates, CSS frameworks, and front-end > boilerplates out there. And if you've got a few dollars, there are some > nice themes here: http://themeforest.net/. > > Also, check out: > http://twitter.github.com/bootstrap/ > http://foundation.zurb.com/ > > Anthony >
Re: [web2py] Re: columns option removed from sqlform.grid?
Glad I could help. On another note, Massimo just updated trunk to resolve the other issues I was having with SQLFORM.smartgrid. -Jim On 11/11/2011 1:02 PM, JaapP wrote: Thanks a lot, works perfect! And now i even can set the order in which the columns are displayed; this did not work with 'columns' Bye, Jaap On 11 nov, 19:43, Jim Steil wrote: This was due to a non-backward-compatible change that Massimo implemented a day or so ago. You should be able to substitute your usage of columns with fields. However, the syntax is a bit different. Here is an example. Using columns - no longer supported columns = ['table.field1', 'table.field2'] Using fields - fields = [db.table.field1, db.table.field2] grid = SQLFORM.grid(query, fields=fields) I'm still having some issues when using fields in SQLFORM.smartgrid, but I think it should work fine in SQLFORM.grid. -Jim On 11/11/2011 12:22 PM, JaapP wrote: Hi , could anyone give me an hint on this one please: i've been playing with sqlform.grid and noticed that in web2py Version 1.99.3 (2011-11-11 10:27:54) dev i cannot use the columns option any more (TypeError: grid() got an unexpected keyword argument 'colums') This did work in previous version of web2py. Should i use an other option to select the columns i want to display or just revert back to older version of web2py? Thanks in advance for any help! Jaap
Re: [web2py] Re: SQLFORM.smartgrid - multiple problems with latest trunk
fixed in trunk. On 11/10/2011 11:55 AM, Jim Steil wrote: Ticket created http://code.google.com/p/web2py/issues/detail?id=508 On 11/10/2011 11:33 AM, Massimo Di Pierro wrote: please repost problems asap about it. I have made some backward incompatible changes to the grid/smartgrid in order to clean up the API and updating the book. the columns argument is gone because it was redundant. we have fields. I have added some params. On Nov 10, 11:16 am, Jim Steil wrote: Hi I've been using SQLFORM.smartgrid for some time now. I updated to the latest trunk this morning and am now having a number of different issues with code unchanged from yesterday. Are there changes pending and I should hold off reporting problems, or should I start going through them? -Jim
[web2py] Unwanted submit on checkbox click ?
I'm building a dynamic table with a checkbox in each row with the code below. The table displays correctly and html looks ok. However when I click on any checkbox, the page is being submitted - not sure why. Any suggestions? for item in imgtags: s = [[item.name , '' %item.name]] chbx = (INPUT( _type='checkbox', _name= 'chk%s' %item.name, _onclick="alert(this.checked)")) arr.append ([[item.name],[ chbx]]) return XML(TABLE(*[TR(*r) for r in arr], _id = 'tagtable')) BrendanC
Re: [web2py] Re: new welcome app - need help with css
On Friday, November 11, 2011 3:31:48 PM UTC-5, Ialejandro wrote: > > Congrats!!! I just got in love of the new tempalte! Wow, beautiful!!! > > When could we test it? > It should be in trunk: http://code.google.com/p/web2py/source/checkout Anthony
[web2py] Re: Mixing/supporting CMS with Web2py
Here's a real world example: I'm on the board of the Asheville Choral Society, http://www.ashevillechoralsociety.org . Like most non-profits, we're short of money and as the only software geek on the board, I end up donating a fair amount of time (that I'd much rather spend rehearsing the music) to routine maintenance of the group's legacy website (PHP, mysql, cpanel ...). There is a CMS of sorts for non-techie users, but it's badly implemented and I frequently have to go underneath it to straighten out a mess that someone has made trying to use it. I'd love to be able to make this site more maintainable by replicating it in web2py on a $10/month RackSpace virtual system. It's not a high traffic site but it does need to be responsive, attractive and useful to our members and concert-goers. For a site like this, the CMS feature that's needed most is to make it dead simple for others to edit text and insert images for upcoming concerts and have it come out in fonts and colors that are consistent throughout the site and without messing up things that should be centralized in the db (e.g. concert dates, ticket prices, soloist bios, etc.) On Nov 4, 1:38 pm, Massimo Di Pierro wrote: > perhaps we should make a list of desired features. >
[web2py] Adding a column to the SQLFORM.grid table - one way to do it
Props to Richard Vezina for posting a similar technique. This is built on his post >From the book we know that, "Components' objects can be referenced via their position, and helpers act as lists with respect to their components." A little archaeology in the source code tells us that SQLFORM.grid emits a DIV object. When there's an index table involved, the DIV has three components: a DIV, a DIV containing a TABLE and another DIV. # first we get the grid grid = SQLFORM.grid(query) # examine the div at the top of the grid div # for index lists, this div is of the class 'console', # so look for 'console' near the start of the div # there is CERTAINLY a better way to detect an index table, but this works if 'console' in str(grid[0])[0:35]: ## grid[1][0][1] is the DIV, TABLE and TBODY ## so we iterate over TRs in the table body for row in grid[1][0][1]: ## TR acts like a list, so we use some Python list fu row.insert(-1, 'foo') return dict(grid=grid) Done. Haven't cleaned up the table head yet, but it should be similar.
[web2py] Re: application installation problem
It should be visible immediately. Unless the name contains charaters not allowed in a url, for example a space. On Nov 11, 11:33 am, petrasadi wrote: > I have dropped my application folder in web2py's application folder, > but when i go to the administrative interface, the framework can not > find it. > Is there a way to make web2py aware of this new application, so I can > see it in the admin interface and be able to run it? > Thank you
[web2py] Re: web2py with SAE Python
Any replay? On Nov 9, 8:49 am, chinakr wrote: > With the hint from SAE Python maintainer, I use __file__ to solve the > path problem. > > $ pwd > ~/src/web2py_sae/3 > $ gvim config.py & > import os > app_root = os.path.dirname(__file__) > $ gvim gluon/main.py & > from config import app_root > version_path = os.path.join(app_root, 'VERSION') > version_info = open(version_path) > > Now the problem is still the 'invalid request' without python error. > How can I find the > log?http://web2py.sinaapp.com/welcome/default/indexhttp://web2py.sinaapp.com/debug > > thx! > > On Nov 8, 10:53 pm, chinakr wrote: > > > > > > > > > My new index.wsgi is as follow: > > > #!/usr/bin/env python > > # -*- coding: utf-8 -*- > > > import sae > > > from gluon.settings import global_settings > > global_settings.web2py_runtime_gae = True > > > import gluon.main > > > app = gluon.main.wsgibase > > application = sae.create_wsgi_app(app) > > #application = app > > > And I also have to disable open function in gluon/main.py: > > > #version_info = open(abspath('VERSION', gluon=True), 'r') > > #version_info = open('../VERSION') > > version_info = 'Version 1.99.2 (2011-09-26 06:55:33) stable' > > #web2py_version = parse_version(version_info.read().strip()) > > web2py_version = parse_version(version_info) > > #version_info.close() > > global_settings.web2py_version = web2py_version > > > Now the error is still 'invalid > > request':http://web2py.sinaapp.com/welcome/default/indexhttp://web2py.sinaapp > > > What should I do know? > > > On Nov 7, 10:30 pm, Massimo Di Pierro > > wrote: > > > > Try this: > > > > import sae > > > import gluon.main > > > from gluon.settings import global_settings > > > global_settings.web2py_runtime_gae = True > > > application = gluon.main.wsgibase > > > > On Nov 7, 1:57 am, chinakr wrote: > > > > > SAE means Sina App Engine, which is a public cloud computing platform > > > > like GAE. It's the most mature and famous public cloud in China, where > > > > people can't access GAE freely. SAE only supports PHP in the last 3 > > > > years. > > > > > Recently, SAE started internal testing with Python support, with code > > > > name SAE Python. > > > > > I would like to deploy web2py on SAE Python. And as GAE, SAE Python > > > > doesn't provide local file I/O, etc. I have to modify a lot of things > > > > manually. > > > > > As lack of experience and time, it seems a hard task for me. So anyone > > > > can help? > > > > >http://3.web2py.sinaapp.com/welcome/default/index > > > > will get 'invalid request' message with following index.wsgi: > > > > > import sae > > > > import gluon.main > > > > > app = gluon.main.wsgibase > > > > application = sae.create_wsgi_app(app) > > > > > I also comment mkdir and open code in main.py. > > > > > SAE Python > > > > documents:http://appstack.sinaapp.com/static/doc/release/testing/index.html
[web2py] Re: Mixing/supporting CMS with Web2py
Massimo I've heard that Bruno is rewriting the web2pyslices.com and plugins will be able to be hosted. Should I host my plugins at the current plugin site, or wait until the new site open? Kenji On 11月12日, 午前1:54, Massimo Di Pierro wrote: > Kenji, > > as you know we are building the new web2py web page. I'd rather link > your plugins than mine. Would you be able to host some of plugins at > > http://web2py.com/plugins > > and provide a service like this: > > http://web2py.com/plugins/default/plugins.json > > I would still act as proxy for the service since it is linked by the > wizard. > > Massimo > > On Nov 11, 8:20 am, kenji4569 wrote: > > > > > > > > > Anthony > > > Thank you for your response. > > > >How far along is that? Does it/will it use this plugin_managed_html? > > > I am now developing several core plugins for the product, and will > > publish them soon. The product itself is currently for domestic, > > though. > > On 11月11日, 午後10:46, Anthony wrote: > > > > This is great. By the way,http://dev.s-cubism.com/mentionsnanahoshi-cms > > > as a web2py based CMS under development. How far along is that? Does > > > it/will it use this plugin_managed_html? > > > > Anthony > > > > On Friday, November 11, 2011 8:23:24 AM UTC-5, kenji4569 wrote: > > > > > I cannot help presenting my developing plugin, which has a concrete5- > > > > like wysiwyg functionality: > > > > >http://dev.s-cubism.com/plugin_managed_html/page1/_managed_html_edit > > > > > (note: use chrome or FF) > > > > > In this page, you can click highlighed blocks and edit their texts, > > > > images, and htmls, and move specified blocks, and also check > > > > corresponding the preview and live page. > > > > > These editable blocks are defined in web2py views using functions and > > > > decorators: > > > > >https://github.com/sqlabs/sqlabs/blob/master/views/plugin_managed_htm... > > > > > Although it's very experimental and plenty remains to be done, the > > > > core logic may be closely related to this discussions. > > > > Give it a try and welcome any feedback. > > > > On 11月11日, 午後6:28, Bruno Rocha wrote: > > > > > This one:http://ourway.ir/pages/blog?u=blouweb > > > > > > IS a very nice facebook clone app! can be extended for a cms. is it > > > > > open > > > > > source?
Re: [web2py] Re: Random Selection Issue
Still trying to solve this any ideas are welcome *cheers
[web2py] Re: GAE Contains() issue?
I went through the code and was planning on proposing a recommendation - I can create the patch for the code if you think it's worthwhile. The behavior I would expect is that if None is provided in the contains() statement, it would just return no results (because GAE won't allow None in lists). I could modify the code in the gluon DAL if this would be acceptable. On Nov 11, 12:07 pm, Massimo Di Pierro wrote: > session.company_id is None in your case and None cannot be contained > in a list of strings. > It has to fail in some place. We could catch the error somewhere else > and have a more meaningful error but you really want something like: > > if session.company_id: > rows = > db(db.Site_Main.companyID.contains(session.company_id)).select(db.Site_Main > .id) > else: > rows = [] > > On Nov 11, 10:20 am, pallav wrote: > > > > > > > > > Hi, > > > I am using version 1.99.2 of web2py and am getting an error when > > trying to run a query with "contains()" in Google App Engine. > > > The Model: > > > > > db.define_table('Site_Main', > > Field('site', 'string', length=13), > > Field('companyID', 'list:integer'), > > Field('active', 'integer'), > > Field('syncToPalm', 'integer'), > > migrate=settings.migrate) > > > The Query: > > > > > rows = > > db(db.Site_Main.companyID.contains(session.company_id)).select(db.Site_Main > > .id) > > > The Error: > > === > > Traceback (most recent call last): > > File "/home/pallav/Desktop/google_appengine/web2py/gluon/ > > restricted.py", line 194, in restricted > > exec ccode in environment > > File "/home/pallav/Desktop/google_appengine/web2py/applications/ > > samapp/controllers/datasync.py:sites", line 119, in > > File "/home/pallav/Desktop/google_appengine/web2py/gluon/ > > globals.py", line 149, in > > self._caller = lambda f: f() > > File "/home/pallav/Desktop/google_appengine/web2py/applications/ > > samapp/controllers/datasync.py:sites", line 42, in sites > > File "/home/pallav/Desktop/google_appengine/web2py/applications/ > > samapp/models/datasync/site_data.py", line 67, in read > > rows = > > db(db.Site_Main.companyID.contains(session.company_id)).select(db.Site_Main > > .id) > > File "/home/pallav/Desktop/google_appengine/web2py/gluon/dal.py", > > line 5697, in select > > return self.db._adapter.select(self.query,fields,attributes) > > File "/home/pallav/Desktop/google_appengine/web2py/gluon/dal.py", > > line 3351, in select > > (items, tablename, fields) = > > self.select_raw(query,fields,attributes) > > File "/home/pallav/Desktop/google_appengine/web2py/gluon/dal.py", > > line 3308, in select_raw > > filters = self.expand(query) > > File "/home/pallav/Desktop/google_appengine/web2py/gluon/dal.py", > > line 3192, in expand > > return expression.op(expression.first) > > TypeError: CONTAINS() takes exactly 3 arguments (2 given) > > > I have tried looking through the book, and the forums, and searched on > > Google but found no references to this specific error. Is something > > broken in the DAL related to GAE in the latest web2py? I am > > downloading Eclipse to see if I can just debug the DAL myself but any > > help is appreciated. > > > Thanks > > Pallav
[web2py] Re: Python 2.7 on GAE (experimental)
That was a very informative response, thank you. I think I will have time in the first weeks of December to try to change the DAL. Will try to get Massimo's feedback on this too.
[web2py] Web2Py application internationalization
Hello guys, Need your help. I want to put language selection dropdown in my application. (exactly like we get on web2py admin interface). Can any one help me please? Thanks & Regards Shiv
[web2py] Re: Web2Py application internationalization
Admin does {{for language in T.get_possible_languages():}} {{=language}} {{pass}} and in a model if 'adminLanguage' in request.cookies and not (request.cookies['adminLanguage'] is None): T.force(request.cookies['adminLanguage'].value) This code should work for any app. On Nov 11, 9:04 pm, Shiv wrote: > Hello guys, > > Need your help. > I want to put language selection dropdown in my application. (exactly > like we get on web2py admin interface). > > Can any one help me please? > > Thanks & Regards > Shiv
[web2py] Re: Adding a column to the SQLFORM.grid table - one way to do it
Also, using the .element() and .elements() methods provides some powerful options for searching the DOM -- see http://web2py.com/book/default/chapter/05#Server-side-DOM-and-Parsing. Anthony On Friday, November 11, 2011 5:37:52 PM UTC-5, Cliff wrote: > > Props to Richard Vezina for posting a similar technique. This is > built on his post > > From the book we know that, "Components' objects can be referenced via > their position, and helpers act as lists with respect to their > components." > > A little archaeology in the source code tells us that SQLFORM.grid > emits a DIV object. When there's an index table involved, the DIV has > three components: a DIV, a DIV containing a TABLE and another DIV. > > # first we get the grid > grid = SQLFORM.grid(query) > > # examine the div at the top of the grid div > # for index lists, this div is of the class 'console', > # so look for 'console' near the start of the div > # there is CERTAINLY a better way to detect an index table, but > this works > if 'console' in str(grid[0])[0:35]: > ## grid[1][0][1] is the DIV, TABLE and TBODY > ## so we iterate over TRs in the table body > for row in grid[1][0][1]: > ## TR acts like a list, so we use some Python list fu > row.insert(-1, 'foo') > return dict(grid=grid) > > Done. Haven't cleaned up the table head yet, but it should be > similar. >
Re: [web2py] Re: Mixing/supporting CMS with Web2py
> > I've heard that Bruno is rewriting the web2pyslices.com and plugins > will be able to be hosted. Should I host my plugins at the current > plugin site, or wait until the new site open? > Hi, the new web2pyslices is 90% just few adjustments, but, I am working on another projects now and it will take a bit more time. I think you should host the plugins at your site and if you can provide a .json for accessing the plugins information it will be included from your index to web2pyslices in future. -- Bruno Rocha [http://rochacbruno.com.br]
[web2py] image upload problem
I'm trying to upload an image from an iPhone app by posting it to a form and processing it with the following code: def index(): form = SQLFORM.factory( Field('title'), Field('price'), Field('image', 'upload', uploadfolder=request.folder+'static/uploads')) if form.accepts(request.vars): image = db.item.image.store(request.vars.image.file, request.vars.image.filename) db.item.insert(title=form.vars.title, price.form.vars.price, image=image) return 'ok' elif form.errors: return 'error' return 'start' The image actually gets saved properly at: no_table.image.9ca57d942db5deac.613039626131302e6a7067.jpg However another corrupted 0 kb file is saved at: item.image.b7e6bb3fedeadf9e.613039626131302e6a7067.jpg And this is the filename that goes into the db. Any ideas?
Re: [web2py] Re: Web2Py application internationalization
It worked. Thanks a lot. On Sat, Nov 12, 2011 at 9:06 AM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > Admin does > > >{{for language in T.get_possible_languages():}} > 'selected' or ''}} >{{=language}} >{{pass}} > > > and in a model > > if 'adminLanguage' in request.cookies and not > (request.cookies['adminLanguage'] is None): >T.force(request.cookies['adminLanguage'].value) > > This code should work for any app. > > > On Nov 11, 9:04 pm, Shiv wrote: > > Hello guys, > > > > Need your help. > > I want to put language selection dropdown in my application. (exactly > > like we get on web2py admin interface). > > > > Can any one help me please? > > > > Thanks & Regards > > Shiv > -- Thanks & Regards Shiv
[web2py] Re: image upload problem
Figured it out. Don't need the "store" line. if form.accepts(request.vars): db.item.insert(title=form.vars.title, price.form.vars.price, image=form.vars.image)
[web2py] ImportError with AppEngine SDK v1.6.0
Hi! I've recently updated my GAE SDK to v1.6.0 and I'm getting this error on every subsequent call to the server (It works the first time though): Traceback (most recent call last): > File "E:\Programming\Python\rappiden\gluon\restricted.py", line 194, in > restricted > exec ccode in environment > File > "E:\Programming\Python\rappiden\applications\init\controllers/default.py:index", > line 7, in > ImportError: No module named commons I do have a file named commons.py in my modules directory, the app runs fine for the first call & it worked fine before the update. Can someone help me out? With Regards, Sathvik -- Sathvik Ponangi
[web2py] Re: contains() subtleties on GAE
give belongs() a tryi can remember that contains and belongs with GAE and list:references have been troublesome for me (but i'm not convinced that it is broken, just not quite as expected) cfh
[web2py] Re: web2py with SAE Python
i can't read Chinese, so i can't read the docs. :( but i would suggest that you read the docs to find out what happens when there are uncaught exceptions and where python logging statements are output in your environment. then if you can post the traceback we'll be more equipped to help you out. thanks, cfh
[web2py] Re: Python 2.7 on GAE (experimental)
i will continue to keep an eye on this as well. i work with a few clients for which this would be helpful and i'm currently lobbying to get some research time to work on this problem...
Re: [web2py] Re: Id been Shown Instead of Name in dropdown list
Thanks for Your reply but its not working . still I am getting id instead of Vehicle name. Regards, Naleen Yadav www.genpro.co.in On Fri, Nov 11, 2011 at 10:12 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > From Burno'e example > > db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.id') > > is optiona and automatic. If you add it it overrides the format so you > want to do > > db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, > 'tblVehicle.id',format=lambda row: "%s" % > row.**VehicleName_id.VehicleName) > > On Nov 11, 12:17 am, Bruno Rocha wrote: > > *or you can try:* > > > > db.define_table("tblVehicle", > > Field("*VehicleName_id*",db.tblVehicleName,label='Vehicle Name'), > > Field("VehicleNo", default=None,label='VehicleNo'), > > format=*lambda row: "%s" % row.**VehicleName_id.VehicleName* ) > > db.tblVehicle.VehicleName.requires=IS_IN_DB(db,'tblVehicleName.id','%( > > VehicleName)s') > > > > * # Creating tblDriver adding Driver name and selecting the name of > vehicle > > from the dropdown* > > > > db.define_table("tblDriver", > > Field("DriverName",'string',label='Driver Name'), > > Field('id_tblVehicle', db.tblVehicle,label='Vehicle Name')) > > db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.id') > > > > By thw way you have problem with the name you give to the fields, try to > > name references with *tablename_id* to avoid confusion. > > > > -- > > > > Bruno Rocha > > [http://rochacbruno.com.br] >
Re: [web2py] Re: Id been Shown Instead of Name in dropdown list
This is the final model after following given suggesstion by you all # Table Vehicle name master db.define_table("tblVehicleName", Field("VehicleName", length=45, notnull=True, default=None,unique=True,label='Vehicle Name'), format='%(VehicleName)s' ) # Table Vehicle db.define_table("tblVehicle", Field("VehicleName_id",db.tblVehicleName,label='Vehicle Name'), Field("VehicleNo", default=None,label='VehicleNo'), format=lambda row: "%s" % row.VehicleName_id.VehicleName ) db.tblVehicle.VehicleName_id.requires=IS_IN_DB(db,'tblVehicleName.id','%(VehicleName)s') # Table Driver db.define_table("tblDriver", Field("DriverName",'string',label='Driver Name'), Field('id_tblVehicle', db.tblVehicle,label='Vehicle Name')) db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.id') db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db,'tblVehicle.id'), format=lambda row: "%s" %row.VehicleName_id.VehicleName what actually i was looking for to get vehicle name in the dropdown list while adding driver , but i was getting id but now i am not getting any id ,no dropdown instead there is textfield after writting the above given model. any Suggestions Regards, Naleen Yadav www.genpro.co.in On Sat, Nov 12, 2011 at 11:16 AM, Naleen Yadav wrote: > Thanks for Your reply > but its not working . still I am getting id instead of Vehicle name. > > Regards, > Naleen Yadav > www.genpro.co.in > > > On Fri, Nov 11, 2011 at 10:12 PM, Massimo Di Pierro < > massimo.dipie...@gmail.com> wrote: > >> From Burno'e example >> >> db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.id') >> >> is optiona and automatic. If you add it it overrides the format so you >> want to do >> >> db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, >> 'tblVehicle.id',format=lambda row: "%s" % >> row.**VehicleName_id.VehicleName) >> >> On Nov 11, 12:17 am, Bruno Rocha wrote: >> > *or you can try:* >> > >> > db.define_table("tblVehicle", >> > Field("*VehicleName_id*",db.tblVehicleName,label='Vehicle Name'), >> > Field("VehicleNo", default=None,label='VehicleNo'), >> > format=*lambda row: "%s" % row.**VehicleName_id.VehicleName* ) >> > db.tblVehicle.VehicleName.requires=IS_IN_DB(db,'tblVehicleName.id','%( >> > VehicleName)s') >> > >> > * # Creating tblDriver adding Driver name and selecting the name of >> vehicle >> > from the dropdown* >> > >> > db.define_table("tblDriver", >> > Field("DriverName",'string',label='Driver Name'), >> > Field('id_tblVehicle', db.tblVehicle,label='Vehicle Name')) >> > db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.id') >> > >> > By thw way you have problem with the name you give to the fields, try to >> > name references with *tablename_id* to avoid confusion. >> > >> > -- >> > >> > Bruno Rocha >> > [http://rochacbruno.com.br] >> > >