[web2py] Re: Beginners Advice
Massimo, Thank you for the guidance on structuring the application, that helps a lot. However, it seems to me that there is no scope for creating a deeper hierarchy than Application/Controller/Action, is this correct? Would this be an inherent part of any web framework which does the URL mapping for you? Do people find this to be a limitation? I tried experimenting within an application called TestComplaint, web2py allows me to create the files: Complaint/ClientComplaint.py and Complaint/ClientComplaint/index.html which creates sub-folders in the controller and view folders. Trying to enter the corresponding URLs obviously fails as it is looking for a method ClientComplaint in the controller Complaint, so these files would never be accessible... I'm not saying web2py should stop me from creating them, but just curious if there was a good reason for allowing me to do so, with a view to creating sub- application folders? regards, Andy. On Apr 8, 1:58 pm, mdipierro mdipie...@cs.depaul.edu wrote: Hi Andy, One important issue here is whether all the applications you are going to build with web2py need to share authentication with non-web2py applications or not. If yes you need federated authentication (for example CAS) and things can get complex. If no, then you can simply your life a lot if 1) make a single controller for each complaint 2) make a single model for all complains 3) extend your application with one controller and one model file for each main function of the company This design will allow to easily share the built-in authentication (auth and db.py) and layout.html It is modular enough that if you later choose to break it into separate apps and implement some other distriuted authentication mechanism you can do so. Massimo On Apr 8, 3:42 am, AndyBuchan mr_buc...@hotmail.com wrote: -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: auth.settings.actions_disabled.append('register')
thank you all. Thadeus: in my model below the place Auth tables are created; Massimo: no I do not have my register action, everything is web2py Auth out of the box. Yarko: Definitely not routes fault: I commented my routes but I still can access the registration page. I am down at debugging, later I will post more results. carlo On 9 Apr, 00:45, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 8, 4:43 pm, carlo syseng...@gmail.com wrote: thank you Yarko for replying. Well it is really a strange behaviour, I am trying to isolate the problem. Try with just a fresh app first - just a clone of welcome with auth enabled, auth.requires_login() set for default/index, and not more. Then try appending the actions_disabled - no routes, nothing: just get to this point first. THEN --- if you think you are having problems with routes, add routes to _just that minimal test_. You can use your favorite debugger, and set it to ~ line 270 in gluon/ tools.py, to this: elif args[0] in self.settings.actions_disabled: raise HTTP(404) and confirm that auth.__call__ is happening, that your setting is there. If you want to add your routes changes, and debug those, I'd start with using the canned generic.html view, where you can see all the request vars - this will help you also. Anyway, the point is: separate it to one problem at a time. Otherwise it _will_ seem hard to make sense of things, separate out what is going on. Hope this is helpful. - Yarko For now I have the feeling that my problem ha something to do with routes.py, this is my routing rule: routes_in = (('/$f', '/init/default/$f'),) routes_out = (('/init/default/$f', '/$f'),) In fact the login page, where you are redirected after you call an auth-decorated function, breaks the above rule: http://www.mysite.com/init/default/user/login?_next=/add Do you think this make any sense? Could this in any way affect the 'register' page so that it is not disabled? carlo On 8 Apr, 19:27, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: I've just tried this in both trunk, and 1.76.5, and in each I get a 404 NOT FOUND when I hit register... Perhaps say more about what you are doing that you think this does not work... On Apr 8, 10:05 am, carlo syseng...@gmail.com wrote: Following the manual I put this statement in my model file but it seems I can still access the register page and register a new user: did I miss something? carlo -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: when send email containing Chinease characters with tools.Mail, Mojibake appears
See that: http://groups.google.com/group/web2py/browse_frm/thread/6ff484a8d651a935/edb931e024aaff32?lnk=gstq=when+send+email#edb931e024aaff32 at line 285 in gluon/tools.py. I changed the attachment.attach(MIMEText.MIMEText(text)) line to attachment.attach(MIMEText.MIMEText(text,_charset='utf-8')) Some more patch for headers: gluon/tools.py from line 259: payload['To'] = header.Header(', '.join(to).decode(encoding).encode('utf-8'),'utf-8') ... payload['Reply-To'] = header.Header(reply_to.decode(encoding).encode('utf-8'),'utf-8') ... payload['Subject'] = header.Header(subject.decode(encoding).encode('utf-8'),'utf-8') ... payload['Cc'] = header.Header(', '.join(cc).decode(encoding).encode('utf-8'),'utf-8') ... payload['Bcc'] = header.Header(', '.join(bcc).decode(encoding).encode('utf-8'),'utf-8') On ápr. 8, 15:39, hywang why00...@163.com wrote: To view theemailcorrectly when receive it, I have to specify charset to utf-8 to avoid Mojibake. And the default charset that tools.Mail uses is charset=us-ascii. For your convenience, you can test it with these two word 测试 -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: auth.settings.actions_disabled.append('register')
I think I have found the problem: in the models folder I had 3 files: db.py, lastdb.py, menu.py. Lastdb.py was an old copy of db.py but, as far as I remeber, there was no auth.settings.actions_disabled.append('register') in it. After I deleted lastdb.py it worked as expected: I think that lastdb.py was executed after db.py, Auth tables (re)created and set auth.settings.actions_disabled=[]. Does it make sense to you? Another small question: what do you suggest as the best way to show the user a kind page instead of 404 NOT FOUND after he tried registration? thank you carlo On 9 Apr, 12:48, carlo syseng...@gmail.com wrote: thank you all. Thadeus: in my model below the place Auth tables are created; Massimo: no I do not have my register action, everything is web2py Auth out of the box. Yarko: Definitely not routes fault: I commented my routes but I still can access the registration page. I am down at debugging, later I will post more results. carlo On 9 Apr, 00:45, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 8, 4:43 pm, carlo syseng...@gmail.com wrote: thank you Yarko for replying. Well it is really a strange behaviour, I am trying to isolate the problem. Try with just a fresh app first - just a clone of welcome with auth enabled, auth.requires_login() set for default/index, and not more. Then try appending the actions_disabled - no routes, nothing: just get to this point first. THEN --- if you think you are having problems with routes, add routes to _just that minimal test_. You can use your favorite debugger, and set it to ~ line 270 in gluon/ tools.py, to this: elif args[0] in self.settings.actions_disabled: raise HTTP(404) and confirm that auth.__call__ is happening, that your setting is there. If you want to add your routes changes, and debug those, I'd start with using the canned generic.html view, where you can see all the request vars - this will help you also. Anyway, the point is: separate it to one problem at a time. Otherwise it _will_ seem hard to make sense of things, separate out what is going on. Hope this is helpful. - Yarko For now I have the feeling that my problem ha something to do with routes.py, this is my routing rule: routes_in = (('/$f', '/init/default/$f'),) routes_out = (('/init/default/$f', '/$f'),) In fact the login page, where you are redirected after you call an auth-decorated function, breaks the above rule: http://www.mysite.com/init/default/user/login?_next=/add Do you think this make any sense? Could this in any way affect the 'register' page so that it is not disabled? carlo On 8 Apr, 19:27, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: I've just tried this in both trunk, and 1.76.5, and in each I get a 404 NOT FOUND when I hit register... Perhaps say more about what you are doing that you think this does not work... On Apr 8, 10:05 am, carlo syseng...@gmail.com wrote: Following the manual I put this statement in my model file but it seems I can still access the register page and register a new user: did I miss something? carlo -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: Problem with MANY-MANY relationship
That seems to be a good idea... I would love to see this in the next release. On Apr 8, 9:41 pm, Thadeus Burgess thade...@thadeusb.com wrote: Ive sent emails on the list twice, and one email to you personally about this. I have not implemented it since it never received any feedback. There will be a 'pre' and 'post' of 'select', 'insert', 'update', 'delete', separated by an underscore. The dal will maintain a list of functions for each of these. The function will be executed in order of assignment. So db.register('post_delete', copyRecordFunc) db.register('post_delete', notifyByEmail) In the dal.py it will look like results = self._cursor.execute('blah') for f in self.signals['post_delete']: f(results) -Thadeus On Thu, Apr 8, 2010 at 10:59 AM, mdipierro mdipie...@cs.depaul.edu wrote: y have missed or forgotten about this. I would be in favor of this but I would like to see a complete naming scheme and understand how do you handle the case when two functions are regitered for the same function. How do you han
[web2py] Re: auth.settings.actions_disabled.append('register')
On Apr 9, 6:07 am, carlo syseng...@gmail.com wrote: I think I have found the problem: :-) Yes, you did! in the models folder I had 3 files: db.py, lastdb.py, menu.py. Lastdb.py was an old copy of db.py but, as far as I remeber, there was no auth.settings.actions_disabled.append('register') in it. After I deleted lastdb.py it worked as expected: I think that lastdb.py was executed after db.py, Auth tables (re)created and set auth.settings.actions_disabled=[]. Does it make sense to you? Maybe if you thought of this all as being in one file - or better, one execution stream, this would start making sense: For a running web2py, a request gets routed to an application / controller / function by gluon/main.py -- To set up the environment for that call, gluon (web2py core) runs all the model files, and then calls the function in your controller. Here's what that means: In your application's models folder, all the *.py files are read (in alphabetical order - this is your file processing stream). Once the data associations, and database connections are in place, then your controller is ready for a call. In your case, the model-stream that was setup was: db.py, then lastbd.py, then menu.py. If you say something like auth=Auth() you are creating a new instance of an object, and using Auth (the class) to initialize that instance. If you have another assignment to the variable auth, the first reference to the created object is released, and auth is pointed to the new, initialized object. In your case, lastdb.py created the second Auth() instance, and re- assigned auth to point to this new object. The new object's default setting was to NOT have registration disabled. If this is making sense, then you will know that when you do development experiments like this, you will want to rename your last file at the tail-end, e.g. rename db.py to db.py.last is a better choice - since it is then no longer a python file, and will not get read. You'll find for references to 404 in www.web2py.com/book... Have lots of fun! - Yarko Another small question: what do you suggest as the best way to show the user a kind page instead of 404 NOT FOUND after he tried registration? thank you carlo On 9 Apr, 12:48, carlo syseng...@gmail.com wrote: thank you all. Thadeus: in my model below the place Auth tables are created; Massimo: no I do not have my register action, everything is web2py Auth out of the box. Yarko: Definitely not routes fault: I commented my routes but I still can access the registration page. I am down at debugging, later I will post more results. carlo On 9 Apr, 00:45, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 8, 4:43 pm, carlo syseng...@gmail.com wrote: thank you Yarko for replying. Well it is really a strange behaviour, I am trying to isolate the problem. Try with just a fresh app first - just a clone of welcome with auth enabled, auth.requires_login() set for default/index, and not more. Then try appending the actions_disabled - no routes, nothing: just get to this point first. THEN --- if you think you are having problems with routes, add routes to _just that minimal test_. You can use your favorite debugger, and set it to ~ line 270 in gluon/ tools.py, to this: elif args[0] in self.settings.actions_disabled: raise HTTP(404) and confirm that auth.__call__ is happening, that your setting is there. If you want to add your routes changes, and debug those, I'd start with using the canned generic.html view, where you can see all the request vars - this will help you also. Anyway, the point is: separate it to one problem at a time. Otherwise it _will_ seem hard to make sense of things, separate out what is going on. Hope this is helpful. - Yarko For now I have the feeling that my problem ha something to do with routes.py, this is my routing rule: routes_in = (('/$f', '/init/default/$f'),) routes_out = (('/init/default/$f', '/$f'),) In fact the login page, where you are redirected after you call an auth-decorated function, breaks the above rule: http://www.mysite.com/init/default/user/login?_next=/add Do you think this make any sense? Could this in any way affect the 'register' page so that it is not disabled? carlo On 8 Apr, 19:27, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: I've just tried this in both trunk, and 1.76.5, and in each I get a 404 NOT FOUND when I hit register... Perhaps say more about what you are doing that you think this does not work... On Apr 8, 10:05 am, carlo syseng...@gmail.com wrote: Following the manual I put this statement in my model file but it seems I can still access the register page and register a new user: did I miss something? carlo -- You received this message because you are subscribed to
[web2py] Re: How to by-pass user/login page for authentication
On Apr 9, 5:46 am, Rohan yourbuddyro...@gmail.com wrote: Hi All, I am a newbie with web2py. Basically I want to by-pass the user's visit to user/login page. My home page will have the login fields like twitter and I am planning to collect username/email and password from login screen and pass it to web2py's default authentication service for verification. On correct login, user should be navigated to index page like normal. Any pointers? One way to think of what you asked to do is this: - an index page that requires login - another page with a place to login, if not logged in A simple way to do this is to add the auth.requires_login() decorator to your index controller function, which will force a login call. There are several ways you can manage how this looks: one is by customizing the user.html page in views/default to be what you are referring to as your Home Page; another is to point auth() to get login form / action from your more involved controller function, which also has your home page (and login form, of course). See more at http://www.web2py.com/book/default/section/8/1?search=login Regards, - Yarko Also Is there anyway to customize the look and feel of default login screen generated by web2py? Thanks -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: How to by-pass user/login page for authentication
Thanks Yarko, I don't want to use auth.requires_login() to index function as it will lead the user to login page. another is to point auth() to get login form / action from your more involved controller function, which also has your home page (and login form, of course). Can you please elaborate on this one? How can I point auth() to get info from my custom login form on my home page? Thanks On Apr 9, 5:11 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 9, 5:46 am, Rohan yourbuddyro...@gmail.com wrote: Hi All, I am a newbie with web2py. Basically I want to by-pass the user's visit to user/login page. My home page will have the login fields like twitter and I am planning to collect username/email and password from login screen and pass it to web2py's default authentication service for verification. On correct login, user should be navigated to index page like normal. Any pointers? One way to think of what you asked to do is this: - an index page that requires login - another page with a place to login, if not logged in A simple way to do this is to add the auth.requires_login() decorator to your index controller function, which will force a login call. There are several ways you can manage how this looks: one is by customizing the user.html page in views/default to be what you are referring to as your Home Page; another is to point auth() to get login form / action from your more involved controller function, which also has your home page (and login form, of course). See more athttp://www.web2py.com/book/default/section/8/1?search=login Regards, - Yarko Also Is there anyway to customize the look and feel of default login screen generated by web2py? Thanks -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: auth.settings.actions_disabled.append('register')
thank you, I knew all you said but I did not focus enough on the double model issue oops! About the 404 error page your link is broken but browsing the manual I think you pointed me to the routes_onerror solution. Thank you for bridging the execution stream clearly, carlo On 9 Apr, 14:02, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 9, 6:07 am, carlo syseng...@gmail.com wrote: I think I have found the problem: :-) Yes, you did! in the models folder I had 3 files: db.py, lastdb.py, menu.py. Lastdb.py was an old copy of db.py but, as far as I remeber, there was no auth.settings.actions_disabled.append('register') in it. After I deleted lastdb.py it worked as expected: I think that lastdb.py was executed after db.py, Auth tables (re)created and set auth.settings.actions_disabled=[]. Does it make sense to you? Maybe if you thought of this all as being in one file - or better, one execution stream, this would start making sense: For a running web2py, a request gets routed to an application / controller / function by gluon/main.py -- To set up the environment for that call, gluon (web2py core) runs all the model files, and then calls the function in your controller. Here's what that means: In your application's models folder, all the *.py files are read (in alphabetical order - this is your file processing stream). Once the data associations, and database connections are in place, then your controller is ready for a call. In your case, the model-stream that was setup was: db.py, then lastbd.py, then menu.py. If you say something like auth=Auth() you are creating a new instance of an object, and using Auth (the class) to initialize that instance. If you have another assignment to the variable auth, the first reference to the created object is released, and auth is pointed to the new, initialized object. In your case, lastdb.py created the second Auth() instance, and re- assigned auth to point to this new object. The new object's default setting was to NOT have registration disabled. If this is making sense, then you will know that when you do development experiments like this, you will want to rename your last file at the tail-end, e.g. rename db.py to db.py.last is a better choice - since it is then no longer a python file, and will not get read. You'll find for references to 404 in www.web2py.com/book... Have lots of fun! - Yarko Another small question: what do you suggest as the best way to show the user a kind page instead of 404 NOT FOUND after he tried registration? thank you carlo On 9 Apr, 12:48, carlo syseng...@gmail.com wrote: thank you all. Thadeus: in my model below the place Auth tables are created; Massimo: no I do not have my register action, everything is web2py Auth out of the box. Yarko: Definitely not routes fault: I commented my routes but I still can access the registration page. I am down at debugging, later I will post more results. carlo On 9 Apr, 00:45, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 8, 4:43 pm, carlo syseng...@gmail.com wrote: thank you Yarko for replying. Well it is really a strange behaviour, I am trying to isolate the problem. Try with just a fresh app first - just a clone of welcome with auth enabled, auth.requires_login() set for default/index, and not more. Then try appending the actions_disabled - no routes, nothing: just get to this point first. THEN --- if you think you are having problems with routes, add routes to _just that minimal test_. You can use your favorite debugger, and set it to ~ line 270 in gluon/ tools.py, to this: elif args[0] in self.settings.actions_disabled: raise HTTP(404) and confirm that auth.__call__ is happening, that your setting is there. If you want to add your routes changes, and debug those, I'd start with using the canned generic.html view, where you can see all the request vars - this will help you also. Anyway, the point is: separate it to one problem at a time. Otherwise it _will_ seem hard to make sense of things, separate out what is going on. Hope this is helpful. - Yarko For now I have the feeling that my problem ha something to do with routes.py, this is my routing rule: routes_in = (('/$f', '/init/default/$f'),) routes_out = (('/init/default/$f', '/$f'),) In fact the login page, where you are redirected after you call an auth-decorated function, breaks the above rule: http://www.mysite.com/init/default/user/login?_next=/add Do you think this make any sense? Could this in any way affect the 'register' page so that it is not disabled? carlo On 8 Apr, 19:27, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: I've just tried this in both trunk, and 1.76.5, and in each I get a
[web2py] Re: web2py URLs
I like the semicolon idea. But doesn't it imply changing web2py, anywhere where args and vars are used, like the URL function?. On Apr 8, 2:22 pm, mdipierro mdipie...@cs.depaul.edu wrote: I think if ; is present it be used by default to delimit the args since there cannot be confusion there /a/c/f.ext;a0/a1/a2 /a/c/f/a0/a1/a2.ext should be parsed in the same way. routes_in and routes_out should not be affected since they only rewrite the URL before web2py interprets it. On Apr 8, 12:43 pm, Thadeus Burgess thade...@thadeusb.com wrote: I just want it to be able to routes_in on both with ; and without ;. This is because my blog is indexed on google, and I want my old links to still work If I moved over to the ; method. -Thadeus On Thu, Apr 8, 2010 at 11:56 AM, Jonathan Lundell jlund...@pobox.com wrote: On Apr 8, 2010, at 9:37 AM, Thadeus Burgess wrote: How will we be able to configure to use one or the other? I'm thinking an alternative variable in routes.py. Also, there would be (I think) a provision for application-specific routes.py files, so once the application is resolved at the top level, the application-specific parsing could either be in the global routes.py (as now) or the app-specific version. Will it be able to do Both at the same time (for routes_in of course). I ask since certain web2py sites are scanned in google, you don't want the old links to dis-appear. Perhaps, but with some restrictions, since using / as the args separator leads to ambiguities that don't exist with ;. I'd like to be able to use standard Python libraries to do the main parsing work. Seehttp://docs.python.org/library/urlparse.html BTW, RFC2396 actually allows a ;-separated parameter on each component of the path; you could havehttp://domain.com/app;arg1/ctlr;arg2/function;arg3?query_string. I don't see a use for that in the web2py architecture, though. -Thadeus On Thu, Apr 8, 2010 at 11:30 AM, mdipierro mdipie...@cs.depaul.edu wrote: +1 On Apr 8, 11:25 am, Jonathan Lundell jlund...@pobox.com wrote: (Context: I've been working on URL parsing.) One of the difficulties that parsing web2py URLs presents is that the boundary between /a/c/f and args isn't explicit, along with the fact that pieces of /a/c/f can be implied (in particular when routes.py is being used). RFC2396 (1998) introduced (or rather extended) the notion of 'parameters', taking advantage of the fact that ';' is reserved. So the RFC2396 approach is to write: /a/c/f;parameters?query_string, or in web2py terms /a/c/f;args?vars. That is, the boundary between /a/c/f and args is marked with a semi-colon instead of a slash. Args can of course be further divided however one likes; vars is subdivided with ''. What I'm working on is an alternative to (or rather extension to) the routes.py logic that is capable of supporting arbitrary encoding where appropriate (especially in args and vars) and that does not rely on regexes to do the work. The present scheme would remain in place. Which brings me to my question: I'd like to use the ';' convention to separate /a/c/f from args in this new regime. Does anyone have any strong feelings about it one way or the other? (One last thing: the architecture would be somewhat modular, so that besides the current mechanism and the one I'm describing, it would be fairly straightforward to introduce new ones.) -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- To unsubscribe, reply using remove me as the subject.
[web2py] [python2.4] small patch for 1.76.5
Easy and small fixes for newest web2py. This is generated with 'git format-patch -1' command. From: ont.rif ont@gmail.com Date: Fri, 9 Apr 2010 20:28:03 +0700 Subject: [PATCH] (f) fix code to work with python 2.4 --- tools.py | 12 ++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools.py b/tools.py index cc6f656..9b3d197 100644 --- a/tools.py +++ b/tools.py @@ -2525,7 +2525,10 @@ urllib2.install_opener(urllib2.build_opener(urllib2.HTTPCookieProcessor())) def fetch(url, data=None, headers={}, cookie=Cookie.SimpleCookie(), user_agent='Mozilla/5.0'): -data = data if data is None else urllib.urlencode(data) + +if data is not None: +data = urllib.urlencode(data) + if user_agent: headers['User-agent'] = user_agent headers['Cookie'] = ' '.join(['%s=%s;'%(c.key,c.value) for c in cookie.values()]) try: @@ -2534,7 +2537,12 @@ def fetch(url, data=None, headers={}, req = urllib2.Request(url, data, headers) html = urllib2.urlopen(req).read() else: -method = urlfetch.GET if data is None else urlfetch.POST + +if data is None: +method = urlfetch.GET +else: +method = urlfetch.POST + while url is not None: response = urlfetch.fetch(url=url, payload=data, method=method, headers=headers, -- 1.5.5.6 -- To unsubscribe, reply using remove me as the subject.
Re: [web2py] Re: How to by-pass user/login page for authentication
From any controller. return dict(auth_form=auth()) Then you can just {{=auth_form}} in your controllers view. -Thadeus On Fri, Apr 9, 2010 at 7:19 AM, Rohan yourbuddyro...@gmail.com wrote: Thanks Yarko, I don't want to use auth.requires_login() to index function as it will lead the user to login page. another is to point auth() to get login form / action from your more involved controller function, which also has your home page (and login form, of course). Can you please elaborate on this one? How can I point auth() to get info from my custom login form on my home page? Thanks On Apr 9, 5:11 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 9, 5:46 am, Rohan yourbuddyro...@gmail.com wrote: Hi All, I am a newbie with web2py. Basically I want to by-pass the user's visit to user/login page. My home page will have the login fields like twitter and I am planning to collect username/email and password from login screen and pass it to web2py's default authentication service for verification. On correct login, user should be navigated to index page like normal. Any pointers? One way to think of what you asked to do is this: - an index page that requires login - another page with a place to login, if not logged in A simple way to do this is to add the auth.requires_login() decorator to your index controller function, which will force a login call. There are several ways you can manage how this looks: one is by customizing the user.html page in views/default to be what you are referring to as your Home Page; another is to point auth() to get login form / action from your more involved controller function, which also has your home page (and login form, of course). See more athttp://www.web2py.com/book/default/section/8/1?search=login Regards, - Yarko Also Is there anyway to customize the look and feel of default login screen generated by web2py? Thanks -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: auth.settings.actions_disabled.append('register')
You can set auth.settings.on_failed_authorization = URL(...) On Apr 9, 7:02 am, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 9, 6:07 am, carlo syseng...@gmail.com wrote: I think I have found the problem: :-) Yes, you did! in the models folder I had 3 files: db.py, lastdb.py, menu.py. Lastdb.py was an old copy of db.py but, as far as I remeber, there was no auth.settings.actions_disabled.append('register') in it. After I deleted lastdb.py it worked as expected: I think that lastdb.py was executed after db.py, Auth tables (re)created and set auth.settings.actions_disabled=[]. Does it make sense to you? Maybe if you thought of this all as being in one file - or better, one execution stream, this would start making sense: For a running web2py, a request gets routed to an application / controller / function by gluon/main.py -- To set up the environment for that call, gluon (web2py core) runs all the model files, and then calls the function in your controller. Here's what that means: In your application's models folder, all the *.py files are read (in alphabetical order - this is your file processing stream). Once the data associations, and database connections are in place, then your controller is ready for a call. In your case, the model-stream that was setup was: db.py, then lastbd.py, then menu.py. If you say something like auth=Auth() you are creating a new instance of an object, and using Auth (the class) to initialize that instance. If you have another assignment to the variable auth, the first reference to the created object is released, and auth is pointed to the new, initialized object. In your case, lastdb.py created the second Auth() instance, and re- assigned auth to point to this new object. The new object's default setting was to NOT have registration disabled. If this is making sense, then you will know that when you do development experiments like this, you will want to rename your last file at the tail-end, e.g. rename db.py to db.py.last is a better choice - since it is then no longer a python file, and will not get read. You'll find for references to 404 in www.web2py.com/book... Have lots of fun! - Yarko Another small question: what do you suggest as the best way to show the user a kind page instead of 404 NOT FOUND after he tried registration? thank you carlo On 9 Apr, 12:48, carlo syseng...@gmail.com wrote: thank you all. Thadeus: in my model below the place Auth tables are created; Massimo: no I do not have my register action, everything is web2py Auth out of the box. Yarko: Definitely not routes fault: I commented my routes but I still can access the registration page. I am down at debugging, later I will post more results. carlo On 9 Apr, 00:45, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 8, 4:43 pm, carlo syseng...@gmail.com wrote: thank you Yarko for replying. Well it is really a strange behaviour, I am trying to isolate the problem. Try with just a fresh app first - just a clone of welcome with auth enabled, auth.requires_login() set for default/index, and not more. Then try appending the actions_disabled - no routes, nothing: just get to this point first. THEN --- if you think you are having problems with routes, add routes to _just that minimal test_. You can use your favorite debugger, and set it to ~ line 270 in gluon/ tools.py, to this: elif args[0] in self.settings.actions_disabled: raise HTTP(404) and confirm that auth.__call__ is happening, that your setting is there. If you want to add your routes changes, and debug those, I'd start with using the canned generic.html view, where you can see all the request vars - this will help you also. Anyway, the point is: separate it to one problem at a time. Otherwise it _will_ seem hard to make sense of things, separate out what is going on. Hope this is helpful. - Yarko For now I have the feeling that my problem ha something to do with routes.py, this is my routing rule: routes_in = (('/$f', '/init/default/$f'),) routes_out = (('/init/default/$f', '/$f'),) In fact the login page, where you are redirected after you call an auth-decorated function, breaks the above rule: http://www.mysite.com/init/default/user/login?_next=/add Do you think this make any sense? Could this in any way affect the 'register' page so that it is not disabled? carlo On 8 Apr, 19:27, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: I've just tried this in both trunk, and 1.76.5, and in each I get a 404 NOT FOUND when I hit register... Perhaps say more about what you are doing that you think this does not work... On Apr 8, 10:05 am, carlo syseng...@gmail.com wrote:
[web2py] Re: web2py URLs
Right not if there is a ; the URL does not pass validation so ; is simply not allowed. We can write this so that if ; is present the new method for parsing is used and urls generated by URL would always follow the new convention. Old convention would still work. I do not see any ambiguity. On Apr 9, 8:16 am, DenesL denes1...@yahoo.ca wrote: I like the semicolon idea. But doesn't it imply changing web2py, anywhere where args and vars are used, like the URL function?. On Apr 8, 2:22 pm, mdipierro mdipie...@cs.depaul.edu wrote: I think if ; is present it be used by default to delimit the args since there cannot be confusion there /a/c/f.ext;a0/a1/a2 /a/c/f/a0/a1/a2.ext should be parsed in the same way. routes_in and routes_out should not be affected since they only rewrite the URL before web2py interprets it. On Apr 8, 12:43 pm, Thadeus Burgess thade...@thadeusb.com wrote: I just want it to be able to routes_in on both with ; and without ;. This is because my blog is indexed on google, and I want my old links to still work If I moved over to the ; method. -Thadeus On Thu, Apr 8, 2010 at 11:56 AM, Jonathan Lundell jlund...@pobox.com wrote: On Apr 8, 2010, at 9:37 AM, Thadeus Burgess wrote: How will we be able to configure to use one or the other? I'm thinking an alternative variable in routes.py. Also, there would be (I think) a provision for application-specific routes.py files, so once the application is resolved at the top level, the application-specific parsing could either be in the global routes.py (as now) or the app-specific version. Will it be able to do Both at the same time (for routes_in of course). I ask since certain web2py sites are scanned in google, you don't want the old links to dis-appear. Perhaps, but with some restrictions, since using / as the args separator leads to ambiguities that don't exist with ;. I'd like to be able to use standard Python libraries to do the main parsing work. Seehttp://docs.python.org/library/urlparse.html BTW, RFC2396 actually allows a ;-separated parameter on each component of the path; you could havehttp://domain.com/app;arg1/ctlr;arg2/function;arg3?query_string. I don't see a use for that in the web2py architecture, though. -Thadeus On Thu, Apr 8, 2010 at 11:30 AM, mdipierro mdipie...@cs.depaul.edu wrote: +1 On Apr 8, 11:25 am, Jonathan Lundell jlund...@pobox.com wrote: (Context: I've been working on URL parsing.) One of the difficulties that parsing web2py URLs presents is that the boundary between /a/c/f and args isn't explicit, along with the fact that pieces of /a/c/f can be implied (in particular when routes.py is being used). RFC2396 (1998) introduced (or rather extended) the notion of 'parameters', taking advantage of the fact that ';' is reserved. So the RFC2396 approach is to write: /a/c/f;parameters?query_string, or in web2py terms /a/c/f;args?vars. That is, the boundary between /a/c/f and args is marked with a semi-colon instead of a slash. Args can of course be further divided however one likes; vars is subdivided with ''. What I'm working on is an alternative to (or rather extension to) the routes.py logic that is capable of supporting arbitrary encoding where appropriate (especially in args and vars) and that does not rely on regexes to do the work. The present scheme would remain in place. Which brings me to my question: I'd like to use the ';' convention to separate /a/c/f from args in this new regime. Does anyone have any strong feelings about it one way or the other? (One last thing: the architecture would be somewhat modular, so that besides the current mechanism and the one I'm describing, it would be fairly straightforward to introduce new ones.) -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group
[web2py] Re: small patch for 1.76.5
thank you this was already fixed in trunk. I will post a new version soon. On Apr 9, 8:43 am, ont.rif ont@gmail.com wrote: Easy and small fixes for newest web2py. This is generated with 'git format-patch -1' command. From: ont.rif ont@gmail.com Date: Fri, 9 Apr 2010 20:28:03 +0700 Subject: [PATCH] (f) fix code to work with python 2.4 --- tools.py | 12 ++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools.py b/tools.py index cc6f656..9b3d197 100644 --- a/tools.py +++ b/tools.py @@ -2525,7 +2525,10 @@ urllib2.install_opener(urllib2.build_opener(urllib2.HTTPCookieProcessor())) def fetch(url, data=None, headers={}, cookie=Cookie.SimpleCookie(), user_agent='Mozilla/5.0'): - data = data if data is None else urllib.urlencode(data) + + if data is not None: + data = urllib.urlencode(data) + if user_agent: headers['User-agent'] = user_agent headers['Cookie'] = ' '.join(['%s=%s;'%(c.key,c.value) for c in cookie.values()]) try: @@ -2534,7 +2537,12 @@ def fetch(url, data=None, headers={}, req = urllib2.Request(url, data, headers) html = urllib2.urlopen(req).read() else: - method = urlfetch.GET if data is None else urlfetch.POST + + if data is None: + method = urlfetch.GET + else: + method = urlfetch.POST + while url is not None: response = urlfetch.fetch(url=url, payload=data, method=method, headers=headers, -- 1.5.5.6 -- To unsubscribe, reply using remove me as the subject.
Re: [web2py] Re: web2py URLs
On Apr 9, 2010, at 6:16 AM, DenesL wrote: I like the semicolon idea. But doesn't it imply changing web2py, anywhere where args and vars are used, like the URL function?. The URL function, yes, because it's basically the rewrite-out handler. Nobody else should care, because the fields have already been split, unless an application is using the original URL. WRT handling missing defaults from a URL (a/c/f), I realized the other day that it's best to look at it starting with the routes-out side, URL(), and making the routes-in side complement it. I think that's conceptually simpler than the implied routes.py approach of managing routes-in and then figuring out the routes-out complement. Maybe that's just me... On Apr 8, 2:22 pm, mdipierro mdipie...@cs.depaul.edu wrote: I think if ; is present it be used by default to delimit the args since there cannot be confusion there /a/c/f.ext;a0/a1/a2 /a/c/f/a0/a1/a2.ext should be parsed in the same way. routes_in and routes_out should not be affected since they only rewrite the URL before web2py interprets it. On Apr 8, 12:43 pm, Thadeus Burgess thade...@thadeusb.com wrote: I just want it to be able to routes_in on both with ; and without ;. This is because my blog is indexed on google, and I want my old links to still work If I moved over to the ; method. -Thadeus On Thu, Apr 8, 2010 at 11:56 AM, Jonathan Lundell jlund...@pobox.com wrote: On Apr 8, 2010, at 9:37 AM, Thadeus Burgess wrote: How will we be able to configure to use one or the other? I'm thinking an alternative variable in routes.py. Also, there would be (I think) a provision for application-specific routes.py files, so once the application is resolved at the top level, the application-specific parsing could either be in the global routes.py (as now) or the app-specific version. Will it be able to do Both at the same time (for routes_in of course). I ask since certain web2py sites are scanned in google, you don't want the old links to dis-appear. Perhaps, but with some restrictions, since using / as the args separator leads to ambiguities that don't exist with ;. I'd like to be able to use standard Python libraries to do the main parsing work. Seehttp://docs.python.org/library/urlparse.html BTW, RFC2396 actually allows a ;-separated parameter on each component of the path; you could havehttp://domain.com/app;arg1/ctlr;arg2/function;arg3?query_string. I don't see a use for that in the web2py architecture, though. -Thadeus On Thu, Apr 8, 2010 at 11:30 AM, mdipierro mdipie...@cs.depaul.edu wrote: +1 On Apr 8, 11:25 am, Jonathan Lundell jlund...@pobox.com wrote: (Context: I've been working on URL parsing.) One of the difficulties that parsing web2py URLs presents is that the boundary between /a/c/f and args isn't explicit, along with the fact that pieces of /a/c/f can be implied (in particular when routes.py is being used). RFC2396 (1998) introduced (or rather extended) the notion of 'parameters', taking advantage of the fact that ';' is reserved. So the RFC2396 approach is to write: /a/c/f;parameters?query_string, or in web2py terms /a/c/f;args?vars. That is, the boundary between /a/c/f and args is marked with a semi-colon instead of a slash. Args can of course be further divided however one likes; vars is subdivided with ''. What I'm working on is an alternative to (or rather extension to) the routes.py logic that is capable of supporting arbitrary encoding where appropriate (especially in args and vars) and that does not rely on regexes to do the work. The present scheme would remain in place. Which brings me to my question: I'd like to use the ';' convention to separate /a/c/f from args in this new regime. Does anyone have any strong feelings about it one way or the other? (One last thing: the architecture would be somewhat modular, so that besides the current mechanism and the one I'm describing, it would be fairly straightforward to introduce new ones.) -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to
Re: [web2py] Re: web2py URLs
On Apr 9, 2010, at 8:09 AM, mdipierro wrote: Right not if there is a ; the URL does not pass validation so ; is simply not allowed. We can write this so that if ; is present the new method for parsing is used and urls generated by URL would always follow the new convention. Old convention would still work. I do not see any ambiguity. I think we still need a flag (possibly per-app), to recognize the case when there are no args (the canonical form of the URL never has a bare ;). On Apr 9, 8:16 am, DenesL denes1...@yahoo.ca wrote: I like the semicolon idea. But doesn't it imply changing web2py, anywhere where args and vars are used, like the URL function?. On Apr 8, 2:22 pm, mdipierro mdipie...@cs.depaul.edu wrote: I think if ; is present it be used by default to delimit the args since there cannot be confusion there /a/c/f.ext;a0/a1/a2 /a/c/f/a0/a1/a2.ext should be parsed in the same way. routes_in and routes_out should not be affected since they only rewrite the URL before web2py interprets it. On Apr 8, 12:43 pm, Thadeus Burgess thade...@thadeusb.com wrote: I just want it to be able to routes_in on both with ; and without ;. This is because my blog is indexed on google, and I want my old links to still work If I moved over to the ; method. -Thadeus On Thu, Apr 8, 2010 at 11:56 AM, Jonathan Lundell jlund...@pobox.com wrote: On Apr 8, 2010, at 9:37 AM, Thadeus Burgess wrote: How will we be able to configure to use one or the other? I'm thinking an alternative variable in routes.py. Also, there would be (I think) a provision for application-specific routes.py files, so once the application is resolved at the top level, the application-specific parsing could either be in the global routes.py (as now) or the app-specific version. Will it be able to do Both at the same time (for routes_in of course). I ask since certain web2py sites are scanned in google, you don't want the old links to dis-appear. Perhaps, but with some restrictions, since using / as the args separator leads to ambiguities that don't exist with ;. I'd like to be able to use standard Python libraries to do the main parsing work. Seehttp://docs.python.org/library/urlparse.html BTW, RFC2396 actually allows a ;-separated parameter on each component of the path; you could havehttp://domain.com/app;arg1/ctlr;arg2/function;arg3?query_string. I don't see a use for that in the web2py architecture, though. -Thadeus On Thu, Apr 8, 2010 at 11:30 AM, mdipierro mdipie...@cs.depaul.edu wrote: +1 On Apr 8, 11:25 am, Jonathan Lundell jlund...@pobox.com wrote: (Context: I've been working on URL parsing.) One of the difficulties that parsing web2py URLs presents is that the boundary between /a/c/f and args isn't explicit, along with the fact that pieces of /a/c/f can be implied (in particular when routes.py is being used). RFC2396 (1998) introduced (or rather extended) the notion of 'parameters', taking advantage of the fact that ';' is reserved. So the RFC2396 approach is to write: /a/c/f;parameters?query_string, or in web2py terms /a/c/f;args?vars. That is, the boundary between /a/c/f and args is marked with a semi-colon instead of a slash. Args can of course be further divided however one likes; vars is subdivided with ''. What I'm working on is an alternative to (or rather extension to) the routes.py logic that is capable of supporting arbitrary encoding where appropriate (especially in args and vars) and that does not rely on regexes to do the work. The present scheme would remain in place. Which brings me to my question: I'd like to use the ';' convention to separate /a/c/f from args in this new regime. Does anyone have any strong feelings about it one way or the other? (One last thing: the architecture would be somewhat modular, so that besides the current mechanism and the one I'm describing, it would be fairly straightforward to introduce new ones.) -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group
Re: [web2py] Re: web2py URLs
Just as long as its a variable we have to flag on, and web2py continues to work like it always has :) -Thadeus On Fri, Apr 9, 2010 at 10:17 AM, Jonathan Lundell jlund...@pobox.com wrote: On Apr 9, 2010, at 6:16 AM, DenesL wrote: I like the semicolon idea. But doesn't it imply changing web2py, anywhere where args and vars are used, like the URL function?. The URL function, yes, because it's basically the rewrite-out handler. Nobody else should care, because the fields have already been split, unless an application is using the original URL. WRT handling missing defaults from a URL (a/c/f), I realized the other day that it's best to look at it starting with the routes-out side, URL(), and making the routes-in side complement it. I think that's conceptually simpler than the implied routes.py approach of managing routes-in and then figuring out the routes-out complement. Maybe that's just me... On Apr 8, 2:22 pm, mdipierro mdipie...@cs.depaul.edu wrote: I think if ; is present it be used by default to delimit the args since there cannot be confusion there /a/c/f.ext;a0/a1/a2 /a/c/f/a0/a1/a2.ext should be parsed in the same way. routes_in and routes_out should not be affected since they only rewrite the URL before web2py interprets it. On Apr 8, 12:43 pm, Thadeus Burgess thade...@thadeusb.com wrote: I just want it to be able to routes_in on both with ; and without ;. This is because my blog is indexed on google, and I want my old links to still work If I moved over to the ; method. -Thadeus On Thu, Apr 8, 2010 at 11:56 AM, Jonathan Lundell jlund...@pobox.com wrote: On Apr 8, 2010, at 9:37 AM, Thadeus Burgess wrote: How will we be able to configure to use one or the other? I'm thinking an alternative variable in routes.py. Also, there would be (I think) a provision for application-specific routes.py files, so once the application is resolved at the top level, the application-specific parsing could either be in the global routes.py (as now) or the app-specific version. Will it be able to do Both at the same time (for routes_in of course). I ask since certain web2py sites are scanned in google, you don't want the old links to dis-appear. Perhaps, but with some restrictions, since using / as the args separator leads to ambiguities that don't exist with ;. I'd like to be able to use standard Python libraries to do the main parsing work. Seehttp://docs.python.org/library/urlparse.html BTW, RFC2396 actually allows a ;-separated parameter on each component of the path; you could havehttp://domain.com/app;arg1/ctlr;arg2/function;arg3?query_string. I don't see a use for that in the web2py architecture, though. -Thadeus On Thu, Apr 8, 2010 at 11:30 AM, mdipierro mdipie...@cs.depaul.edu wrote: +1 On Apr 8, 11:25 am, Jonathan Lundell jlund...@pobox.com wrote: (Context: I've been working on URL parsing.) One of the difficulties that parsing web2py URLs presents is that the boundary between /a/c/f and args isn't explicit, along with the fact that pieces of /a/c/f can be implied (in particular when routes.py is being used). RFC2396 (1998) introduced (or rather extended) the notion of 'parameters', taking advantage of the fact that ';' is reserved. So the RFC2396 approach is to write: /a/c/f;parameters?query_string, or in web2py terms /a/c/f;args?vars. That is, the boundary between /a/c/f and args is marked with a semi-colon instead of a slash. Args can of course be further divided however one likes; vars is subdivided with ''. What I'm working on is an alternative to (or rather extension to) the routes.py logic that is capable of supporting arbitrary encoding where appropriate (especially in args and vars) and that does not rely on regexes to do the work. The present scheme would remain in place. Which brings me to my question: I'd like to use the ';' convention to separate /a/c/f from args in this new regime. Does anyone have any strong feelings about it one way or the other? (One last thing: the architecture would be somewhat modular, so that besides the current mechanism and the one I'm describing, it would be fairly straightforward to introduce new ones.) -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google
[web2py] Yet another site to add to the list of sites running web2py....
http://whodunitballoons.com I have had a lot of freedom making this one. I am so excited about it I wanted to show it before it was done. You guys can keep an eye on it in the future if you like. My sister does balloons, and really cool ones at that. We are now starting to finallize the small design changes and add content. My favorite part was making the balloons fly away and watching the owl! Keep your eye out for more updates later. And if your wanting, you can use my sisters services if your in the Portland Oregon US area. :D I have so many sites under the same hosting, but they are all running under their own web2py instance. And they tell me FCGI is bad in apache, but I have no clue how to do it any other way as of yet. mmm o/o - Best Regards, Jason Brower -- To unsubscribe, reply using remove me as the subject.
[web2py] DAL for ldap
Hello, I want to build a user interface for some tasks in a ldap backend (eDirectory). Actually i am using the python ldap module within web2py. This is working, but i miss some features from the DAL. I was using web2py in some projects and was surprised how straight forward things can be implemented. Specially all the database stuff with the dal. Is there anyone who tried to extend the dal to support ldap as a backend database system ? This would be very helpful, if i could work with a ldap database backend system equally as a SQL based Database within web2py. Stefan
Re: [web2py] Re: web2py URLs
On Apr 9, 2010, at 8:25 AM, Thadeus Burgess wrote: Just as long as its a variable we have to flag on, and web2py continues to work like it always has :) That's the plan. -Thadeus On Fri, Apr 9, 2010 at 10:17 AM, Jonathan Lundell jlund...@pobox.com wrote: On Apr 9, 2010, at 6:16 AM, DenesL wrote: I like the semicolon idea. But doesn't it imply changing web2py, anywhere where args and vars are used, like the URL function?. The URL function, yes, because it's basically the rewrite-out handler. Nobody else should care, because the fields have already been split, unless an application is using the original URL. WRT handling missing defaults from a URL (a/c/f), I realized the other day that it's best to look at it starting with the routes-out side, URL(), and making the routes-in side complement it. I think that's conceptually simpler than the implied routes.py approach of managing routes-in and then figuring out the routes-out complement. Maybe that's just me... On Apr 8, 2:22 pm, mdipierro mdipie...@cs.depaul.edu wrote: I think if ; is present it be used by default to delimit the args since there cannot be confusion there /a/c/f.ext;a0/a1/a2 /a/c/f/a0/a1/a2.ext should be parsed in the same way. routes_in and routes_out should not be affected since they only rewrite the URL before web2py interprets it. On Apr 8, 12:43 pm, Thadeus Burgess thade...@thadeusb.com wrote: I just want it to be able to routes_in on both with ; and without ;. This is because my blog is indexed on google, and I want my old links to still work If I moved over to the ; method. -Thadeus On Thu, Apr 8, 2010 at 11:56 AM, Jonathan Lundell jlund...@pobox.com wrote: On Apr 8, 2010, at 9:37 AM, Thadeus Burgess wrote: How will we be able to configure to use one or the other? I'm thinking an alternative variable in routes.py. Also, there would be (I think) a provision for application-specific routes.py files, so once the application is resolved at the top level, the application-specific parsing could either be in the global routes.py (as now) or the app-specific version. Will it be able to do Both at the same time (for routes_in of course). I ask since certain web2py sites are scanned in google, you don't want the old links to dis-appear. Perhaps, but with some restrictions, since using / as the args separator leads to ambiguities that don't exist with ;. I'd like to be able to use standard Python libraries to do the main parsing work. Seehttp://docs.python.org/library/urlparse.html BTW, RFC2396 actually allows a ;-separated parameter on each component of the path; you could havehttp://domain.com/app;arg1/ctlr;arg2/function;arg3?query_string. I don't see a use for that in the web2py architecture, though. -Thadeus On Thu, Apr 8, 2010 at 11:30 AM, mdipierro mdipie...@cs.depaul.edu wrote: +1 On Apr 8, 11:25 am, Jonathan Lundell jlund...@pobox.com wrote: (Context: I've been working on URL parsing.) One of the difficulties that parsing web2py URLs presents is that the boundary between /a/c/f and args isn't explicit, along with the fact that pieces of /a/c/f can be implied (in particular when routes.py is being used). RFC2396 (1998) introduced (or rather extended) the notion of 'parameters', taking advantage of the fact that ';' is reserved. So the RFC2396 approach is to write: /a/c/f;parameters?query_string, or in web2py terms /a/c/f;args?vars. That is, the boundary between /a/c/f and args is marked with a semi-colon instead of a slash. Args can of course be further divided however one likes; vars is subdivided with ''. What I'm working on is an alternative to (or rather extension to) the routes.py logic that is capable of supporting arbitrary encoding where appropriate (especially in args and vars) and that does not rely on regexes to do the work. The present scheme would remain in place. Which brings me to my question: I'd like to use the ';' convention to separate /a/c/f from args in this new regime. Does anyone have any strong feelings about it one way or the other? (One last thing: the architecture would be somewhat modular, so that besides the current mechanism and the one I'm describing, it would be fairly straightforward to introduce new ones.) -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group
[web2py] Re: auth.settings.actions_disabled.append('register')
you meant to avoid 404 page? mmh, It does not seem to work..maybe I misunderstood. carlo On 9 Apr, 17:07, mdipierro mdipie...@cs.depaul.edu wrote: You can set auth.settings.on_failed_authorization = URL(...) -- To unsubscribe, reply using remove me as the subject.
[web2py] Helpful web2py gedit snippets
Just some python snippets for html, to be used with web2py templates. {tab -- {{python code}} =tab -- {{=python variable}} iftab -- {{ if condition: code pass }} fortab -- {{ for i in obj: code pass }} -Thadeus -- To unsubscribe, reply using remove me as the subject. html.web2py.snippets.gedit.tar.gz Description: GNU Zip compressed data
Re: [web2py] Yet another site to add to the list of sites running web2py....
That is cool! -Thadeus On Fri, Apr 9, 2010 at 10:25 AM, Jason Brower encomp...@gmail.com wrote: http://whodunitballoons.com I have had a lot of freedom making this one. I am so excited about it I wanted to show it before it was done. You guys can keep an eye on it in the future if you like. My sister does balloons, and really cool ones at that. We are now starting to finallize the small design changes and add content. My favorite part was making the balloons fly away and watching the owl! Keep your eye out for more updates later. And if your wanting, you can use my sisters services if your in the Portland Oregon US area. :D I have so many sites under the same hosting, but they are all running under their own web2py instance. And they tell me FCGI is bad in apache, but I have no clue how to do it any other way as of yet. mmm o/o - Best Regards, Jason Brower -- To unsubscribe, reply using remove me as the subject.
[web2py] Our membership is steadily growing!
All: We know what a wonderful web framework Web2Py is and I just looked at our group membership. Our membership numbers are growing steadily and I can't wait till we hit the threshold of rapid acceptance. This is really great since Web2Py does not have the marketing other Python web frame works have. Congratulations to a great community and project. I love Web2Py. :-) Regards, Christopher -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: Yet another site to add to the list of sites running web2py....
How wonderfully whimsical (and appropriate for the business) Of course, for here, I hope you'll have something to say about developing this ;-) On Apr 9, 11:05 am, Thadeus Burgess thade...@thadeusb.com wrote: That is cool! -Thadeus On Fri, Apr 9, 2010 at 10:25 AM, Jason Brower encomp...@gmail.com wrote: http://whodunitballoons.com I have had a lot of freedom making this one. I am so excited about it I wanted to show it before it was done. You guys can keep an eye on it in the future if you like. My sister does balloons, and really cool ones at that. We are now starting to finallize the small design changes and add content. My favorite part was making the balloons fly away and watching the owl! Keep your eye out for more updates later. And if your wanting, you can use my sisters services if your in the Portland Oregon US area. :D I have so many sites under the same hosting, but they are all running under their own web2py instance. And they tell me FCGI is bad in apache, but I have no clue how to do it any other way as of yet. mmm o/o - Best Regards, Jason Brower -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: Our membership is steadily growing!
Yes. Thank you everybody here. I can tell from a number of informal indicators that more and more people are looking into web2py and like it. Project for the summer: manual 3rd edition. On Apr 9, 11:59 am, cesmiga cesm...@gmail.com wrote: All: We know what a wonderful web framework Web2Py is and I just looked at our group membership. Our membership numbers are growing steadily and I can't wait till we hit the threshold of rapid acceptance. This is really great since Web2Py does not have the marketing other Python web frame works have. Congratulations to a great community and project. I love Web2Py. :-) Regards, Christopher -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: Yet another site to add to the list of sites running web2py....
I will show it to my son when he is back from school. :-) On Apr 9, 10:25 am, Jason Brower encomp...@gmail.com wrote: http://whodunitballoons.com I have had a lot of freedom making this one. I am so excited about it I wanted to show it before it was done. You guys can keep an eye on it in the future if you like. My sister does balloons, and really cool ones at that. We are now starting to finallize the small design changes and add content. My favorite part was making the balloons fly away and watching the owl! Keep your eye out for more updates later. And if your wanting, you can use my sisters services if your in the Portland Oregon US area. :D I have so many sites under the same hosting, but they are all running under their own web2py instance. And they tell me FCGI is bad in apache, but I have no clue how to do it any other way as of yet. mmm o/o - Best Regards, Jason Brower -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: Our membership is steadily growing!
Time to start planning web2pycon? :) On Apr 9, 12:58 pm, mdipierro mdipie...@cs.depaul.edu wrote: Yes. Thank you everybody here. I can tell from a number of informal indicators that more and more people are looking into web2py and like it. Project for the summer: manual 3rd edition. On Apr 9, 11:59 am, cesmiga cesm...@gmail.com wrote: All: We know what a wonderful web framework Web2Py is and I just looked at our group membership. Our membership numbers are growing steadily and I can't wait till we hit the threshold of rapid acceptance. This is really great since Web2Py does not have the marketing other Python web frame works have. Congratulations to a great community and project. I love Web2Py. :-) Regards, Christopher -- To unsubscribe, reply using remove me as the subject.
[web2py] Old versions of web2py
Is there a place where I could download older versions of web2py? Source version. I get still problems with the new version and can´t understand why. So I thought that by trying to upgrade one version a time I could maybe find out whats the problem. Kenneth -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: Old versions of web2py
http://web2py.com/examples/static/xxx/web2py_src.zip xxx is one of 1.67.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.68.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.71.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.72.3: web2py_osx.zip web2py_src.zip web2py_win.zip 1.73.1: web2py_osx.zip web2py_src.zip web2py_win.zip 1.74.11: web2py_osx.zip web2py_src.zip web2py_win.zip 1.74.9: web2py_osx.zip web2py_src.zip web2py_win.zip 1.75.4: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.1: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.3: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.4: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5.1.b: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5.2.b: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5.3.b: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5b: web2py_osx.zip web2py_src.zip web2py_win.zip On Apr 9, 1:25 pm, Kenneth kenneth.t.lundst...@gmail.com wrote: Is there a place where I could download older versions of web2py? Source version. I get still problems with the new version and can´t understand why. So I thought that by trying to upgrade one version a time I could maybe find out whats the problem. Kenneth -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename
db.table.field.sum().with_alias() Traceback (most recent call last): File /home/tburgess/Applications/web2py/gluon/restricted.py, line 173, in restricted exec ccode in environment File /home/tburgess/Applications/web2py/applications/pms/controllers/default.py, line 305, in module File /home/tburgess/Applications/web2py/gluon/globals.py, line 96, in lambda self._caller = lambda f: f() File /home/tburgess/Applications/web2py/applications/pms/models/db.py, line 277, in current_R return db(db.R.id == RID).select(db.R.sum().with_alias('current_R')).first().current_R File /home/tburgess/Applications/web2py/gluon/sql.py, line 3276, in select return self._db._adapter.select(self._query,*fields,**attributes) File /home/tburgess/Applications/web2py/gluon/sql.py, line 514, in select rows = response(query) File /home/tburgess/Applications/web2py/gluon/sql.py, line 505, in response self.execute(query) File /home/tburgess/Applications/web2py/gluon/sql.py, line 589, in execute return self.log_execute(*a, **b) File /home/tburgess/Applications/web2py/gluon/sql.py, line 583, in log_execute ret = self.cursor.execute(*a,**b) OperationalError: near AS: syntax error -Thadeus On Thu, Apr 8, 2010 at 2:57 PM, Thadeus Burgess thade...@thadeusb.com wrote: Massimo, I am attaching a application that can replicate this issue. Works fine on sql.py Breaks on dal.py This application is designed after my big application, the represent functions HAVE to stay the same, there cannot be ANY code edits to them! Make sure to run with sql.py first to confirm that it IS working correctly. THEN copy dal.py to sql.py, restart web2py, and then confirm that it no longer works. -Thadeus On Thu, Apr 8, 2010 at 10:12 AM, Thadeus Burgess thade...@thadeusb.com wrote: Agreed. Lets narrow this down, I will see if I can replicate the issue on a smaller scale. -Thadeus On Wed, Apr 7, 2010 at 11:08 PM, Massimo Di Pierro mdipie...@cs.depaul.edu wrote: I guess my question is why does it not throw an exception in sql.py? It should since db.dog.owner.represent = lambda value: %s % db.person[value].name when called with value==None should always result in the error you see in dal.py. Can you help me debug this? My problem is not why it does not work with dal.py (that is the part I understand). My problem is how is it that it works with sql.py? On Apr 7, 2010, at 10:58 PM, Thadeus Burgess wrote: I am not using different datasets, or using different queries. So here we go, let me explain in every minuet detail this process. cd ~ hg clone https://web2py.googlecode.com/hg web2py cd web2py ln -s ~/path/to/my/application applications/pms python web2py.py -a recycle *go to 127.0.0.1:8000/pms/default/index *everything works perfectly, I see the page as it should be with records in place, providing the proper names (this is only three records, I KNOW they have values) kill -SIGTERM web2py process id cd gluon/ mv sql.py sql.bak.py ln -s dal.py sql.py cd .. python web2py.py -a recycle *go to 127.0.0.1:8000/pms/default/index *receive stacktrace. kill -SIGTERM web2py process id cd gluon/ rm sql.py mv sql.bak.py sql.py cd .. python web2py.py -a recycle *go to 127.0.0.1:8000/pms/default/index *behold, everything works perfectly. Even IF, and I say IF my dataset has a bad reference to a None record, and it executes just fine with sql.py, it should execute with dal.py exactly the same, it should not be throwing the exception. -Thadeus On Wed, Apr 7, 2010 at 10:10 PM, Massimo Di Pierro mdipie...@cs.depaul.edu wrote: I assume it is db.dog.owner.represent = lambda value: %s % db.person[value].name The stacktrace you get is because one of your records has owner==None hence db.person[value] is also None and None has no .name. It is not a bug. You are doing different queries or using different datasets. Anyway if you do db.define_table('person', Field('name'), format='%(name)s') db.define_table('dog', Field('nickname'), Field('owner', db.person)) the requires is set automatically and should take care of this exception. On Apr 7, 2010, at 10:01 PM, Thadeus Burgess wrote: I am defining this function. db.define_table('person', Field('name')) db.define_table('dog', Field('nickname'), Field('owner', db.person)) db.dog.owner.represent = lambda value: %s % db.owner[value].name This works in sql.py This does not work in dal.py You said you made changes, I tested, works just fine on sql.py, and has been for quite a while, however I get that stacktrace when I use dal.py. -Thadeus On Wed, Apr 7, 2010 at 8:34 PM, mdipierro mdipie...@cs.depaul.edu wrote: I guess I do not understand. Who defined this represent function? is it not in your code? Are you saying this is a bug in sql.py? On Apr 7, 7:48 pm, Thadeus Burgess thade...@thadeusb.com wrote: No. For dal.py to be accepted it has to work exactly
[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename
This db.table.field.sum().with_alias() is invalid syntax. You need to give it a name db.table.field.sum().with_alias('thesum') On Apr 9, 1:43 pm, Thadeus Burgess thade...@thadeusb.com wrote: db.table.field.sum().with_alias() Traceback (most recent call last): File /home/tburgess/Applications/web2py/gluon/restricted.py, line 173, in restricted exec ccode in environment File /home/tburgess/Applications/web2py/applications/pms/controllers/default.py, line 305, in module File /home/tburgess/Applications/web2py/gluon/globals.py, line 96, in lambda self._caller = lambda f: f() File /home/tburgess/Applications/web2py/applications/pms/models/db.py, line 277, in current_R return db(db.R.id == RID).select(db.R.sum().with_alias('current_R')).first().current_R File /home/tburgess/Applications/web2py/gluon/sql.py, line 3276, in select return self._db._adapter.select(self._query,*fields,**attributes) File /home/tburgess/Applications/web2py/gluon/sql.py, line 514, in select rows = response(query) File /home/tburgess/Applications/web2py/gluon/sql.py, line 505, in response self.execute(query) File /home/tburgess/Applications/web2py/gluon/sql.py, line 589, in execute return self.log_execute(*a, **b) File /home/tburgess/Applications/web2py/gluon/sql.py, line 583, in log_execute ret = self.cursor.execute(*a,**b) OperationalError: near AS: syntax error -Thadeus On Thu, Apr 8, 2010 at 2:57 PM, Thadeus Burgess thade...@thadeusb.com wrote: Massimo, I am attaching a application that can replicate this issue. Works fine on sql.py Breaks on dal.py This application is designed after my big application, the represent functions HAVE to stay the same, there cannot be ANY code edits to them! Make sure to run with sql.py first to confirm that it IS working correctly. THEN copy dal.py to sql.py, restart web2py, and then confirm that it no longer works. -Thadeus On Thu, Apr 8, 2010 at 10:12 AM, Thadeus Burgess thade...@thadeusb.com wrote: Agreed. Lets narrow this down, I will see if I can replicate the issue on a smaller scale. -Thadeus On Wed, Apr 7, 2010 at 11:08 PM, Massimo Di Pierro mdipie...@cs.depaul.edu wrote: I guess my question is why does it not throw an exception in sql.py? It should since db.dog.owner.represent = lambda value: %s % db.person[value].name when called with value==None should always result in the error you see in dal.py. Can you help me debug this? My problem is not why it does not work with dal.py (that is the part I understand). My problem is how is it that it works with sql.py? On Apr 7, 2010, at 10:58 PM, Thadeus Burgess wrote: I am not using different datasets, or using different queries. So here we go, let me explain in every minuet detail this process. cd ~ hg clonehttps://web2py.googlecode.com/hgweb2py cd web2py ln -s ~/path/to/my/application applications/pms python web2py.py -a recycle *go to 127.0.0.1:8000/pms/default/index *everything works perfectly, I see the page as it should be with records in place, providing the proper names (this is only three records, I KNOW they have values) kill -SIGTERM web2py process id cd gluon/ mv sql.py sql.bak.py ln -s dal.py sql.py cd .. python web2py.py -a recycle *go to 127.0.0.1:8000/pms/default/index *receive stacktrace. kill -SIGTERM web2py process id cd gluon/ rm sql.py mv sql.bak.py sql.py cd .. python web2py.py -a recycle *go to 127.0.0.1:8000/pms/default/index *behold, everything works perfectly. Even IF, and I say IF my dataset has a bad reference to a None record, and it executes just fine with sql.py, it should execute with dal.py exactly the same, it should not be throwing the exception. -Thadeus On Wed, Apr 7, 2010 at 10:10 PM, Massimo Di Pierro mdipie...@cs.depaul.edu wrote: I assume it is db.dog.owner.represent = lambda value: %s % db.person[value].name The stacktrace you get is because one of your records has owner==None hence db.person[value] is also None and None has no .name. It is not a bug. You are doing different queries or using different datasets. Anyway if you do db.define_table('person', Field('name'), format='%(name)s') db.define_table('dog', Field('nickname'), Field('owner', db.person)) the requires is set automatically and should take care of this exception. On Apr 7, 2010, at 10:01 PM, Thadeus Burgess wrote: I am defining this function. db.define_table('person', Field('name')) db.define_table('dog', Field('nickname'), Field('owner', db.person)) db.dog.owner.represent = lambda value: %s % db.owner[value].name This works in sql.py This does not work in dal.py You said you made changes, I tested, works just fine on sql.py, and has been for quite a while, however I get that stacktrace when I use dal.py. -Thadeus On Wed, Apr 7, 2010 at 8:34 PM, mdipierro
[web2py] Re: Old versions of web2py
On Apr 9, 2:09 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: Massimo: I don't see that you have checkins in your Makefile, but if you made a release that used your mdp entry - that is, after hg commit, but before hg push, add something like this in what you do: hg tag $(cat VERSION | python -c 'import sys; print sys.stdin.readline().split()[1]') (or whatever way you want to get that 1.76.5 part out of the VERSION file). Just to be clear: For this to be useful, it would have to be for released versions; You could also come up with some other convention, such as released versions starting with R, e.g. R-1.76.5 The point is to TAG actual releases in some useful way in the repository. This would allow people to see what changed since a release in the repository browser (as well as checkout specific versions, and make tests). Regards, - Yarko On Apr 9, 1:29 pm, mdipierro mdipie...@cs.depaul.edu wrote: http://web2py.com/examples/static/xxx/web2py_src.zip xxx is one of 1.67.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.68.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.71.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.72.3: web2py_osx.zip web2py_src.zip web2py_win.zip 1.73.1: web2py_osx.zip web2py_src.zip web2py_win.zip 1.74.11: web2py_osx.zip web2py_src.zip web2py_win.zip 1.74.9: web2py_osx.zip web2py_src.zip web2py_win.zip 1.75.4: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.1: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.3: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.4: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5.1.b: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5.2.b: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5.3.b: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5b: web2py_osx.zip web2py_src.zip web2py_win.zip On Apr 9, 1:25 pm, Kenneth kenneth.t.lundst...@gmail.com wrote: Is there a place where I could download older versions of web2py? Source version. I get still problems with the new version and can´t understand why. So I thought that by trying to upgrade one version a time I could maybe find out whats the problem. Kenneth -- To unsubscribe, reply using remove me as the subject.
Re: [web2py] Re: bug in dal.py _first() and SQLFORM ._tablename
I do give it a name. In this case the name is 'current_R'. I just typed the line of code that caused the error to help you narrow it down, I am sorry I did not copy/paste instead of quickly typing it. The code is correct, I don't edit anything when I test it on dal.py By the way, the trackback says sql.py but it is really a softlink to dal.py. -Thadeus On Fri, Apr 9, 2010 at 2:04 PM, mdipierro mdipie...@cs.depaul.edu wrote: This db.table.field.sum().with_alias() is invalid syntax. You need to give it a name db.table.field.sum().with_alias('thesum') On Apr 9, 1:43 pm, Thadeus Burgess thade...@thadeusb.com wrote: db.table.field.sum().with_alias() Traceback (most recent call last): File /home/tburgess/Applications/web2py/gluon/restricted.py, line 173, in restricted exec ccode in environment File /home/tburgess/Applications/web2py/applications/pms/controllers/default.py, line 305, in module File /home/tburgess/Applications/web2py/gluon/globals.py, line 96, in lambda self._caller = lambda f: f() File /home/tburgess/Applications/web2py/applications/pms/models/db.py, line 277, in current_R return db(db.R.id == RID).select(db.R.sum().with_alias('current_R')).first().current_R File /home/tburgess/Applications/web2py/gluon/sql.py, line 3276, in select return self._db._adapter.select(self._query,*fields,**attributes) File /home/tburgess/Applications/web2py/gluon/sql.py, line 514, in select rows = response(query) File /home/tburgess/Applications/web2py/gluon/sql.py, line 505, in response self.execute(query) File /home/tburgess/Applications/web2py/gluon/sql.py, line 589, in execute return self.log_execute(*a, **b) File /home/tburgess/Applications/web2py/gluon/sql.py, line 583, in log_execute ret = self.cursor.execute(*a,**b) OperationalError: near AS: syntax error -Thadeus On Thu, Apr 8, 2010 at 2:57 PM, Thadeus Burgess thade...@thadeusb.com wrote: Massimo, I am attaching a application that can replicate this issue. Works fine on sql.py Breaks on dal.py This application is designed after my big application, the represent functions HAVE to stay the same, there cannot be ANY code edits to them! Make sure to run with sql.py first to confirm that it IS working correctly. THEN copy dal.py to sql.py, restart web2py, and then confirm that it no longer works. -Thadeus On Thu, Apr 8, 2010 at 10:12 AM, Thadeus Burgess thade...@thadeusb.com wrote: Agreed. Lets narrow this down, I will see if I can replicate the issue on a smaller scale. -Thadeus On Wed, Apr 7, 2010 at 11:08 PM, Massimo Di Pierro mdipie...@cs.depaul.edu wrote: I guess my question is why does it not throw an exception in sql.py? It should since db.dog.owner.represent = lambda value: %s % db.person[value].name when called with value==None should always result in the error you see in dal.py. Can you help me debug this? My problem is not why it does not work with dal.py (that is the part I understand). My problem is how is it that it works with sql.py? On Apr 7, 2010, at 10:58 PM, Thadeus Burgess wrote: I am not using different datasets, or using different queries. So here we go, let me explain in every minuet detail this process. cd ~ hg clonehttps://web2py.googlecode.com/hgweb2py cd web2py ln -s ~/path/to/my/application applications/pms python web2py.py -a recycle *go to 127.0.0.1:8000/pms/default/index *everything works perfectly, I see the page as it should be with records in place, providing the proper names (this is only three records, I KNOW they have values) kill -SIGTERM web2py process id cd gluon/ mv sql.py sql.bak.py ln -s dal.py sql.py cd .. python web2py.py -a recycle *go to 127.0.0.1:8000/pms/default/index *receive stacktrace. kill -SIGTERM web2py process id cd gluon/ rm sql.py mv sql.bak.py sql.py cd .. python web2py.py -a recycle *go to 127.0.0.1:8000/pms/default/index *behold, everything works perfectly. Even IF, and I say IF my dataset has a bad reference to a None record, and it executes just fine with sql.py, it should execute with dal.py exactly the same, it should not be throwing the exception. -Thadeus On Wed, Apr 7, 2010 at 10:10 PM, Massimo Di Pierro mdipie...@cs.depaul.edu wrote: I assume it is db.dog.owner.represent = lambda value: %s % db.person[value].name The stacktrace you get is because one of your records has owner==None hence db.person[value] is also None and None has no .name. It is not a bug. You are doing different queries or using different datasets. Anyway if you do db.define_table('person', Field('name'), format='%(name)s') db.define_table('dog', Field('nickname'), Field('owner', db.person)) the requires is set automatically and should take care of this exception. On Apr 7, 2010, at 10:01 PM, Thadeus Burgess wrote: I am defining this
Re: [web2py] Re: Our membership is steadily growing!
I would love that! - Original message - Time to start planning web2pycon? :) On Apr 9, 12:58 pm, mdipierro mdipie...@cs.depaul.edu wrote: Yes. Thank you everybody here. I can tell from a number of informal indicators that more and more people are looking into web2py and like it. Project for the summer: manual 3rd edition. On Apr 9, 11:59 am, cesmiga cesm...@gmail.com wrote: All: We know what a wonderful web framework Web2Py is and I just looked at our group membership. Our membership numbers are growing steadily and I can't wait till we hit the threshold of rapid acceptance. This is really great since Web2Py does not have the marketing other Python web frame works have. Congratulations to a great community and project. I love Web2Py. :-) Regards, Christopher -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: bug in dal.py _first() and SQLFORM ._tablename
will look into this. On Apr 9, 2:14 pm, Thadeus Burgess thade...@thadeusb.com wrote: I do give it a name. In this case the name is 'current_R'. I just typed the line of code that caused the error to help you narrow it down, I am sorry I did not copy/paste instead of quickly typing it. The code is correct, I don't edit anything when I test it on dal.py By the way, the trackback says sql.py but it is really a softlink to dal.py. -Thadeus On Fri, Apr 9, 2010 at 2:04 PM, mdipierro mdipie...@cs.depaul.edu wrote: This db.table.field.sum().with_alias() is invalid syntax. You need to give it a name db.table.field.sum().with_alias('thesum') On Apr 9, 1:43 pm, Thadeus Burgess thade...@thadeusb.com wrote: db.table.field.sum().with_alias() Traceback (most recent call last): File /home/tburgess/Applications/web2py/gluon/restricted.py, line 173, in restricted exec ccode in environment File /home/tburgess/Applications/web2py/applications/pms/controllers/default.py, line 305, in module File /home/tburgess/Applications/web2py/gluon/globals.py, line 96, in lambda self._caller = lambda f: f() File /home/tburgess/Applications/web2py/applications/pms/models/db.py, line 277, in current_R return db(db.R.id == RID).select(db.R.sum().with_alias('current_R')).first().current_R File /home/tburgess/Applications/web2py/gluon/sql.py, line 3276, in select return self._db._adapter.select(self._query,*fields,**attributes) File /home/tburgess/Applications/web2py/gluon/sql.py, line 514, in select rows = response(query) File /home/tburgess/Applications/web2py/gluon/sql.py, line 505, in response self.execute(query) File /home/tburgess/Applications/web2py/gluon/sql.py, line 589, in execute return self.log_execute(*a, **b) File /home/tburgess/Applications/web2py/gluon/sql.py, line 583, in log_execute ret = self.cursor.execute(*a,**b) OperationalError: near AS: syntax error -Thadeus On Thu, Apr 8, 2010 at 2:57 PM, Thadeus Burgess thade...@thadeusb.com wrote: Massimo, I am attaching a application that can replicate this issue. Works fine on sql.py Breaks on dal.py This application is designed after my big application, the represent functions HAVE to stay the same, there cannot be ANY code edits to them! Make sure to run with sql.py first to confirm that it IS working correctly. THEN copy dal.py to sql.py, restart web2py, and then confirm that it no longer works. -Thadeus On Thu, Apr 8, 2010 at 10:12 AM, Thadeus Burgess thade...@thadeusb.com wrote: Agreed. Lets narrow this down, I will see if I can replicate the issue on a smaller scale. -Thadeus On Wed, Apr 7, 2010 at 11:08 PM, Massimo Di Pierro mdipie...@cs.depaul.edu wrote: I guess my question is why does it not throw an exception in sql.py? It should since db.dog.owner.represent = lambda value: %s % db.person[value].name when called with value==None should always result in the error you see in dal.py. Can you help me debug this? My problem is not why it does not work with dal.py (that is the part I understand). My problem is how is it that it works with sql.py? On Apr 7, 2010, at 10:58 PM, Thadeus Burgess wrote: I am not using different datasets, or using different queries. So here we go, let me explain in every minuet detail this process. cd ~ hg clonehttps://web2py.googlecode.com/hgweb2py cd web2py ln -s ~/path/to/my/application applications/pms python web2py.py -a recycle *go to 127.0.0.1:8000/pms/default/index *everything works perfectly, I see the page as it should be with records in place, providing the proper names (this is only three records, I KNOW they have values) kill -SIGTERM web2py process id cd gluon/ mv sql.py sql.bak.py ln -s dal.py sql.py cd .. python web2py.py -a recycle *go to 127.0.0.1:8000/pms/default/index *receive stacktrace. kill -SIGTERM web2py process id cd gluon/ rm sql.py mv sql.bak.py sql.py cd .. python web2py.py -a recycle *go to 127.0.0.1:8000/pms/default/index *behold, everything works perfectly. Even IF, and I say IF my dataset has a bad reference to a None record, and it executes just fine with sql.py, it should execute with dal.py exactly the same, it should not be throwing the exception. -Thadeus On Wed, Apr 7, 2010 at 10:10 PM, Massimo Di Pierro mdipie...@cs.depaul.edu wrote: I assume it is db.dog.owner.represent = lambda value: %s % db.person[value].name The stacktrace you get is because one of your records has owner==None hence db.person[value] is also None and None has no .name. It is not a bug. You are doing different queries or using different datasets. Anyway if you do db.define_table('person', Field('name'), format='%(name)s') db.define_table('dog',
[web2py] Re: Old versions of web2py
I did follow the advice you gave me some time ago: https://www.web2py.com/examples/default/changelog On Apr 9, 2:11 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 9, 2:09 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: Massimo: I don't see that you have checkins in your Makefile, but if you made a release that used your mdp entry - that is, after hg commit, but before hg push, add something like this in what you do: hg tag $(cat VERSION | python -c 'import sys; print sys.stdin.readline().split()[1]') (or whatever way you want to get that 1.76.5 part out of the VERSION file). Just to be clear: For this to be useful, it would have to be for released versions; You could also come up with some other convention, such as released versions starting with R, e.g. R-1.76.5 The point is to TAG actual releases in some useful way in the repository. This would allow people to see what changed since a release in the repository browser (as well as checkout specific versions, and make tests). Regards, - Yarko On Apr 9, 1:29 pm, mdipierro mdipie...@cs.depaul.edu wrote: http://web2py.com/examples/static/xxx/web2py_src.zip xxx is one of 1.67.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.68.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.71.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.72.3: web2py_osx.zip web2py_src.zip web2py_win.zip 1.73.1: web2py_osx.zip web2py_src.zip web2py_win.zip 1.74.11: web2py_osx.zip web2py_src.zip web2py_win.zip 1.74.9: web2py_osx.zip web2py_src.zip web2py_win.zip 1.75.4: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.1: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.3: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.4: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5.1.b: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5.2.b: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5.3.b: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5b: web2py_osx.zip web2py_src.zip web2py_win.zip On Apr 9, 1:25 pm, Kenneth kenneth.t.lundst...@gmail.com wrote: Is there a place where I could download older versions of web2py? Source version. I get still problems with the new version and can´t understand why. So I thought that by trying to upgrade one version a time I could maybe find out whats the problem. Kenneth -- To unsubscribe, reply using remove me as the subject.
[web2py] Memory usage inspection
Hi, I'm aggresively caching nearly everything.. it helped to reduce database queries and increase performance in result. But I have another problem now - memory usage slowly grows, during a day my server eats about 2 GB. If I flush cache by clear() function, it does not help much. Something it's leaking perhaps. Please, do you use any tool to inspect what a hell is in the memory? Thanks! David -- To unsubscribe, reply using remove me as the subject.
Re: [web2py] Memory usage inspection
heapy guppy can do this. If you install it, a later version of web2py appadmin has cache statistics in it using guppy-heapy, it can give you an overall feel for what kinds of objects are taking up so much memory. There are lots of other factors, such as what webserver, how are you executing web2py (fcgi, mod_wsgi, etc. etc.). This might be an issue with your server allocating the memory needed when the web2py app requests it, and not doing any sort of de-allocation when the app no longer needs it. For example, when I was comparing apache+mod_wsgi to cherokee+uwsgi, agressive caching was one of my tests to compare the memory usage. In the end after caching ~100MB of random data and then clearing it. Apache kept the reserved ram for well over several days before the ram usage went down, whereas cherokee only kept the reserved ram around for approx. 5 minutes, and then returned to normal levels. -Thadeus On Fri, Apr 9, 2010 at 4:28 PM, David Zejda d...@atlas.cz wrote: Hi, I'm aggresively caching nearly everything.. it helped to reduce database queries and increase performance in result. But I have another problem now - memory usage slowly grows, during a day my server eats about 2 GB. If I flush cache by clear() function, it does not help much. Something it's leaking perhaps. Please, do you use any tool to inspect what a hell is in the memory? Thanks! David -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: Memory usage inspection
If you have multiple processes make sure all of them call cache.ram.clear() or consider using cache.disk(). Can you give us some data about performance benefits? If you discover anything about the cause for this problem, please keep us posted. Massimo On Apr 9, 4:28 pm, David Zejda d...@atlas.cz wrote: Hi, I'm aggresively caching nearly everything.. it helped to reduce database queries and increase performance in result. But I have another problem now - memory usage slowly grows, during a day my server eats about 2 GB. If I flush cache by clear() function, it does not help much. Something it's leaking perhaps. Please, do you use any tool to inspect what a hell is in the memory? Thanks! David -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: Old versions of web2py
I tag them 1.XX.YY but I do not put the R in front. I use in fact the logs to manually extract important changes and edit the README files used to build the changelog above. Not completed automated yet. On Apr 9, 4:25 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 9, 4:16 pm, mdipierro mdipie...@cs.depaul.edu wrote: I did follow the advice you gave me some time ago: https://www.web2py.com/examples/default/changelog Ah - yes, to reverse the order of release comments (for most recent at the top); very nice... thanks I don't know what your personal process is for checkin / push, but if you tagged released versions before pushing to google code, that would be a useful marker also. Regards, - Yarko On Apr 9, 2:11 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 9, 2:09 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: Massimo: I don't see that you have checkins in your Makefile, but if you made a release that used your mdp entry - that is, after hg commit, but before hg push, add something like this in what you do: hg tag $(cat VERSION | python -c 'import sys; print sys.stdin.readline().split()[1]') (or whatever way you want to get that 1.76.5 part out of the VERSION file). Just to be clear: For this to be useful, it would have to be for released versions; You could also come up with some other convention, such as released versions starting with R, e.g. R-1.76.5 The point is to TAG actual releases in some useful way in the repository. This would allow people to see what changed since a release in the repository browser (as well as checkout specific versions, and make tests). Regards, - Yarko On Apr 9, 1:29 pm, mdipierro mdipie...@cs.depaul.edu wrote: http://web2py.com/examples/static/xxx/web2py_src.zip xxx is one of 1.67.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.68.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.71.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.72.3: web2py_osx.zip web2py_src.zip web2py_win.zip 1.73.1: web2py_osx.zip web2py_src.zip web2py_win.zip 1.74.11: web2py_osx.zip web2py_src.zip web2py_win.zip 1.74.9: web2py_osx.zip web2py_src.zip web2py_win.zip 1.75.4: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.1: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.2: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.3: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.4: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5.1.b: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5.2.b: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5.3.b: web2py_osx.zip web2py_src.zip web2py_win.zip 1.76.5b: web2py_osx.zip web2py_src.zip web2py_win.zip On Apr 9, 1:25 pm, Kenneth kenneth.t.lundst...@gmail.com wrote: Is there a place where I could download older versions of web2py? Source version. I get still problems with the new version and can´t understand why. So I thought that by trying to upgrade one version a time I could maybe find out whats the problem. Kenneth -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: LOAD and reload
Say I have a form in component A and a records display in component B. Both are loaded on a single page. How can I update the records display when the form (SQLFORM) accepts? On Apr 9, 6:19 pm, mdipierro mdipie...@cs.depaul.edu wrote: Instead of {{=LOAD('default','show_foods',ajax=True)}} do div id=mystuffimg src=...the loading indicator...//div scriptweb2py_component('{{=URL(r=request,c='default',f='show_foods')}}',' mystuff')/ script You can also have button onclick=web2py_component('{{=URL(r=request,c='default',f='show_foods')}}', 'mystuff')click me to reload/script On Apr 9, 5:07 pm, Avik Basu avikb...@gmail.com wrote: Hi, Is there a way to reload a component that has been loaded with the LOAD function without sending a request back to the server? For example, I would like to reload a list of foods whenever the data has been altered by the user, but I would like only the component to reload instead of the whole page. #in view {{=LOAD('default','show_foods',ajax=True)}} Also, is there a way to use a loading indicator icon instead of the default 'loading...' message? Thanks, Avik -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: Old versions of web2py
alternatively you could check out specific versions from the mercurial repository: http://code.google.com/p/web2py/source/checkout On Apr 10, 4:25 am, Kenneth kenneth.t.lundst...@gmail.com wrote: Is there a place where I could download older versions of web2py? Source version. I get still problems with the new version and can´t understand why. So I thought that by trying to upgrade one version a time I could maybe find out whats the problem. Kenneth -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: Old versions of web2py
On Apr 9, 7:31 pm, Richard richar...@gmail.com wrote: alternatively you could check out specific versions from the mercurial repository:http://code.google.com/p/web2py/source/checkout I just browsed through the comments, pages of commits to find 3 comments that say 1.76.4. I assume these are the release (and the latest one is it). If I have a client w/ 1.65.1, I have a lot of paging / date guessing to go thru. That is why tagging release would be a good thing, and a service to the community: I would be able to checkout by tag, and just get the right thing. If I wasn't sure of the right thing, I could check the hgtags file and see what the significant checkins (i.e. the tagged ones) were. I am surprised this even elicits discussion, alternatives, rather than simple agreement. - Yarko On Apr 10, 4:25 am, Kenneth kenneth.t.lundst...@gmail.com wrote: Is there a place where I could download older versions of web2py? Source version. I get still problems with the new version and can´t understand why. So I thought that by trying to upgrade one version a time I could maybe find out whats the problem. Kenneth -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: google app engine, file size limits
This is fantastic! On Apr 9, 5:31 pm, howesc how...@umich.edu wrote: Hi all, I implemented this today, and learned some things. I posted my version of the upload handler as a comment to the slice at:http://www.web2pyslices.com/main/slices/take_slice/63 enhancements in this version: * parse the blob_info object out of the request, no more dummy request * integrate with a table that has more information then just the file keys. * handle deletes and updates of images by removing old files from blobstore (assumes that this record is the only one that references a given file) Hope that it's helpful for people. christian -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: LOAD and reload
create js function script function update_myrecords() {web2py_component('{{=URL(r=request,c='default',f='show_foods')}}','mystuff'); }; /script then serverside if form.accepts(...): response.headers['web2py-component-command']='update_myrecords()' return form On Apr 9, 7:12 pm, Avik Basu avikb...@gmail.com wrote: Say I have a form in component A and a records display in component B. Both are loaded on a single page. How can I update the records display when the form (SQLFORM) accepts? On Apr 9, 6:19 pm, mdipierro mdipie...@cs.depaul.edu wrote: Instead of {{=LOAD('default','show_foods',ajax=True)}} do div id=mystuffimg src=...the loading indicator...//div scriptweb2py_component('{{=URL(r=request,c='default',f='show_foods')}}',' mystuff')/ script You can also have button onclick=web2py_component('{{=URL(r=request,c='default',f='show_foods')}}', 'mystuff')click me to reload/script On Apr 9, 5:07 pm, Avik Basu avikb...@gmail.com wrote: Hi, Is there a way to reload a component that has been loaded with the LOAD function without sending a request back to the server? For example, I would like to reload a list of foods whenever the data has been altered by the user, but I would like only the component to reload instead of the whole page. #in view {{=LOAD('default','show_foods',ajax=True)}} Also, is there a way to use a loading indicator icon instead of the default 'loading...' message? Thanks, Avik -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: Old versions of web2py
I need to be educated. Here is my problem. I gave myself a rule of tagging releases as 1.XX.YY. The fact is that I commit before I build the binaries. It occasionally happens that I commit 1.XX.YY, build the binary and then I discover a problem (for example a file was missing because I forgot to hg add it). So I make the change and I commit again with the same tag. I can put the R in front as you suggest but this is not going to avoid this occasional problem. In the recent times I have automated the build process of binaries and these errors are going to be minimized if not disappear and release tags will be unique as you suggest. Massimo On Apr 9, 7:52 pm, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: On Apr 9, 7:31 pm, Richard richar...@gmail.com wrote: alternatively you could check out specific versions from the mercurial repository:http://code.google.com/p/web2py/source/checkout I just browsed through the comments, pages of commits to find 3 comments that say 1.76.4. I assume these are the release (and the latest one is it). If I have a client w/ 1.65.1, I have a lot of paging / date guessing to go thru. That is why tagging release would be a good thing, and a service to the community: I would be able to checkout by tag, and just get the right thing. If I wasn't sure of the right thing, I could check the hgtags file and see what the significant checkins (i.e. the tagged ones) were. I am surprised this even elicits discussion, alternatives, rather than simple agreement. - Yarko On Apr 10, 4:25 am, Kenneth kenneth.t.lundst...@gmail.com wrote: Is there a place where I could download older versions of web2py? Source version. I get still problems with the new version and can´t understand why. So I thought that by trying to upgrade one version a time I could maybe find out whats the problem. Kenneth -- To unsubscribe, reply using remove me as the subject.