[web2py] Re: Monitoring memory usage leaks
There is an option -F filename while starting web2py. Is there any documentation (or pointers) about how to use it? Thank you, Joseph http://www.jjude.biz
[web2py] Monitoring memory usage leaks
What tools / code snippets are you using to monitor memory leaks?
Re: [web2py] High memory usage in webfaction
oh my god. The memory usage dropped from 71 mb from 120 mb. webfaction should use this as their default for installing web2py. I can't thank you enough. Just one more question: 1. I'm assuming there is no need to restart uwsgi; it automatically does I suppose? Thank you, Joseph
[web2py] Re: High memory usage in webfaction
sorry it is midnight here and i am too relieved that it is solved and too excited that now i can get back to 'real' development. dropped to 71 mb from 120 mb
[web2py] Re: Nobs questions about install web2py on webfaction and others...
use uwsgi. Ref: https://groups.google.com/d/msg/web2py/LOdYk1C7B0I/JiMA_HzNqBQJ
Re: [web2py] Re: High memory usage in webfaction
can I rotate log (uwsgi.log) with this command? I don't want the log file to go on increasing in size
[web2py] High memory usage in webfaction
Dear All, I was expecting when I am going to get this message from webfaction team and I got it today. I have searched through this group and found that I could use uwsgi server. Before I go ahead and make changes on the site, I got few questions: 1. Currently it is running on apache. How do I make the switch to uwsgi and disable apache? 2. In the error message that webfaction sent, there are processes that running for 23 days (and there are many) and that adds to the memory. How do I know what are the unnecessary processes and kill them? 3. There is a expire_sessions.py in admin app. Does that help and if so, how? Thank you, Joseph http://www.jjude.biz
[web2py] Re: contains return no rows of field list:string
Thank you Denes. I understood and this works fine at shell. At web-application, I use the below code, form = crud.create(db.entries, next = URL('index')) This gets me a simple text field for the 'list:string' field and whatever I enter gets in as, 'one,two,three' I tried to enter ['one','two','three'] and it gets in as a single string. so I'm still on zero. Can someone tell me how to handle (ie. whatever is entered gets in as individual strings and not as a single string) from the web-app. One option I can think of is to create a pain the form with individual fields and then process the form submission. But I hope I could handle this with crud, since it is so easy. Thank you, Joseph
[web2py] Re: contains return no rows of field list:string
Thank you. It works. Just for completeness: I had designed a layout from scratch and hence had left out web2py_ajax.html. For this widget to work, it is essential that this file is included. Regards, Joseph
[web2py] contains return no rows of field list:string
I have the below table definition db.define_table('entries', Field('tags', 'list:string',required=True)) and then inserted values. Now I am trying to select using the below entries = db(db.entries.tags.contains('learning')).select() It returns no values (though there are rows in db). db: sqlite; web2py: 1.99.4 Thank you, Joseph
Re: [web2py] contains return no rows of field list:string
Thanks Bruno. I deleted the db and recreated (its only in db). The error still persists. print type(entry.tags) returns list and the field values are |learning|other|other| I can see that in the field too. Would you mind sharing your rest code? I think I'm missing something 'small' Regards, Joseph
Re: [web2py] contains return no rows of field list:string
I went into shell in a new web2py directory and tried the below. Surprisingly, I get empty output. Any explanations? python web2py.py -S init -M db.define_table('entries', Field('title', type='string'), Field('tags', 'list:string')) db.entries.insert(title='hello',tags='one,two,three') 1 t=db(db.entries.tags.contains('one')).select() t.as_list() []
[web2py] Re: Is it me or what?
You may want to change the metadata author. Site looks good. BTW, what plan of GAE are you on?
Re: [web2py] How do you manage your app repo with Mercurial
I use the below: is_local = request.client in ['127.0.0.1', 'localhost'] if is_local: from local_settings import * else: from prod_settings import * I got local_settings.py prod_settings.py. Through hgignore, I ignore prod_settings.py so it doesn't go to my public repo. P.S: since I run the site on webfaction where request.is_local returns true so I had to use the first line shortcut. Joseph http://www.jjude.biz
[web2py] Re: dropbox python api
If anyone is interested, you can look into the code for dropbox connection here: http://goo.gl/QYT2y This is my default.py. Look at dropbox_connect and process_dropbox. Question: How can I automate this with cron? When I do it, it stops with the redirect. Thank you, Joseph
Re: [web2py] Re: Logging in web2py
I'm using this logging module with logging.conf. It works fine in controllers models. How to make it work in modules? Regards, Joseph
[web2py] Re: dropbox python api
Paul, What kind of error are you getting? I'm also starting to play with dropbox. Got two functions in default controller (one is a callback function) but it works. BTW, I'm storing the dropbox session as current.session.dsession Joseph http://www.jjude.biz
[web2py] Re: dropbox python api
To use this do you need APIs both from dropbox janrain? Thank you, Joseph
[web2py] Re: Optimizing web2py app for GAE
Let us say I have the below code in db.py under models define_table(db, ) If I change that to, if settings.migrate: define_table(db,...) rest of the queries based on this table doesn't work. I want to skip the definition altogether if the table is already present. Reason: I assume that GAE makes a datastore call for each of these define_table. So every page request initiates these define_table adding to the cost of datastore read limits posed in GAE. Is this how it happens? Can I skip definition of tables altogether? (I believe django doesn't invoke definition of tables for every request) Objective is to optimize application on GAE. Thank you, Joseph
[web2py] Optimizing web2py app for GAE
Hi all, As much as I'm happy to reach the front page of hacker news with minnaedu.appspot.com, it threw me out of the free limits of GAE. What surprised me was that when the number of visitors to the page was just 500 there are just 2 posts (basically this was a blog engine), I already reached .05 million datastore read limit. My models are already in modules and am using cache. What other optimizations would you recommend? (I understand that I can reach only so far with the free limits; but my surprise is that with 500 hits it reached .05 million datastore reads). Code is here: https://bitbucket.org/id804097/minnaedu/src/ad58ea9a5a20/webapp/applications/init Any suggestions are welcome. Thank you, Joseph
[web2py] Re: Web2Py on GAE very slow
Christian, Did you manage to write this? I am looking for optimizing the GAE. Would appreciate your inputs. Thanks, Joseph
[web2py] Re: (Another) Blog Engine in web2py
Power of web2py is in running the same code base both in GAE webfaction. Here is the blog engine (with imported wordpress entries) in webfaction: http://www.jjude.biz I wrote about it here: http://goo.gl/zidxe Let 2012 be a great year. Joseph
[web2py] Re: Is this possible?
Your code base should be adjusted. Both Anthony Jonathan helped me with similar problem for me. Here is my routes.py: https://bitbucket.org/id804097/minnaedu/src/570149716878/webapp/routes.py here is my controller/index: https://bitbucket.org/id804097/minnaedu/src/570149716878/webapp/applications/init/controllers/default.py here is the final application: minnaedu.appspot.com Hope these help Joseph
[web2py] Re: Instant press 2.1.0 holiday edition (?)
Looks nice Martin. Isn't routes.py needed to run this? Joseph
Re: [web2py] Routes help for wordpress style urls
Hopefully last question on this thread. routers = dict( init= dict(functions = ['index', 'user', 'contact', 'sitemap', 'feed', 'error']), ) above works for admin, appadmin for other entries too Not sure the below is a problem with routes or not. I have a feed() function. If I browse to feed.rss it works fine. But I would like /feed/ as the url (without.rss). How to achieve it? Thanks again guys, Joseph
[web2py] (Another) Blog Engine in web2py
All, Thanks to many forum members esp Anthony Jonathan, I was able to finish the blog engine that I have been developing to learn more about web2py. The code is in https://bitbucket.org/id804097/minnaedu/src. The blog is at: http://minnaedu.appspot.com/. This week, I will be migrating my wordpress blog into this new blog engine. So far I have not yet enabled cache. But I will learn and do so. I learnt quite a lot during this development (non-functional learnings : web2py is easy; web2py forum is helpful; but web2py resources are limited to this forum web2py book) Have a look at the code and if there are any areas for improvement, pl let me know (I haven't yet put in a license but it will be a permissible one) Happy Christmas everyone. Regards, Joseph
Re: [web2py] Routes help for wordpress style urls
routers = dict( BASE = dict(default_application = 'init', default_controller = 'default', default_function = 'index', functions = ['index'], ), ) With the above routes, admin doesn't work. i.e: localhost:8080/admin/index throws a password pg but after that the control goes to /admin/site and it throws an error 'This webpage has a redirect loop'. How to resolve this? Thx, Joseph
[web2py] Routes help for wordpress style urls
Hi, I am almost complete on a blog engine for myself and have also written import from wordpress. I'm not stuck at mapping the urls. In wordpress I've been using domain//mm/slug as url for posts and domain/page for pages. How do I translate that in web2py? Can this be achieved via parameter based routes or should it be only by pattern-based? Thank you, Joseph
Re: [web2py] Routes help for wordpress style urls
I used this the below in routes.in (r'^(?Pyear\d{4})/(?Pmonth\d{2})/(?Pslug\w+)/$', '/init/default/index/\gyear/\gmonth/\gslug'), but when I go to a url localhost:/2011/11/a-slug it returns invalid request error then I tried routers = dict( BASE = dict(default_application = 'init', default_controller = 'default', default_function = 'index', ), ) which gives me the error: invalid function (default/2011) fair enough. I could traverse /index/2011 But can I drop index too from the url? Thx, Joseph
Re: [web2py] Routes help for wordpress style urls
yes anthony
Re: [web2py] Routes help for wordpress style urls
Thx Jonathan Anthony. Following works: routers = dict( BASE = dict(default_application = 'init', default_controller = 'default', default_function = 'index', functions = ['index'], ), ) Regards, Joseph
[web2py] do import module work in gae?
Module import work in standalong web2py but not in gae. Version: 1.99.2 (2011-09-26 06:55:33). Help appreciated. Thanks, Joseph
[web2py] Re: do import module work in gae?
I upgraded to 1.99.4 and it works :-) But there is another issue. from gluon.contrib.markdown import markdown2 as markdown in gae it throws error no module named markdown :-(
[web2py] Having multiple layouts (themes) and choosing from one
What are the ways in which such multiple layouts and choosing one at the run time work? Something like wordpress themes? Modifying views/layout fix the layout to the one that was deployed. But as in wordpress, if more themes are installed how can a different one be chosen? Thank you, Joseph
[web2py] Re: list:reference validation
There should be an option in google groups to like a reply which brings a bit of smile :-)
[web2py] Re: web2py 1.99.3 is OUT
Congrats to everyone. If people are still using 1.99.2 (or older version), is there a place of reference for those versions? At last the n - 1 (n = latest version)? BTW, I like to new layout Rgds, Joseph
[web2py] Question on compute field
Hi all, I am just starting to use compute field. Here is my db definition looks like (it is in a module) class Entries(object): . def define_tables(self,db): Field('permalink',type='text',required=True,compute = lambda row: self.get_permalink(row)), . def get_permalink(self,row): permalink = '/test/' return permalink This throws the error: SyntaxError: Table: missing required field: permalink What am I doing wrong here? Thank you, Joseph
Re: [web2py] Re: Massimo
Am not sure where Yarko is now-a-days, but he used to provide replies in a manner that not only provided answers you were looking for but made you rethink the problem itself. I have his replies stored. Anthony is active both here and in stackoverflow. I can't even keep up here. And one time, Massimo replied for one of the queries, I don't want to beat django, I want to beat IBM consulting. Man...thats vision. I hope this community not only brings out a fantastic framework but practical business model too. Regards, Joseph
[web2py] Re: Requesting Feedback for Web2py Instant Admin
is there any progress in including it in admin? I couldn't download the compiled plugin but downloaded and from the excellent docs, was able to include into my app. But making it part of admin will be great. Joseph
[web2py] Re: configuration of mail in appengine
Below works for me: steps I followed. Your context may differ and customize accordingly. 1) define a db model with the fields you want; I wanted all emails to be stored too, so I defined this model 2) define two functions - a contact fn that gets called from template; the contact fn itself calls another fn to send email; in the template you can validate the fields like valid email id etc. 3) This is for sending emails from admin email; customization is needed if otherwise Here is the code: def contact(): form = crud.create(db.contact_emails, onaccept=_send_email, next = URL('index'), message=T(Thank you for your message)) return dict(form=form) def _send_email(form): #called from successful accept of contact form #form is sent as a first argument mail=Mail() mail.settings.server='gae' mail.settings.sender=x...@gmail.com #This must be the email address of a registered #administrator for the application mail.settings.login = None mail.send(to='xx...@gmail.com', subject='[123-Check] Contact', message=form.vars.body) return
[web2py] Re: configuration of mail in appengine
You can see it working at: 123-check.appspot.com/init/default/contact
[web2py] Re: Unable to write to file error in GAE
Massimo, Since it is on GAE, I don't have the full traceback (if there is another way to get the traceback, pl let me know). I got only the below two types of errors: routes_out: [/init/default/index] not rewritten Unable to write to file /base/data/home/apps/s~123-check/1.354481446592778594/applications/init/languages/fr-fr.py Both of these are repeated many times. Thanks again, Joseph
[web2py] Re: new web site
Just a personal opinion: web2py should come out of the shadows of django. Two of the three quotes are directed towards django.
[web2py] Unable to write to file error in GAE
Hi, I get the below error in GAE. Unable to write to file /base/data/home/apps/s~123-check/1.354481446592778594/applications/init/languages/pl-pl.py In fact it is repeated for other languages too. Please note that I'm not using any translations (my guess is some of the gluon tools may be using these files). How to resolve this? Thank you, Joseph
Re: [web2py] What I do with web2py.
Amazing. by the same token, is there any site which collects all the sites developed in web2py? I couldn't find any. Not the appliances but the real sites built with web2py. That might be a good booster for new comers into web2py to be convinced that web2py is not just for learning but for real work too.
[web2py] Learning to test
All, I have been looking into automated testing of web2py. I have looked at the below pages: http://web2py.com/AlterEgo/default/show/260 http://packages.python.org/web2py_utils/test_runner.html http://www.web2pyslices.com/slices/take_slice/67 http://ncdegroot.blogspot.com/2011/09/web2py-automate-unittesting-doctesting.html However, is there any open source project with test modules that I can look into how the testing is done in real projects and learn? Thank you, Joseph
[web2py] Re: Ideas for new welcome app
choosing a license type as liberal as web2py would be preferred. as far as I could read and understand, foundation is not that liberal.
Re: [web2py] Re: criticism of web2py
As much as I like backward compatibility, I believe the (web2py) code will become unmanageable and bloated too. So at some point in time, it is better to overhaul and not provide backward compatibility.
[web2py] Re: Schema Changes in GAE
I was able to successfully added a field, filled with content and also renamed a field (add a filed, copy and then delete). If it would be of some use for others, here is how I did: Ref the below stackflow thread. Alex offers a simple solution. http://stackoverflow.com/questions/2906746/updating-model-schema-in-google-app-engine You write this code in migrate.py Then in app.yaml have a url like below: - url: /admin/migrate script: migrate.py You can choose the url (I choose /admin). Then launch the app call this url. Voila GAE DB modified. My modified app now lives on http://123-check.appspot.com/ Regards, Joseph
[web2py] Schema Changes in GAE
Hello All, As much as I wanted to avoid, eventually I had to add two columns and rename a column to an existing table in GAE which contain data. Is there a way (after much search, I'm not even asking for an easy way) to do that? Thanks, Joseph
[web2py] Re: Schema Changes in GAE
Thank you for your reply. Is there a way to run gae specific code (with gae objects) within web2py? or should this be executed only within gae environment (may be I need to modify app.yaml too then?) Thank you in advance, Joseph
Re: [web2py] Re: Announcing another web2py-gae application
Thank you for trying out. I've noted down all of your suggestions. Will implement in the days to come. I am not planning to open source the app though I will post my experience in developing with code. Thanks again, Joseph On 10/4/11, guruyaya guruy...@gmail.com wrote: Nice. The list does not give you the name of it's creator You should enable editing Allow other users to suggest more options Instead of 3 lines, and a plus, create one, and onfocus, automaticly create another line. This will create a better flow. Are you planning to open source this app? On Oct 3, 3:10 am, Joseph Jude ceph...@gmail.com wrote: Thanks to forum members (Anthony Cliff), I was able to develop an application which I hope to serve as a repository of checklists. It is hosted athttp://123-check.appspot.com/. This is just a first version and I'm still learning. Your comments / suggestions are appreciated. Joseph Judehttp://www.jjude.com -- Joseph ceph...@jjude.com | +919899150573
[web2py] Announcing another web2py-gae application
Thanks to forum members (Anthony Cliff), I was able to develop an application which I hope to serve as a repository of checklists. It is hosted at http://123-check.appspot.com/. This is just a first version and I'm still learning. Your comments / suggestions are appreciated. Joseph Jude http://www.jjude.com
[web2py] Handling errors in dynamic forms
Hi all, With help of members of this group, I was able to produce a dynamic form where text fields can be added / removed at the client side. However, I got one (hopefully the last) problem. This form contains two sets of fields - in the first set, there is only name which is mandatory; in the second set, at first 3 fields are shown, but users can add / remove as they like. The issue happens when a user adds two more text field (in the 2nd set) and then submits a form with empty name. The form.errors kick in and then the original form is displayed again (loosing all data data in the dynamically added fields). How do I handle this? Thanks in advance, Joseph
[web2py] Re: Empty HTML input array issue
Thanks Anthony for the reply. 1) With your answer, I understand why the ['',''] is displayed. But is there a way to change it? 2) [] is appended since I wanted an array. But in the mean-while I experimented without [] and just having 'items' as the variable name for all the three fields and got the same behavior (your explanation tells me why). 3) I want the user to add as many fields as needed. Think of list of to-do items for a single topic. 4) the db model is not a list:string. it is a regular table: db.define_table('checklist_items', Field('checklist_id', db.checklists), Field('item_name') ) 5) there is only one field in the form which is mandatory; others (about 5 other fields) are not. so I can't use keepvalues=false Hope to hear. Thanks again, Joseph
[web2py] Adding hidden field to a form
Hi, I define the below form in controller but the hidden field is not present in the view. Note that, field 'totalitems' is not in the db. Let me know how to add hidden fields to FORM. form = FORM( DIV( LABEL(Checklist Items:), UL( SPAN(INPUT(_type=text, _name=citems), IMG(_class=add, _src=URL('static', 'images/add.png')), IMG(_class=remove,_src=URL('static', 'images/delete.png'))), ), hidden=dict(totalitems='1') )) Thank you, Joseph
[web2py] Empty HTML input array issue
Hi all, I have the below form (leaving out non-essential code) form = FORM( DIV( UL( SPAN(LABEL('Name:')), SPAN(INPUT(_type=text, _name=name, requires=IS_NOT_EMPTY(, DIV( LABEL(Items:), UL( SPAN(INPUT(_type=text, _name=items[])), SPAN(INPUT(_type=text, _name=items[])), SPAN(INPUT(_type=text, _name=items[])) )) DIV( INPUT(_type=submit, _value=Create My List), _class=submitbtn button) )) if form.accepts(request.vars, session): rest of code If this form is submitted with values the form values are written into the databases. No problem. However, if it is submitted with an empty first field (name), the the fields _name=items[] are filled with values ['', ''] when errors are flashed on the screen. I am not able to find why it happens and also how to fix it. (there is a reason why I use the _name=items[] - user should be able to add as many items as possible at the client side). Any clues and solution is appreciated. Thank you. Joseph
[web2py] 'file not accessible' error in gae under mac
Hi, When I deploy the freshly downloaded web2py src under GAE I get the below error: IOError: [Errno 13] file not accessible: '//VERSION' I do have python 2.7 3 installed. But under the GAE Launcher, python path is set to /usr/bin/python where python2.5 is installed. Also I'm able to browse the GAE admin console, so I'm assuming python version is not a problem. GAE SDK: 1.5.2 (am using google launcher) web2py version: 1.98.2 Mac 10.5.8 I deleted the w2ps in the main folders too. Otherwise just changed just the 'application' entry in app.yaml. Your help to resolve is appreciated. Thank you, Joseph
[web2py] Re: 'file not accessible' error in gae under mac
Thanks Massimo. But when I execute python /usr/local/bin/dev_appserver.py appname I get the homepage. This error is only with appengine launcher. Also as I said, I am able to browse the SDK console dashboard. So I don't think it is with the python version. Anyway, for now I will proceed with the commandline. If someone can help, it will be good. Thank you, Joseph On Aug 28, 6:55 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: GAE requires 2.5. GAE has experimental support for 2.7 but we have not tested that yet. On Aug 28, 7:39 am, Joseph Jude ceph...@gmail.com wrote: Hi, When I deploy the freshly downloaded web2py src under GAE I get the below error: IOError: [Errno 13] file not accessible: '//VERSION' I do have python 2.7 3 installed. But under the GAE Launcher, python path is set to /usr/bin/python where python2.5 is installed. Also I'm able to browse the GAE admin console, so I'm assuming python version is not a problem. GAE SDK: 1.5.2 (am using google launcher) web2py version: 1.98.2 Mac 10.5.8 I deleted the w2ps in the main folders too. Otherwise just changed just the 'application' entry in app.yaml. Your help to resolve is appreciated. Thank you, Joseph
[web2py:32538] Will web2py be a dream stack?
I thought of sharing this article: http://blogs.forrester.com/appdev/2009/10/my-dream-stack-for-developing-web-applications.html Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:32564] Error in GAE
Hi, When I execute the below code in GAE it throws an error: unsupported operand type(s) for %: 'NoneType' and 'dict'. However this works ok in a non-GAE environment. Any tips? print db(db.paid_by.paid_by.lower()=='cash').select(db.paid_by.ALL)[0] ['id'] Basically what I have is the description and I want to get the corresponding id stored in the database. Thank you in advance, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:32594] Re: Error in GAE
it does. I did the below it worked in gae def index(): sm=HELO print sm.lower() return It should be something else. Also is there any other way achieve this: having a description (the user can input in upper or lower) finding out the id? Thx, Joseph On Oct 9, 10:33 pm, mdipierro mdipie...@cs.depaul.edu wrote: GAE does not support .lower() sorry On Oct 9, 12:31 pm, Joseph Jude ceph...@gmail.com wrote: Hi, When I execute the below code in GAE it throws an error: unsupported operand type(s) for %: 'NoneType' and 'dict'. However this works ok in a non-GAE environment. Any tips? print db(db.paid_by.paid_by.lower()=='cash').select(db.paid_by.ALL)[0] ['id'] Basically what I have is the description and I want to get the corresponding id stored in the database. Thank you in advance, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:/] Re: Adding a user name to user registration
2) in login, the password is sent in plain text. how to rectify You can use https to protect your password... http is not enough to do so... I'm going to deploy in GAE, so I don't think https is an option. In the out-of-the-box web2py passwords are not visible. I would like to adopt the same but with user name rather than email. Is it possible? BTW: I am able to get a web2py app pretty quickly; but this auth customization is what I'm struggling with. Is there any link where it is explained in detail (like what steps to take)? I've got the web2py book slides too. Thx, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:32235] Adding a user name to user registration
Hi, I want to customize the auth functionality to add a user id(or name). This is what I've done so far. DB: from gluon.tools import Auth auth=Auth(globals(),db) auth.settings.table_user=db.define_table( auth.settings.table_user_name, Field('user_name',length=128,default='',requires=[IS_NOT_IN_DB (db,'%s.user_name'%auth.settings.table_user_name)]), Field('first_name', length=128, default=''), Field('last_name',length=128, default=''), Field('email',length=128,default='',requires=[IS_EMAIL(), IS_NOT_IN_DB (db,'%s.email'%auth.settings.table_user_name)]), Field('password', 'password', readable=False, label='Password', requires=CRYPT()), Field('registration_key', length=128, writable=False, readable=False,default='')) ##create all necessary tables auth.define_tables() CONTROLLER: def register(): return dict(form=auth.register(next='index')) def login(): return dict(form=auth.login(next='index')) VIEWS: register.html {{extend 'layout.html'}} form table tr tdUser Name:/td tdinput name=user_name type=text value={{=form.latest.user_name}}//td /tr tr tdPassword:/td tdinput type=password value= name=password class=password/ /td /tr tr tdVerify Password:/td tdinput type=password name=password_two//td /tr tr tdinput type=submit value=Submit //td /tr /table {{=form.hidden_fields()}} /form login.html {{extend 'layout.html'}} form table tr tdUser Name:/td tdinput name=user_name type=text value=//td /tr tr tdPassword:/td tdinput type=password value= name=password class=password/ /td /tr tr tdinput type=submit value=Submit //td /tr /table {{=form.hidden_fields()}} /form Here are the issues that I'm facing: 1) error messages for uniqueness of user name email are not shown to front end; is there any other js that I need to include? 2) in login, the password is sent in plain text. how to rectify 3) should the users so registered be inserted into any groups (as part of auth framework)? If so, do I do this in the register controller function? Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:20006] Question on request.vars
Hi all, I have a function as below. This is called as part of API function rather than from the browser. def assign(): print request.vars.fields if request.vars.fields: case_values=json.loads(request.vars.fields) ret_dict=api.assign_case(db,case_values) else: ret_dict={'id': 1, 'msg': 'No parameters received'} return json.dumps(ret_dict) When I invoke this via, curl -u u...@example.com:web2py http://localhost:8000/init/api/assign/ -d fields='{id:16,assign_to:age...@example.com}' I do get request.vars.fields properly and the function executes as desired. However when I try the same via a python script like the below: data = { 'fields': {'case_id': 16, 'assign_to': 'age...@example.com'} } data = urllib.urlencode(data) response = urllib2.urlopen(request,data).read() There is no input parameter (fields). When I examine the request.vars.fields, it shows like the below: Storage {'\r\nfields': {'case_id': 16, 'assign_to': 'age...@example.com'%} There are \r\n at the begining and % at the end. Is there a reason for this? How can I test my function using python script (ie achieve the same result as curl). Hope my question is not too confusing. Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:20028] Re: Question on request.vars
Massimo, Thanks for the reply. But it didn't work. I've this simple assign function: def assign(): print request.vars and it prints this. Note the \r\n as first characters. This is what is causing the problem Storage {'\r\nfields': {'case_id': 16, 'assign_to': 'age...@example.com} Just for the ref, I'm using the below python script for sending parameters. data = {'fields': {'case_id': 16, 'assign_to': 'age...@example.com'}} data = urllib.urlencode(data) response = urllib2.urlopen(request,data).read() Hope you can help me out. Thanks, Joseph On Apr 19, 8:10 pm, mdipierro mdipie...@cs.depaul.edu wrote: The assign function expects the request.vars.fields to be in JSON. This should do it but I have not tried it. data = {'fields': simplejson.dumps({'case_id': 16, 'assign_to': 'age...@example.com'})} data = urllib.urlencode(data) response = urllib2.urlopen(request,data).read() Massimo On Apr 19, 5:55 am, Joseph Jude ceph...@gmail.com wrote: Hi all, I have a function as below. This is called as part of API function rather than from the browser. def assign(): print request.vars.fields if request.vars.fields: case_values=json.loads(request.vars.fields) ret_dict=api.assign_case(db,case_values) else: ret_dict={'id': 1, 'msg': 'No parameters received'} return json.dumps(ret_dict) When I invoke this via, curl -u u...@example.com:web2pyhttp://localhost:8000/init/api/assign/ -d fields='{id:16,assign_to:age...@example.com}' I do get request.vars.fields properly and the function executes as desired. However when I try the same via a python script like the below: data = { 'fields': {'case_id': 16, 'assign_to': 'age...@example.com'} } data = urllib.urlencode(data) response = urllib2.urlopen(request,data).read() There is no input parameter (fields). When I examine the request.vars.fields, it shows like the below: Storage {'\r\nfields': {'case_id': 16, 'assign_to': 'age...@example.com'%} There are \r\n at the begining and % at the end. Is there a reason for this? How can I test my function using python script (ie achieve the same result as curl). Hope my question is not too confusing. Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19862] reading http headers
Hi all, I'm implementing api for my application. I've written other controller functions. However I need implement the authentication. I am not able to find a way to use the default Auth(). I thought of the below option: at client (i.e: calling applications) - encode userid password - pass it as part of http basic auth header - if authenticated proceed further at server (ie my application) - read uid pwd from headers - authenticate with the user table - if authenticated, let the application to proceed does this look okay approach? Is there a better way? Considering that this is okay, I've figured out how to do all the steps except reading http headers (step 1 at server). Can someone throw some light? Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19243] Testing
Hi, What are the testing tools available within web2py? I know doctests can be used. Is there a client test tool too (something like what Django has)? Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19344] Re: User Report: Me
I was one of the guys who lamented lack of blogs on web2py. So here I've written a blog post: http://www.jjude.com/2009/04/07/why-i-chose-web2py-for-developing-yatsy/. Feel free to comment/digg/stumble/twit. Joseph On Mar 22, 11:04 pm, Kent Borg kentb...@borg.org wrote: Datapoint: I have been studying and playing with web2py for several weeks now. Attractions: - Python. - Appeared to be simple. - Claimed to scale. First reactions: - I think I finally understand list comprehensions! (Spending a lot of time trying to understand how to write pythonic code and not just C with picky indenting.) - Indeed, it seems simple. - I am still expecting it scales, but have yet to prove it to myself. - The name is, um, lacking. Until I read the web 2.0 for python mnemonic I couldn't remember whether it was web2py or py2web. - Nice people! Mostly I have been pecking away on my own, but today I have been plowing through the mailing list and I am struck at how constructive and nice everyone is. It makes me think web2py must be friendly software, too. (Please, don't degrade to a list where every question is answered with a curt reply that is nothing more than a URL and the clear implication that it was a stupid question.) - I have climbed out on an obscure limb of a non-mainstream tree in a quiet end of the forest. If web2py turns out to be a secret weapon with which to work magic, cool. If it surges in popularity, even better. If it turns out to have been an approachable training ground on which to wrap my head around the model/controller/view paradigm, all for the day I am forced to move on to something better known...well, it seems it will have been worth it. - I bought the book on lulu, and it was both necessary and worth it. I printed a copy that has been well used, and I keep a copy of the pdf open for searching. -kb, the Kent who doesn't know if his studying will help him find a job, but is it good use of his time unemployed anyway. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19153] User Registration on userid rather than email
Hi All, What is needed to have userid rather than email in the user registration page of Auth? Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19010] appengine error
Hi all, I'm not sure if anyone of you got this error while running on appengine (locally, using appengine launcher). type 'exceptions.IOError': [Errno 13] file not accessible going through the err pg, I see this at the end. web2py_path = os.environ.get('web2py_path', os.getcwd()) web2py_version = open(os.path.join(web2py_path, 'VERSION'), 'r').read() Don't know how to resolve this. Any idea? Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18807] strange dict (first) value
I have this db definition: db.define_table('status', SQLField('name'), SQLField('sort_order', 'integer')) I've inserted sample values like: if len(db().select(db.status.ALL)) == 0: db.status.insert(name='New', sort_order=1) db.status.insert(name='Assigned', sort_order=2) db.status.insert(name='Open', sort_order=3) db.status.insert(name='Work In Progress', sort_order=4) db.status.insert(name='Closed', sort_order=5) Then in the controller: status_values={} for status in db().select(db.status.ALL, orderby=db.status.sort_order): status_values[status.id]=status.name form=FORM(TABLE(TR(Status:, status_values.values()[0]))) When I run this as web2py, I get New; but when I run this in google appengine, I get Closed. I am not able to figure this out. Can anyone help me? I want to display the first value. Thanks, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18826] URL mapping - blocking default URLs
All, I have used routes.py for URL mapping and it is working as expected. However I can type the default URLs (/init/default/index, /init/ default/*) on the browser and it still accepts it. How can these default URLs be blocked? Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18507] MVC question
All, Just a question on the best practice - in terms of development continuous maintenance. web2py (like django) allows to define forms in controller itself. And it allows having 'business logic' embedded in views too. To bring out the application quickly, such mixing is fine. But what about long term maintenance and also to call the application truly MVC? What are your thoughts basis of your experience. Thank you for sharing your thoughts on this, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18512] Re: MVC question
Yarko, Thank you for the detailed explanation. :-) Joseph On Mar 24, 12:22 pm, Yarko Tymciurak yark...@gmail.com wrote: Let's look at what is meant by the term business logic --- this is what implementspart of a solution for a problem statement. If we were talking 4-tier model, then we would say business logic and engineering logic; it is the implementation in language of the solution/problem space, and just a further decomposition --- still implementation logic, still about the solution. With me so far? Now - what is presentation? It is how something is shown to the user. Does that require logic? Yes, it certainly can (consider javascript, etc.). What differentiates the logic of presentation form the logic of business? The concern, the type of processing. Is there some point at the boundary between these two where it might be fuzzy? Yes. How do you resolve that? You just make a choice, and do it however you choose. You'll probably do it differntly than I would. In the details, there's rarely a right or wrong - there's a better for this, or better for that. Back to this question about where do you define forms. What is a form? Is it strictly a presentation statement? Or is it a statement of required interaction with the user? Look: Business logic: we need name, address, phone to take an order Engineering logic we need input from user to collect name, address, phone Presentation logic: we want Name to be above address, address above phone - all on one form. Business logic: the customer may save his information with us, but that is not required for an order Engineering logic: persist name, address, and phone if requested (e.g. offer request to save) Presentation: Checkbox for save my info Now - where do you define form? It's a design decision - YOU decide. But some things are rather clear: validation logic probably should not be part of the presentation (although there may be valid reasons for this in your application) Defining color of form probably does not belong in the controller (better left somewhere else). Does it make sense to separate basic definition of an HTML form from the controller? That depends - are you going to allow input through PDF forms? csv? Then maybe it makes sense to separate this. If you're a web-input only application, then maybe not. By now you get the idea: some questions you can ask over and over, and get guidelines, and reasons behind them (e.g. color of form), but _most_ of these details are design decisions. Part of these are made or encouraged a certain way by the design decisions in the framework you choose to use; part of these will always be up to you, the software and web designer - what makes sense for one application will better be done another way; many things won't matter all that much... until you use them long enough, and then you will change your mind (e.g. refactor). mvc is just another way to say you've split your application into a data layer, a business layer, and a presentation layer - it's a separation of concerns; it serves to reduce design coupling. The goal is a maintainable and extensible app. The devil is in the details. Questions of truly MVC are like truly agile or truly capitalist / market economy or truly social --- as long as you don't loose the reasons behind these, why these abstractions (shortcuts to concepts) came to be in the first place, you're ok (otherwise you get into trouble): maintainable, extensible; frequent feedback; efficient, self-regulating allocation of resources in society; social responsibility to people in your community. :-) - Yarko On Tue, Mar 24, 2009 at 1:37 AM, Joseph Jude ceph...@gmail.com wrote: All, Just a question on the best practice - in terms of development continuous maintenance. web2py (like django) allows to define forms in controller itself. And it allows having 'business logic' embedded in views too. To bring out the application quickly, such mixing is fine. But what about long term maintenance and also to call the application truly MVC? What are your thoughts basis of your experience. Thank you for sharing your thoughts on this, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18522] creating stand-alone apps of web2py
Is there any guide/documentation on how to create stand-alone applications of web2py (on windows/mac)? Thanks, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18539] Re: creating stand-alone apps of web2py
Massimo, I understood the license part. I believe using web2py, I could create .exe .apps. Is there any documentation on how to go about - like steps to use setup.py? Thx, Joseph On Mar 24, 7:38 pm, mdipierro mdipie...@cs.depaul.edu wrote: You can get the current binary versions, create your app and rezip it, as long as you comply with the license. On Mar 24, 8:05 am, Joseph Jude ceph...@gmail.com wrote: Is there any guide/documentation on how to create stand-alone applications of web2py (on windows/mac)? Thanks, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18560] Re: creating stand-alone apps of web2py
Thx Massimo. My confusion was because I saw setup_exe.py setup_app.py. I assumed that using these two files, I'll be able to create executables. Joseph On Mar 24, 11:50 pm, mdipierro mdipie...@cs.depaul.edu wrote: I am not sure I understand what you want to do. If you name your app init, it will be the default app in web2py. If you unzip web2py binary, run it, create the init app, and re-zip it, this is as close as it gets to create an executable. The executable is web2py, not your app, but your app comes with it and starts when web2py starts. You can also install your init app bytecode compiled so that you do not give away the source code. Massimo On Mar 24, 10:48 am, Joseph Jude ceph...@gmail.com wrote: Massimo, I understood the license part. I believe using web2py, I could create .exe .apps. Is there any documentation on how to go about - like steps to use setup.py? Thx, Joseph On Mar 24, 7:38 pm, mdipierro mdipie...@cs.depaul.edu wrote: You can get the current binary versions, create your app and rezip it, as long as you comply with the license. On Mar 24, 8:05 am, Joseph Jude ceph...@gmail.com wrote: Is there any guide/documentation on how to create stand-alone applications of web2py (on windows/mac)? Thanks, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18377] Re: Google Authentication + web2py on GAE
I'm assuming that you want to validate the user via google auth and then allow the authenticated user into your application. Sometime back, i did this for a desktop based application updating a application hosted in appengine (after authentication). I wrote abt it here: http://www.jjude.com/2008/09/18/authenticating-in-gae/ At first I obtained the uid/pwd from the user and sent it via header to authenticate. By one of the comments from the user, I realized that it is not a safe manner. Later I let the google auth to validate the user and then allow the access accordingly. The code is also shared in google code. You can pick it up. Hope this helps. Joseph On Mar 20, 7:09 am, NguyendHEX i...@dohoangnguyen.com wrote: You can use user class from google from google.appengine.api import users user = users.get_current_user() if user: #user.email() else: #redirect to login: users.create_login_url() Hope this help On Mar 20, 6:56 am, Tito Garrido titogarr...@gmail.com wrote: Is there a way to use Google Authentication + web2py on GAE? Regards, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:18341] Re: Marketing suggestion
I've created a yahoo pipe to aggregate blog posts (google blog alert) tweets (twitter search). if you blog about web2py, please let me know the feed URL and I'll add (in fact you can clone the pipe and create your own too). If there are other sources (not aggregate sources) - that you would like add, please let me know as well. Can you enable the feeds for web2py wiki? Then I can add that too into this sources. URL address of the pipe: http://pipes.yahoo.com/jjudes/web2py But there is not much of blogs / tweets abt web2py though. Hopefully, we will see a lot in the coming days. Rgds, Joseph On Mar 17, 9:14 am, Jason Brower encomp...@gmail.com wrote: I agree... THAT is what we need. Cool apps and a clean plugin framework. (And a better homepage. :P) Regards, Jason On Mon, 2009-03-16 at 11:55 -0700, Jeffield wrote: just my 0.2 write some killer apps, fans will follow. -- note, I have not written any, but I am trying ;) Thanks, Jeff --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:17641] my first web2py app (hosted at GAE)
All, I am glad to say that my first app on web2py is hosted in GAE, thanks to ease of programming in web2py. It is my attempt to learn new concepts (cloud computing, SAAS etc) utilizing my experience (on helpdesk, service desk). It is hosted at: http://y-a-t-s-y.appspot.com/. I blogged about it at: http://www.jjude.com/2009/03/08/a-first-shot-at-web2py/. The code is hosted at: http://code.google.com/p/y-a-t-s-y/source/browse/trunk. This is my first web2py attempt. So if any of the experts here would be willing to do a code review, primarily of default.py (http:// code.google.com/p/y-a-t-s-y/source/browse/trunk) layout.html (http:// code.google.com/p/y-a-t-s-y/source/browse/trunk/applications/init/ views/layout.html), it will help me to improve my coding. Feel free to comment on other code as well. Having done this far, I do have few questions. Your answers are appreciated: 1) Login page shows admin, request etc buttons. How can I hide them? Should I have to create a view template? Where should it be in the directories? Can it be under my application directory? 2) Better yet would be possibility to have login form on the first page (index.html) along with other static contents. How can that be done? 3) At logout, control goes back to login page. Can it be routed to index.html? I've other questions too. I will throw them as I progress along. Hopefully I'll be able to contribute to the growth of web2py, even in a smaller way. Thanks folks, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:16787] URL Controller question
All, I'm just starting out with web2py. I have two questions: : the url is mapped out as /app/controller/function. so this looks like : http://domain/init/default/index. How to have url as http://domain/index? : as I understand from the docs, all functions in the controller (default.py) are exposed. is it possible to hide functions in the controller file or should I take such functions to another file? Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:16793] Re: web2py on gae - errors questions
Okay with little bit of search, I found that, -In GAE, one can't select a single field; so I selected all fields (db.priority.ALL) and the error 1 vanished. -In GAE, datetime field throws up error. I removed datetime fields, and I didn't get any error. Once I introduce the datetime field in db model, the error is back. It is not only with null value; even when I try to insert a value, I get the same error. Any help? Thank you, Joseph On Feb 23, 3:34 pm, Cephire ceph...@gmail.com wrote: All, I'm trying out with web2py. It worked okay in the local web2py server; however when I tried with GAE (again local), I get few errors. Please help in resolving this. Thank you. Models db.define_table('status', SQLField('name')) db.define_table('priority', SQLField('name')) db.define_table('cases', SQLField('title'), SQLField('description', 'text', length=256), SQLField('status', db.status), SQLField('priority', db.priority), SQLField('created_by', db.auth_user), SQLField('created_time', 'datetime', default=now), SQLField('last_modified_by', db.auth_user), SQLField('last_modified_time', 'datetime', default=now) ) db.cases.priority.requires=IS_IN_DB(db, 'priority.id','priority.name') db.cases.created_by.required=IS_IN_DB(db, 'auth_user.id') db.cases.title.requires=[IS_NOT_EMPTY()] db.cases.description.requires=[IS_NOT_EMPTY()] controller == @auth.requires_login() def create(): priority_values=[] for pr in db().select(db.priority.name): priority_values.append(pr['name']) status_values=[] for st in db().select(db.status.name): status_values.append(st['name']) form=FORM(TABLE(TR(Title:,INPUT(_type=text,_name=title, requires=IS_NOT_EMPTY())), TR(Status:, status_values[0]), TR(Priority:, SELECT(priority_values,_name='priority', requires=IS_IN_SET(priority_values))), TR(Description:, TEXTAREA(_name='description')), TR(Created By:, auth.user.email), TR(,INPUT(_type=submit, _value=Create)) )) if form.accepts(request.vars, session): #insert into the record #dict index starts with 0; record id starts with 1 db.cases.insert(title=form.vars.title, status=1, priority=priority_values.index(form.vars.priority)+1, description=form.vars.description,created_by=auth.user.id, last_modified_by=auth.user.id) redirect(URL(r=request, f='index')) return dict(form=form) Error 1: SyntaxError: SQLSet: no tables selected at line for pr in db().select(db.priority.name): Error 2: I changed the insert line into the below: db.cases.insert(title=test title, priority=1, created_by=12, description=test description) 1 12 are the IDs in the respective tables in google datastore and I get this error: str(obj)[11:].strip().split(':')[:3]] ValueError: invalid literal for int() with base 10: '' --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:16828] Re: web2py on gae - errors questions
Massimo, have the below as the db.py in GAE and at the time of startup the error throws up db.py === try: from gluon.contrib.gql import * # if running on Google App Engine except: db = SQLDB('sqlite://storage.db') # if not, use SQLite or other DB else: db = GQLDB() # connect to Google BigTable session.connect(request, response, db=db) # and store sessions there import datetime; now=datetime.date.today() db.define_table('cases', SQLField('title'), SQLField('created_time', 'datetime', default=now) ) db.cases.insert(title='testing', created_time=now) ===end of db.py== error: str(obj)[11:].strip().split(':')[:3]] ValueError: invalid literal for int() with base 10: '' I'm using web2py: Version 1.56.2 (2009-02-08 21:49:34) on GAE: release: 1.1.9 / timestamp: 1232676672 / api_versions: ['1'] on kubuntu thanks, Joseph On Feb 23, 9:05 pm, mdipierro mdipie...@cs.depaul.edu wrote: Can you tell me how to reproduce it? On Feb 23, 9:50 am, Robin B robi...@gmail.com wrote: It looks like a problem converting datetimes to/from strings? Robin On Feb 23, 9:21 am, mdipierro mdipie...@cs.depaul.edu wrote: Robin, what is the bug? Massimo On Feb 23, 9:04 am, Robin B robi...@gmail.com wrote: Looks like the type coercion code was last modified in r725. http://code.google.com/p/web2py/source/diff?spec=svn743r=725format=... If the bug is not in 1.56.2, try using 1.56.2 until this can be fixed/ patched. Robin On Feb 23, 8:08 am, Joseph Jude ceph...@gmail.com wrote: Okay with little bit of search, I found that, -In GAE, one can't select a single field; so I selected all fields (db.priority.ALL) and the error 1 vanished. -In GAE, datetime field throws up error. I removed datetime fields, and I didn't get any error. Once I introduce the datetime field in db model, the error is back. It is not only with null value; even when I try to insert a value, I get the same error. Any help? Thank you, Joseph On Feb 23, 3:34 pm, Cephire ceph...@gmail.com wrote: All, I'm trying out with web2py. It worked okay in the local web2py server; however when I tried with GAE (again local), I get few errors. Please help in resolving this. Thank you. Models db.define_table('status', SQLField('name')) db.define_table('priority', SQLField('name')) db.define_table('cases', SQLField('title'), SQLField('description', 'text', length=256), SQLField('status', db.status), SQLField('priority', db.priority), SQLField('created_by', db.auth_user), SQLField('created_time', 'datetime', default=now), SQLField('last_modified_by', db.auth_user), SQLField('last_modified_time', 'datetime', default=now) ) db.cases.priority.requires=IS_IN_DB(db, 'priority.id','priority.name') db.cases.created_by.required=IS_IN_DB(db, 'auth_user.id') db.cases.title.requires=[IS_NOT_EMPTY()] db.cases.description.requires=[IS_NOT_EMPTY()] controller == @auth.requires_login() def create(): priority_values=[] for pr in db().select(db.priority.name): priority_values.append(pr['name']) status_values=[] for st in db().select(db.status.name): status_values.append(st['name']) form=FORM(TABLE(TR(Title:,INPUT(_type=text,_name=title, requires=IS_NOT_EMPTY())), TR(Status:, status_values[0]), TR(Priority:, SELECT(priority_values,_name='priority', requires=IS_IN_SET(priority_values))), TR(Description:, TEXTAREA(_name='description')), TR(Created By:, auth.user.email), TR(,INPUT(_type=submit, _value=Create)) )) if form.accepts(request.vars, session): #insert into the record #dict index starts with 0; record id starts with 1 db.cases.insert(title=form.vars.title, status=1, priority=priority_values.index(form.vars.priority)+1, description=form.vars.description,created_by=auth.user.id, last_modified_by=auth.user.id) redirect(URL(r=request, f='index')) return dict(form=form) Error 1: SyntaxError: SQLSet: no tables selected at line for pr in db().select(db.priority.name): Error 2: I changed the insert line into the below: db.cases.insert(title=test title, priority=1, created_by=12, description=test description) 1 12 are the IDs in the respective tables in google datastore and I get this error: str(obj)[11:].strip().split(':')[:3]] ValueError: invalid