[web2py:19126] Re: important about ajax forms
These might be some additional requirements (let me know what you think): 5) Make it still functional when javascript is turned off. If this doesn't work, sites that require Section 508 compliance won't be able to use jDIV. 6) Nested containers should work (might work already, I haven't tested it) I really like where this is going. Cheers, Brian On Apr 4, 11:50 am, mdipierro mdipie...@cs.depaul.edu wrote: Note to self. Things to be fixed: 1) the action needs knowledge on whether it is in a container. Solution: add a header that says so. 2) the action response needs to be able to reference other containers in order to trigger actions there. Right now each container is identified by a unique but random id and there is no way to guess it. Solution: have the user specify the name of each container. 3) if a container contains a form that selft submit and then redirect the content to a another action that also has a form. This second form will not work properly. Solution 1: the programmer needs to specify the [SQL]FORM(_action=) but this is a problem form legacy code that you want to ajaxify. Solution 2: have the jDiv code automatically determine the action from context. 4) right now every container has a link (that triggers the loading of the content) and a div with the content. To what extent should this be customizable? For example, you may want the container to have a top bar with additional buttons. Should this customization be a feature of the current container class (jDiv) or should the class be subclassed? This opens a big can of worms since the frame of the components needs to have some standard hooks in order to expose functions like reload the content, close it, etc. (what else?). can you think of anything else? Massimo On Apr 4, 1:02 am, mdipierro mdipie...@cs.depaul.edu wrote: I re-posted a slightly better version. The new version work in this way: say you have an action like: def myform(): form=SQLFORM(...) if form.accepts(): # do something redirect(URL()); return dict(form=form) You can turn it into a partial by replacing redirect with jDiv.redirect or jDiv.flash def myform(): form=SQLFORM(...) if form.accepts(): # do something jDiv.redirect(done!!!); return dict(form=form) and create a view that DOES NOT extend the layout and does not have HTML and BODY tags. Something like this will do: {{=form}} Then create a parent action and in the view embed this partial {{=jDiv(click me to ajax the partial,URL(r=request,f=myform))}} Mind that a partial can be served by another application (within the same web2py installation), can be a proxy to a different web-site and can contain an IFRAME (not recommended but possible). @Yarko. I agree that this that this is not yet a complete solution but more of a hack. Nevertheless it lets you take forms you have already created and turn them into ajax forms. It does not require any modification in web2py nor any third party libraries (it only requires the new layout and new web2py_ajax.html). I have been looking but I cannot really find a detailed decsription of how those other systems work. On Apr 3, 11:19 pm, ceej cjlaz...@googlemail.com wrote: I'm really liking this idea Massimo, I'm going to be using it in a project I'm about to start and grow on it :) Keeps using ajax very DRY. On Apr 3, 4:08 pm, mdipierro mdipie...@cs.depaul.edu wrote: There has been a lot of discussion in the past about forms that submit via ajax and may or may not refresh the entire page. It is also useful to be able to break html pages into modules or plugins or components each with its own model, view, controller in such a way that they communicate both serversize (by sharing session and database) and clientsize (one boxed component should be able for example to refresh the entire page or trigger a flash). I have prototype application that does this. http://www.web2py.com/examples/static/web2py.app.events.tar It uses jquery publisher subscriber mechanism. All the code is in a new web2py_ajax and a class call jDiv (similar to Rails Partial but more powerful in my opinion) which I could include in html.py It allows you to write code like this: def index(): return dict(partial1=jDiv('click me for text','mycallback1'), partial2=jDiv('click me for flash','mycallback2'), partial3=jDiv('click me to redirect','mycallback3'), partial4=jDiv('click me for form','mycallback4')) def mycallback1(): return 'hello world' def mycallback2(): return jDiv.flash('this is a test') # flash on the container page def mycallback3(): return jDiv.redirect('http://www.yahoo.com') # redirects entire page def mycallback4():
[web2py:19127] Re: Dal examples
Denes, Where and how do I display db._lastsql? The example comes from: http://mdp.cti.depaul.edu/examples/default/dal the example about Left Outer Joins I guess the idea of the example in SQL reads like: SELECT person.name, dog.name FROM person LEFT OUTER JOIN friendship ON person.id==friendship.person LEFT OUTER JOIN dog ON dog.id==friendship.dog WHERE person.id0 In the example: query=(db.person.id0) and: friends=(db.person.id==db.friendship.person) (db.dog.id==db.friendship.dog) to me this is the JOIN condition of an INNER JOIN, so I have no idea why Massimo repeats it in the OUTER JOIN example. Next in the example is this line: rows=db(query).select(db.person.name,db.dog.name,left=db.dog.on (friends)) here I don't understand the left=db.dog.on(friends) part. You use a LEFT OUTER JOIN to not loose the persons that don't have dogs in the result. In the view this is indicated by 'nobody'. However, in the friends condition you already loose the persons without a dog, then, when you LEFT OUTER JOIN dog on friends that doesn't make sense. {{extend 'layout.html'}} {{for row in rows:}} {{=row.person.name}} is friend of {{=row.dog.name or nobody}} br / Is there a flaw in my reasoning? What you want is probably; rows=db(db.person.id0).select(db.person.name,db.dog.name,left= [db.friendship. on(db.friendship.person==db.person.id),db.dog.on (db.friendship.dog==db.dog.id)]) Yes, to make sure I understand this ... left=[db.friendship.on(db.friendship.person==db.person.id),db.dog.on (db.friendship.dog==db.dog.id)]) in SQL would read like: FROM friendship LEFT OUTER JOIN person ON friendship.person==person.id LEFT OUTER JOIN dog ON friendship.dog==dog.id If I am right here I am reassured. Kind regards, Annet. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19128] Re: web2py and Python3
What feature of 3.0 do you consider so important to constraint you? Massimo LOL, I wanted to ask the same question..:)) +1 Michal alias Plysak --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19129] Re: Sub query not registering accurately?
@TheDude MY DAL is not as good as yours. I was simply thinking that if you preloaded the var with the objects then you could return the last topic using a command that would select the last list item. I may be right off beam the DAL looks ok to me but i am still learning it so sorry. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19130] Re: SQLFORM vs 3rd normal form...
@Roger Does this address any hidden fields you may want updating. ie modified date, modfied by, ID? I like where your going... The only problem I have with this area is we are putting visual UI into controllers. The MVC model is supposed to put UI in the V portion. However web2py seems to be moving more and more to constructing view elements in the controllers are with simple placement formating being defined in the views... Just my ramblings --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19131] Re: Input type button
Where did you find the book in pdf format for under $20? You should look at the the following code that allows a callback without updating the page. This would be great for a calculator. class index(): button1=TAG.BUTTON(_onclick=$.ajax({url: '%s', success: function (value) { $('#target').html(value); } }); % URL (r=request,f='callback')) div1=DIV(_id='target') return dict(button1=button1, div1=div1) class callback(): return H1('Hello world').xml() --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19132] Suggestion: adjust the sample of streaming
Hi Massimo, I always follow the sample here to write my streaming code: http://www.web2py.com/examples/default/examples#streaming_examples Today I happened to find that this approach does not handle HTTP/1.1 206 PARTIAL CONTENT correctly. After some try and search, I found this: http://groups.google.com/group/web2py/msg/8fa154c4cf1a3a38 Therefore I suggest to adjust the stream sample. How about something like these? START = Example 48 It is very easy in web2py to stream large files. Here is an example of a controller that does so: def streamer(): return response.stream(open ('largefile.mpg4','rb'),chunk_size=4096) By default all static files and files stored in 'upload' fields in the database are streamed when larger than 1MByte. Even better, if you use: def streamer(): return response.stream('path_to_a_largefile.mpg4',request=request) web2py automatically and transparently handles PARTIAL_CONTENT and RANGE requests. == THE END === --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19133] Re: Controller sub-folders
On Apr5, 1:48pm, r...@devshell.org roman.goldm...@gmail.com wrote: As far as I understand from the manual, it is not possible to store controllers in sub folders in the Controller folder in web2py. Is that right? If that is not correct, what URL would one use to access a function called user_reg in a controller called called useradd in a folder called user in the folder Controllers in web2py. Additionally, what parts of the manual discuss the topics I need to understand in order to do the above. If it is not possible, well...I am sure it has to be possible... it is such an important feature for organizing a large project... I don't know ... but do you really need sub folders to store your controller? I assume you already know that, you can have many controllers as yourapp/controllers/*.py, and each controller can have many actions. The following arrangements is very similar to your example, although not fully identical. yourapp/controllers/user.py # In which there is a group of parallel actions named user_reg() and user_forgot_password() and user_logout() etc. yourapp/controllers/realjob.py # In which there is some more actions like search(), place_order(), pay_money(), etc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19134] Re: Controller sub-folders
it is such an important feature for organizing a large project... Because? The controller itself provides a namespace, not the filesystem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19135] Re: important about ajax forms
5) may be though 6) I believe this works already. On Apr 5, 1:24 am, Brian br...@brianmaddy.com wrote: These might be some additional requirements (let me know what you think): 5) Make it still functional when javascript is turned off. If this doesn't work, sites that require Section 508 compliance won't be able to use jDIV. 6) Nested containers should work (might work already, I haven't tested it) I really like where this is going. Cheers, Brian On Apr 4, 11:50 am, mdipierro mdipie...@cs.depaul.edu wrote: Note to self. Things to be fixed: 1) the action needs knowledge on whether it is in a container. Solution: add a header that says so. 2) the action response needs to be able to reference other containers in order to trigger actions there. Right now each container is identified by a unique but random id and there is no way to guess it. Solution: have the user specify the name of each container. 3) if a container contains a form that selft submit and then redirect the content to a another action that also has a form. This second form will not work properly. Solution 1: the programmer needs to specify the [SQL]FORM(_action=) but this is a problem form legacy code that you want to ajaxify. Solution 2: have the jDiv code automatically determine the action from context. 4) right now every container has a link (that triggers the loading of the content) and a div with the content. To what extent should this be customizable? For example, you may want the container to have a top bar with additional buttons. Should this customization be a feature of the current container class (jDiv) or should the class be subclassed? This opens a big can of worms since the frame of the components needs to have some standard hooks in order to expose functions like reload the content, close it, etc. (what else?). can you think of anything else? Massimo On Apr 4, 1:02 am, mdipierro mdipie...@cs.depaul.edu wrote: I re-posted a slightly better version. The new version work in this way: say you have an action like: def myform(): form=SQLFORM(...) if form.accepts(): # do something redirect(URL()); return dict(form=form) You can turn it into a partial by replacing redirect with jDiv.redirect or jDiv.flash def myform(): form=SQLFORM(...) if form.accepts(): # do something jDiv.redirect(done!!!); return dict(form=form) and create a view that DOES NOT extend the layout and does not have HTML and BODY tags. Something like this will do: {{=form}} Then create a parent action and in the view embed this partial {{=jDiv(click me to ajax the partial,URL(r=request,f=myform))}} Mind that a partial can be served by another application (within the same web2py installation), can be a proxy to a different web-site and can contain an IFRAME (not recommended but possible). @Yarko. I agree that this that this is not yet a complete solution but more of a hack. Nevertheless it lets you take forms you have already created and turn them into ajax forms. It does not require any modification in web2py nor any third party libraries (it only requires the new layout and new web2py_ajax.html). I have been looking but I cannot really find a detailed decsription of how those other systems work. On Apr 3, 11:19 pm, ceej cjlaz...@googlemail.com wrote: I'm really liking this idea Massimo, I'm going to be using it in a project I'm about to start and grow on it :) Keeps using ajax very DRY. On Apr 3, 4:08 pm, mdipierro mdipie...@cs.depaul.edu wrote: There has been a lot of discussion in the past about forms that submit via ajax and may or may not refresh the entire page. It is also useful to be able to break html pages into modules or plugins or components each with its own model, view, controller in such a way that they communicate both serversize (by sharing session and database) and clientsize (one boxed component should be able for example to refresh the entire page or trigger a flash). I have prototype application that does this. http://www.web2py.com/examples/static/web2py.app.events.tar It uses jquery publisher subscriber mechanism. All the code is in a new web2py_ajax and a class call jDiv (similar to Rails Partial but more powerful in my opinion) which I could include in html.py It allows you to write code like this: def index(): return dict(partial1=jDiv('click me for text','mycallback1'), partial2=jDiv('click me for flash','mycallback2'), partial3=jDiv('click me to redirect','mycallback3'), partial4=jDiv('click me for form','mycallback4')) def mycallback1(): return 'hello world' def mycallback2(): return
[web2py:19136] Re: How do we do Partial page updates like Ruiby on Rails
The code for SQLFORM is in gluon/sqlhtml.py but, did you follow the discussions on http://groups.google.com/group/web2py/browse_thread/thread/82fad17e26e1739a/588b2e8f0226beee#588b2e8f0226beee Did you look into http://www.web2py.com/events/default/index Are you looking at something different? Massimo On Apr 4, 11:27 pm, Steve Shepherd sargs...@gmail.com wrote: Where can i get a look at the source code for the SQLFORM Class I am interested in making an ajax equivalent. On Fri, Apr 3, 2009 at 5:45 PM, mdipierro mdipie...@cs.depaul.edu wrote: not sure what you are asking me. Massimo On Apr 2, 10:21 pm, Steve Shepherd sargs...@gmail.com wrote: @Brian Thanks for your code. As Massimo described preloading the page is dangerous using xml also this is SLOW. By using ajax calls you make a round trip to the server to retrieve the content needed and replace the innerhtml of a div . This means the server loads a list of departments quickly. Then as the person edits a department the ajax call loads the edit form. Then as they save or cancel the callback saves the changes and resets the div contents. This way you only make small data requests as needed and really improves user perception of functional speed. @Massimo Is it possible to review the SQLFORM class as I am interested in building a AJAXFORM class that would do all I need and could be published as part of your project. Steve --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19137] Re: appengine error
I don't know what the issue was. But it went away when I rebooted. On Apr 3, 7:37 pm, mdipierro mdipie...@cs.depaul.edu wrote: Did you edit the app.yaml file? It does not see to be uploading the VERSION file. On Apr 3, 8:24 am, Joseph Jude ceph...@gmail.com wrote: Hi all, I'm not sure if anyone of you got this error while running on appengine (locally, using appengine launcher). type 'exceptions.IOError': [Errno 13] file not accessible going through the err pg, I see this at the end. web2py_path = os.environ.get('web2py_path', os.getcwd()) web2py_version = open(os.path.join(web2py_path, 'VERSION'), 'r').read() Don't know how to resolve this. Any idea? Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19138] Re: Sub query not registering accurately?
Please print myselect= db((db.mb_posts.board_id==request.args[0]) (db.mb_posts.reply_to==None))._select(db.mb_posts.ALL, db.auth_user.ALL,mb_posts2.id.count(), db (mb_posts3.reply_to==db.mb_posts.id)._select(mb_posts3.id, orderby=~mb_posts3.id, limitby=(0,1)), left=(db.auth_user.on (rows),mb_posts2.on(rows2)), groupby=db.mb_posts.id) return dict(board=board, threads=threads) then check if the generated myselect works from a MySQL shell. Massimo On Apr 4, 10:58 am, TheDude officed...@gmail.com wrote: Tried using this as logging tool:http://mdp.cti.depaul.edu/AlterEgo/default/show/194 But it didn't record where I have the problem at all (even after my patches). The controller: def view(): #try: board = db(db.mb_boards.id==request.args[0]).select()[0] rows = (db.auth_user.id==db.mb_posts.posted_by) mb_posts2 = db.mb_posts.with_alias(mb_posts2) rows2 = (mb_posts2.reply_to==db.mb_posts.id) mb_posts3 = db.mb_posts.with_alias(mb_posts3) threads = db((db.mb_posts.board_id==request.args[0]) (db.mb_posts.reply_to==None)).select(db.mb_posts.ALL, db.auth_user.ALL,mb_posts2.id.count(), db (mb_posts3.reply_to==db.mb_posts.id)._select(mb_posts3.id, orderby=~mb_posts3.id, limitby=(0,1)), left=(db.auth_user.on (rows),mb_posts2.on(rows2)), groupby=db.mb_posts.id) return dict(board=board, threads=threads) #except: # session.flash = This board doesn't exist. # redirect(URL(r=request, f='index')) The problem: ProgrammingError: (1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT mb_posts3.id FROM mb_posts3, mb_posts WHERE mb_posts3.reply_to=mb_posts.i' at line 1) What I'm trying to do: mb_posts2 = The # of replies within that topic/thread (this works) mb_posts3 = The last reply created within that topic (sub query will do fine). I've tried various ways, the aggregate way, another left join, nothing seems to work. Asked a few people on the IRC as well, but they were just as lost as me. Anyone on here have any thoughts on the situation? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19139] Re: SQLFORM vs 3rd normal form...
However web2py seems to be moving more and more to constructing view elements in the controllers are with simple placement formating being defined in the views... what makes you think so? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19140] Re: Input type button
The book on lulu.com should cost $12. On Apr 5, 5:03 am, Steve Shepherd sargs...@gmail.com wrote: Where did you find the book in pdf format for under $20? You should look at the the following code that allows a callback without updating the page. This would be great for a calculator. def index(): button1=TAG.BUTTON(_onclick=$.ajax({url: '%s', success: function (value) { $('#target').html(value); } }); % URL (r=request,f='callback')) div1=DIV(_id='target') return dict(button1=button1, div1=div1) class callback(): return H1('Hello world').xml() fixed a typo in code above. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19142] IS_URL - error_message
Hi I have problem with custom message on url field validation. I set following rule in db.py db.mytable.url.requires=IS_URL(error_message='Must be URL') but validation always returns 'invalid url!' message . Custom validation message working fine for other validators, like IS_NOT_EMPTY or IS_DATE, I have problem only with IS_URL. I'm using web2py 1.59 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19144] IS_URL error_message
Hi I have problem with custom message on url field validation. I set following rule in db.py db.mytable.url.requires=IS_URL(error_message='Must be URL') but validation always returns 'invalid url!' message . Custom validation message working fine for other validators, like IS_NOT_EMPTY or IS_DATE, I have problem only with IS_URL. I'm using web2py 1.59 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19143] Newbie trying to get CAS working.
This is my first day with web2py 1) I downlaoded CAS tar file fro,m cookbook and uploaded the app and named it cas 2) I changed the database to use mysql in the db.py model 3) I went to http://127.0.0.1:8000/cas/appadmin/insert/db/cas_user to create a new user. 4) I checked if the records were inserted into the MySQL table called cas_user. There were and all is OK. a) on multiple inserts of users, some passwords where hashed where some were not. Why? 5) I went to http://127.0.0.1:8000/cas/cas/login to try and login. I entered the email and the password. Validation fails i.e. Invalid Login. Appears that no records were returned from the following query from the cas.py controller: def login(): r=db(db.cas_user.email==form.vars.email)\ (db.cas_user.password==form.vars.password)\ (db.cas_user.verification=='')\ .select() if len(r)0: So.what is going on? How to I debug the problem? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19145] Re: appengine error
just appengine weirdness I guess. On Apr 5, 8:53 am, Joseph ceph...@gmail.com wrote: I don't know what the issue was. But it went away when I rebooted. On Apr 3, 7:37 pm, mdipierro mdipie...@cs.depaul.edu wrote: Did you edit the app.yaml file? It does not see to be uploading the VERSION file. On Apr 3, 8:24 am, Joseph Jude ceph...@gmail.com wrote: Hi all, I'm not sure if anyone of you got this error while running on appengine (locally, using appengine launcher). type 'exceptions.IOError': [Errno 13] file not accessible going through the err pg, I see this at the end. web2py_path = os.environ.get('web2py_path', os.getcwd()) web2py_version = open(os.path.join(web2py_path, 'VERSION'), 'r').read() Don't know how to resolve this. Any idea? Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19146] Re: Sub query not registering accurately?
I'm getting interested in this, coz that query is strange, but what that DAL call generates is: SELECT mb_posts.id, mb_posts.title, mb_posts.message, mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, auth_user.last_name, auth_user.email, auth_user.password, auth_user.registration_key, COUNT(mb_posts2.id), SELECT mb_posts3.id FROM mb_posts3, mb_posts WHERE mb_posts3.reply_to=mb_posts.id ORDER BY mb_posts3.id DESC LIMIT 1 OFFSET 0; FROM mb_posts, mb_posts3 LEFT JOIN auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id So the first thing is there is a ';' sighn after OFFSET statement in the middle of query and the second thing is that this is not the way subselects are supposed to be used. Try to examine it further, i'm getting a bit lost in it. I think it is terribly complicated for the functionality it should provide. Plysak --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19147] Re: Sub query not registering accurately?
I see the problem. The structure of that query is db().select(...,db(...)._select(...),...) # wrong The DAL is not designed to do this because it is not a good idea (as Michal points out). You may be able to do it anyway db().select(...,db(...)._select(...)[:-1],...) # wrong? But it may still not work. nested selects should go in the query, not in the list of fields to be selected. You may need to refactor your select. Perhaps if you explain in words what you are trying to select we can help more. Massimo On Apr 5, 9:27 am, Michal Jursa mic...@jursa.cz wrote: I'm getting interested in this, coz that query is strange, but what that DAL call generates is: SELECT mb_posts.id, mb_posts.title, mb_posts.message, mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, auth_user.last_name, auth_user.email, auth_user.password, auth_user.registration_key, COUNT(mb_posts2.id), SELECT mb_posts3.id FROM mb_posts3, mb_posts WHERE mb_posts3.reply_to=mb_posts.id ORDER BY mb_posts3.id DESC LIMIT 1 OFFSET 0; FROM mb_posts, mb_posts3 LEFT JOIN auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id So the first thing is there is a ';' sighn after OFFSET statement in the middle of query and the second thing is that this is not the way subselects are supposed to be used. Try to examine it further, i'm getting a bit lost in it. I think it is terribly complicated for the functionality it should provide. Plysak --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19148] Uploading Static File Folder
Hi, I am using an DHTMLX JavaScript library. I have to upload multiple files and directories. For e.g. there is a separate folder for images etc... How do I deal with that? It is not clear on how to upload a folder structure to the static section. Can I create folders in the static directory? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19149] Re: IS_URL error_message
Hi, You may want to try a quick fix (not sure that's ok, but it seems to work): # file validators.py # line 1306 try: subMethod = eval('IS_' + str(self.mode).upper() + '_URL (allowed_schemes=self.allowed_schemes, prepend_scheme=self.prepend_scheme,error_message=' + self.error_message + ')' imho it's not a bug, it's just IS_HTTP_URL error_message attribute, which is returned from IS_URL, and it has value invalid url!. On Apr 5, 10:50 am, ab adam.ba...@googlemail.com wrote: Hi I have problem with custom message on url field validation. I set following rule in db.py db.mytable.url.requires=IS_URL(error_message='Must be URL') but validation always returns 'invalid url!' message . Custom validation message working fine for other validators, like IS_NOT_EMPTY or IS_DATE, I have problem only with IS_URL. I'm using web2py 1.59 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19150] Re: IS_URL error_message
You are right. There is a bug. It is fixed in trunk. On Apr 5, 2:50 am, ab adam.ba...@googlemail.com wrote: Hi I have problem with custom message on url field validation. I set following rule in db.py db.mytable.url.requires=IS_URL(error_message='Must be URL') but validation always returns 'invalid url!' message . Custom validation message working fine for other validators, like IS_NOT_EMPTY or IS_DATE, I have problem only with IS_URL. I'm using web2py 1.59 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19151] Re: Uploading Static File Folder
Hi, If I understand correctly the question - you can just copy your directories in static directory. On Apr 5, 5:52 pm, Monty808 davidmontgom...@gmail.com wrote: Hi, I am using an DHTMLX JavaScript library. I have to upload multiple files and directories. For e.g. there is a separate folder for images etc... How do I deal with that? It is not clear on how to upload a folder structure to the static section. Can I create folders in the static directory? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19152] Re: Uploading Static File Folder
Static files that comprise your application go in youapp/static/ You can create subfolders. Static files uploaded by your application (for example via SQLFORM) should go in yourapp/uploads You should have subfolders in there since that is handled by web2py for you. Massimo On Apr 5, 9:52 am, Monty808 davidmontgom...@gmail.com wrote: Hi, I am using an DHTMLX JavaScript library. I have to upload multiple files and directories. For e.g. there is a separate folder for images etc... How do I deal with that? It is not clear on how to upload a folder structure to the static section. Can I create folders in the static directory? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19153] User Registration on userid rather than email
Hi All, What is needed to have userid rather than email in the user registration page of Auth? Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19154] Re: Sub query not registering accurately?
I already tried that removement of the semicolon directly in the query and that still doesn't work. To say true i cannot get the sense of the query so i cannot clearly debug it coz i never used subselects in field list. Michal alias Plysak mdipierro wrote: I see the problem. The structure of that query is db().select(...,db(...)._select(...),...) # wrong The DAL is not designed to do this because it is not a good idea (as Michal points out). You may be able to do it anyway db().select(...,db(...)._select(...)[:-1],...) # wrong? But it may still not work. nested selects should go in the query, not in the list of fields to be selected. You may need to refactor your select. Perhaps if you explain in words what you are trying to select we can help more. Massimo On Apr 5, 9:27 am, Michal Jursa mic...@jursa.cz wrote: I'm getting interested in this, coz that query is strange, but what that DAL call generates is: SELECT mb_posts.id, mb_posts.title, mb_posts.message, mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, auth_user.last_name, auth_user.email, auth_user.password, auth_user.registration_key, COUNT(mb_posts2.id), SELECT mb_posts3.id FROM mb_posts3, mb_posts WHERE mb_posts3.reply_to=mb_posts.id ORDER BY mb_posts3.id DESC LIMIT 1 OFFSET 0; FROM mb_posts, mb_posts3 LEFT JOIN auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id So the first thing is there is a ';' sighn after OFFSET statement in the middle of query and the second thing is that this is not the way subselects are supposed to be used. Try to examine it further, i'm getting a bit lost in it. I think it is terribly complicated for the functionality it should provide. Plysak --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19155] Re: Suggestion: adjust the sample of streaming
Sorry, chunk_size does not matter in this case. What I mean is, using a file object as the first parameter of response.stream(...) does NOT support HTTP/1.1 206 PARTIAL CONTENT. Instead, we should use a file name string. Therefore I suggest to adjust the example document to explicitly compare the two approaches. I refine the doc, please refer to the end of this mail. On Apr5, 10:08pm, mdipierro mdipie...@cs.depaul.edu wrote: You can do response.stream(...,chunk_size=4000) On Apr 5, 5:57 am, Iceberg iceb...@21cn.com wrote: Hi Massimo, I always follow the sample here to write my streaming code: http://www.web2py.com/examples/default/examples#streaming_examples Today I happened to find that this approach does not handle HTTP/1.1 206 PARTIAL CONTENT correctly. After some try and search, I found this: http://groups.google.com/group/web2py/msg/8fa154c4cf1a3a38 Therefore I suggest to adjust the stream sample. How about something like these? START = Example 48 It is very easy in web2py to stream large files. Here is an example of a controller that does so: def streamer(): return response.stream(open('largefile.mpg4','rb')) By default all static files and files stored in 'upload' fields in the database are streamed when larger than 1MByte. Even better, if you use: def streamer(): return response.stream('a_file_name_rather_than_a_file_object.mpg4',request=request) web2py automatically and transparently handles PARTIAL_CONTENT and RANGE requests. == THE END === --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19156] Re: User Registration on userid rather than email
all is needed is to use a custom defined table with a username field. auth=Auth(globals(),db) auth.settings.table_user = db.define_table( self.settings.table_user_name, db.Field('first_name', length=128,default=''), db.Field('last_name', length=128,default=''), db.Field('username', length=128,default=''), db.Field('email', length=128,default=''), db.Field('password', 'password', readable=False, label='Password'), db.Field('registration_key', length=128, writable=False, readable=F\ alse,default=''), migrate=migrate) table = auth.settings.table_user table.first_name.requires = IS_NOT_EMPTY() table.last_name.requires = IS_NOT_EMPTY() table.password.requires = CRYPT() table.username.requires = IS_NOT_IN_DB(db, '%s.username' \ % self.settings.table_user._tablename) table.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, '%s.email' \ % self.settings.table_user._tablename)] On Apr 5, 10:14 am, Joseph Jude ceph...@gmail.com wrote: Hi All, What is needed to have userid rather than email in the user registration page of Auth? Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19157] Re: User Registration on userid rather than email
after that you call auth.define_tables() it will use your own table, find usrname and use that instead of email. Massimo On Apr 5, 10:32 am, mdipierro mdipie...@cs.depaul.edu wrote: all is needed is to use a custom defined table with a username field. auth=Auth(globals(),db) auth.settings.table_user = db.define_table( self.settings.table_user_name, db.Field('first_name', length=128,default=''), db.Field('last_name', length=128,default=''), db.Field('username', length=128,default=''), db.Field('email', length=128,default=''), db.Field('password', 'password', readable=False, label='Password'), db.Field('registration_key', length=128, writable=False, readable=F\ alse,default=''), migrate=migrate) table = auth.settings.table_user table.first_name.requires = IS_NOT_EMPTY() table.last_name.requires = IS_NOT_EMPTY() table.password.requires = CRYPT() table.username.requires = IS_NOT_IN_DB(db, '%s.username' \ % self.settings.table_user._tablename) table.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, '%s.email' \ % self.settings.table_user._tablename)] On Apr 5, 10:14 am, Joseph Jude ceph...@gmail.com wrote: Hi All, What is needed to have userid rather than email in the user registration page of Auth? Thank you, Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19160] Re: Sub query not registering accurately?
Repost from IRC conversation: 16:27:47 draginx basically im getting a list of topics with a specific board_id 16:28:06 draginx within the same query, I'm trying to retrieve the latest reply to each topic Michal alias Plysak mdipierro wrote: It is very hard for me (and everybody) to debug this without having a copy of the model and without understanding what this is supposed to do. Could you explain what you are trying to do? Is the querly below in SQL the one that you are trying to perform or the one that you are actually performing and does not work? Is it the output of db(...)._select()? Massimo On Apr 5, 10:47 am, TheDude officed...@gmail.com wrote: Thanks guys :) It's been really bogging down my productivity within the website, but here is the query that I am trying to perform.. SELECT mb_posts.id, mb_posts.title, mb_posts.message, mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, auth_user.last_name, auth_user.email, auth_user.password, auth_user.registration_key, COUNT(mb_posts2.id), (SELECT mb_posts.id FROM mb_posts AS mb_posts3 WHERE mb_posts3.reply_to=mb_posts.id ORDER BY mb_posts3.id DESC LIMIT 1) FROM mb_posts LEFT JOIN auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id Hope that makes a bit more sense. :) Everything in the qery works fine except for mb_posts3 info. I'm trying to select the latest reply created to that thread. On Apr 5, 11:26 am, Michal Jursa mic...@jursa.cz wrote: I already tried that removement of the semicolon directly in the query and that still doesn't work. To say true i cannot get the sense of the query so i cannot clearly debug it coz i never used subselects in field list. Michal alias Plysak mdipierro wrote: I see the problem. The structure of that query is db().select(...,db(...)._select(...),...) # wrong The DAL is not designed to do this because it is not a good idea (as Michal points out). You may be able to do it anyway db().select(...,db(...)._select(...)[:-1],...) # wrong? But it may still not work. nested selects should go in the query, not in the list of fields to be selected. You may need to refactor your select. Perhaps if you explain in words what you are trying to select we can help more. Massimo On Apr 5, 9:27 am, Michal Jursa mic...@jursa.cz wrote: I'm getting interested in this, coz that query is strange, but what that DAL call generates is: SELECT mb_posts.id, mb_posts.title, mb_posts.message, mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, auth_user.last_name, auth_user.email, auth_user.password, auth_user.registration_key, COUNT(mb_posts2.id), SELECT mb_posts3.id FROM mb_posts3, mb_posts WHERE mb_posts3.reply_to=mb_posts.id ORDER BY mb_posts3.id DESC LIMIT 1 OFFSET 0; FROM mb_posts, mb_posts3 LEFT JOIN auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id So the first thing is there is a ';' sighn after OFFSET statement in the middle of query and the second thing is that this is not the way subselects are supposed to be used. Try to examine it further, i'm getting a bit lost in it. I think it is terribly complicated for the functionality it should provide. Plysak --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19161] Re: Suggestion: adjust the sample of streaming
Now I understand better. I agree that example needs revision but: 1) files in static are automatically served properly (in a way that supports 206) 2) dowloading uploaded files too (if you use response.download()) 3) the purpose of that example is also to show that you can stream any output stream (something with a read() method) not necessarily and actual file (for example a StringIO). perhaps we need to add one example. Massimo On Apr 5, 10:26 am, Iceberg iceb...@21cn.com wrote: Sorry, chunk_size does not matter in this case. What I mean is, using a file object as the first parameter of response.stream(...) does NOT support HTTP/1.1 206 PARTIAL CONTENT. Instead, we should use a file name string. Therefore I suggest to adjust the example document to explicitly compare the two approaches. I refine the doc, please refer to the end of this mail. On Apr5, 10:08pm, mdipierro mdipie...@cs.depaul.edu wrote: You can do response.stream(...,chunk_size=4000) On Apr 5, 5:57 am, Iceberg iceb...@21cn.com wrote: Hi Massimo, I always follow the sample here to write my streaming code: http://www.web2py.com/examples/default/examples#streaming_examples Today I happened to find that this approach does not handle HTTP/1.1 206 PARTIAL CONTENT correctly. After some try and search, I found this: http://groups.google.com/group/web2py/msg/8fa154c4cf1a3a38 Therefore I suggest to adjust the stream sample. How about something like these? START = Example 48 It is very easy in web2py to stream large files. Here is an example of a controller that does so: def streamer(): return response.stream(open('largefile.mpg4','rb')) By default all static files and files stored in 'upload' fields in the database are streamed when larger than 1MByte. Even better, if you use: def streamer(): return response.stream('a_file_name_rather_than_a_file_object.mpg4',request=request) web2py automatically and transparently handles PARTIAL_CONTENT and RANGE requests. == THE END === --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19162] change_password problem on GAE
change_password works fine except on GAE: Traceback (most recent call last): File /base/data/home/apps/myapp/1.332577102462600463/gluon/ restricted.py, line 98, in restricted exec ccode in environment File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 117, in module File /base/data/home/apps/myapp/1.332577102462600463/gluon/ globals.py, line 75, in lambda self._caller = lambda f: f() File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 101, in user return dict(form=auth()) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 411, in __call__ return self.change_password() File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 900, in change_password requires=[IS_EXPR('value==%s' % repr(pass1))])) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ sqlhtml.py, line 658, in form_factory return SQLFORM(SQLDB(None).define_table('no_table', *fields), File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 851, in define_table t = self[tablename] = SQLTable(self, tablename, *fields) File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 1006, in __init__ 'define_table argument is not a SQLField' SyntaxError: define_table argument is not a SQLField Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19164] Re: Sub query not registering accurately?
Don't know if the google groups posted this already but lets try again.. Models: http://pastie.org/private/kgrvhedmnq1mm9jivc1h3w Controller: http://pastie.org/private/9sycnfi3b4xz4ij5m1d7na Problem: Trying to select the last mb_posts3.reply_to==mb_posts.id..JUST the last one. Massimo, That SQL I posted was from me, not generated by Web2Py. On Apr 5, 12:10 pm, Michal Jursa mic...@jursa.cz wrote: Repost from IRC conversation: 16:27:47 draginx basically im getting a list of topics with a specific board_id 16:28:06 draginx within the same query, I'm trying to retrieve the latest reply to each topic Michal alias Plysak mdipierro wrote: It is very hard for me (and everybody) to debug this without having a copy of the model and without understanding what this is supposed to do. Could you explain what you are trying to do? Is the querly below in SQL the one that you are trying to perform or the one that you are actually performing and does not work? Is it the output of db(...)._select()? Massimo On Apr 5, 10:47 am, TheDude officed...@gmail.com wrote: Thanks guys :) It's been really bogging down my productivity within the website, but here is the query that I am trying to perform.. SELECT mb_posts.id, mb_posts.title, mb_posts.message, mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, auth_user.last_name, auth_user.email, auth_user.password, auth_user.registration_key, COUNT(mb_posts2.id), (SELECT mb_posts.id FROM mb_posts AS mb_posts3 WHERE mb_posts3.reply_to=mb_posts.id ORDER BY mb_posts3.id DESC LIMIT 1) FROM mb_posts LEFT JOIN auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id Hope that makes a bit more sense. :) Everything in the qery works fine except for mb_posts3 info. I'm trying to select the latest reply created to that thread. On Apr 5, 11:26 am, Michal Jursa mic...@jursa.cz wrote: I already tried that removement of the semicolon directly in the query and that still doesn't work. To say true i cannot get the sense of the query so i cannot clearly debug it coz i never used subselects in field list. Michal alias Plysak mdipierro wrote: I see the problem. The structure of that query is db().select(...,db(...)._select(...),...) # wrong The DAL is not designed to do this because it is not a good idea (as Michal points out). You may be able to do it anyway db().select(...,db(...)._select(...)[:-1],...) # wrong? But it may still not work. nested selects should go in the query, not in the list of fields to be selected. You may need to refactor your select. Perhaps if you explain in words what you are trying to select we can help more. Massimo On Apr 5, 9:27 am, Michal Jursa mic...@jursa.cz wrote: I'm getting interested in this, coz that query is strange, but what that DAL call generates is: SELECT mb_posts.id, mb_posts.title, mb_posts.message, mb_posts.posted_by, mb_posts.date_posted, mb_posts.locked, mb_posts.sticky, mb_posts.last_edited, mb_posts.board_id, mb_posts.reply_to, mb_posts.views, auth_user.id, auth_user.first_name, auth_user.last_name, auth_user.email, auth_user.password, auth_user.registration_key, COUNT(mb_posts2.id), SELECT mb_posts3.id FROM mb_posts3, mb_posts WHERE mb_posts3.reply_to=mb_posts.id ORDER BY mb_posts3.id DESC LIMIT 1 OFFSET 0; FROM mb_posts, mb_posts3 LEFT JOIN auth_user ON auth_user.id=mb_posts.posted_by LEFT JOIN mb_posts AS mb_posts2 ON mb_posts2.reply_to=mb_posts.id WHERE (mb_posts.board_id=1 AND mb_posts.reply_to IS NULL) GROUP BY mb_posts.id So the first thing is there is a ';' sighn after OFFSET statement in the middle of query and the second thing is that this is not the way subselects are supposed to be used. Try to examine it further, i'm getting a bit lost in it. I think it is terribly complicated for the functionality it should provide. Plysak --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19165] Re: IS_URL error_message
Thanks for fixing it. On Apr 5, 5:04 pm, mdipierro mdipie...@cs.depaul.edu wrote: You are right. There is a bug. It is fixed in trunk. On Apr 5, 2:50 am, ab adam.ba...@googlemail.com wrote: Hi I have problem with custom message on url field validation. I set following rule in db.py db.mytable.url.requires=IS_URL(error_message='Must be URL') but validation always returns 'invalid url!' message . Custom validation message working fine for other validators, like IS_NOT_EMPTY or IS_DATE, I have problem only with IS_URL. I'm using web2py 1.59 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19166] Re: Suggestion: adjust the sample of streaming
I already know (1) and (2). Actually in this two cases we don't need to do stream by ourselves. Recently I am trying to use web2py to develop a desktop app, which need to stream files in anywhere on local hard disk. So not in range of (1) or (2), and even (3) is misleading in this case. So, add one more stream example please. :-) On Apr6, 0:13am, mdipierro mdipie...@cs.depaul.edu wrote: Now I understand better. I agree that example needs revision but: 1) files in static are automatically served properly (in a way that supports 206) 2) dowloading uploaded files too (if you use response.download()) 3) the purpose of that example is also to show that you can stream any output stream (something with a read() method) not necessarily and actual file (for example a StringIO). perhaps we need to add one example. Massimo On Apr 5, 10:26 am, Iceberg iceb...@21cn.com wrote: Sorry, chunk_size does not matter in this case. What I mean is, using a file object as the first parameter of response.stream(...) does NOT support HTTP/1.1 206 PARTIAL CONTENT. Instead, we should use a file name string. Therefore I suggest to adjust the example document to explicitly compare the two approaches. I refine the doc, please refer to the end of this mail. START = Example 48 It is very easy in web2py to stream large files. Here is an example of a controller that does so: def streamer(): return response.stream(open('largefile.mpg4','rb')) By default all static files and files stored in 'upload' fields in the database are streamed when larger than 1MByte. Even better, if you use: def streamer(): return response.stream('a_file_name_rather_than_a_file_object.mpg4',request=reques t) web2py automatically and transparently handles PARTIAL_CONTENT and RANGE requests. == THE END === --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19167] Do you need a FILENAME_SELECTOR?
Hi there, In one of my app I need to deal with local files. First I tried using INPUT(_type='text',...) to ask user to manually input the full path name of a specific file, such as C:\Program Files\Blah blah\foo \bar.exe. Obviously no one likes to type that long string. So I came up with this. Feel free to use it if you like. class FILENAME_SELECTOR(DIV): ''' Usage: In your controller: def action(): return {'':FORM(..., FILENAME_SELECTOR (_name='the_name'), ...)} After submit, the file name is in request.vars.the_name (but in UTF8 encoding!) ''' def __init__(self, *components, **attributes): name=attributes.get('_name','filename') components=[ INPUT(_type='file',_name='_%s'%abs(hash(self)), _onchange=document.getElementById ('%s').value=this.value%name), INPUT(_type='hidden',_name=name,_id=name),] super(FILENAME_SELECTOR,self).__init__(*components, **attributes) Regards, Iceberg --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19168] Re: change_password problem on GAE
I think I fixed it in trunk. Please give it a try. Massimo On Apr 5, 11:28 am, Vidul Petrov vidul.r...@gmail.com wrote: change_password works fine except on GAE: Traceback (most recent call last): File /base/data/home/apps/myapp/1.332577102462600463/gluon/ restricted.py, line 98, in restricted exec ccode in environment File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 117, in module File /base/data/home/apps/myapp/1.332577102462600463/gluon/ globals.py, line 75, in lambda self._caller = lambda f: f() File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 101, in user return dict(form=auth()) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 411, in __call__ return self.change_password() File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 900, in change_password requires=[IS_EXPR('value==%s' % repr(pass1))])) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ sqlhtml.py, line 658, in form_factory return SQLFORM(SQLDB(None).define_table('no_table', *fields), File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 851, in define_table t = self[tablename] = SQLTable(self, tablename, *fields) File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 1006, in __init__ 'define_table argument is not a SQLField' SyntaxError: define_table argument is not a SQLField Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19169] Re: change_password problem on GAE
It works now. Thank you! On Apr 5, 8:13 pm, mdipierro mdipie...@cs.depaul.edu wrote: I think I fixed it in trunk. Please give it a try. Massimo On Apr 5, 11:28 am, Vidul Petrov vidul.r...@gmail.com wrote: change_password works fine except on GAE: Traceback (most recent call last): File /base/data/home/apps/myapp/1.332577102462600463/gluon/ restricted.py, line 98, in restricted exec ccode in environment File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 117, in module File /base/data/home/apps/myapp/1.332577102462600463/gluon/ globals.py, line 75, in lambda self._caller = lambda f: f() File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 101, in user return dict(form=auth()) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 411, in __call__ return self.change_password() File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 900, in change_password requires=[IS_EXPR('value==%s' % repr(pass1))])) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ sqlhtml.py, line 658, in form_factory return SQLFORM(SQLDB(None).define_table('no_table', *fields), File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 851, in define_table t = self[tablename] = SQLTable(self, tablename, *fields) File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 1006, in __init__ 'define_table argument is not a SQLField' SyntaxError: define_table argument is not a SQLField Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19170] Re: change_password problem on GAE
It works now. Thank you! On Apr 5, 8:13 pm, mdipierro mdipie...@cs.depaul.edu wrote: I think I fixed it in trunk. Please give it a try. Massimo On Apr 5, 11:28 am, Vidul Petrov vidul.r...@gmail.com wrote: change_password works fine except on GAE: Traceback (most recent call last): File /base/data/home/apps/myapp/1.332577102462600463/gluon/ restricted.py, line 98, in restricted exec ccode in environment File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 117, in module File /base/data/home/apps/myapp/1.332577102462600463/gluon/ globals.py, line 75, in lambda self._caller = lambda f: f() File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 101, in user return dict(form=auth()) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 411, in __call__ return self.change_password() File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 900, in change_password requires=[IS_EXPR('value==%s' % repr(pass1))])) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ sqlhtml.py, line 658, in form_factory return SQLFORM(SQLDB(None).define_table('no_table', *fields), File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 851, in define_table t = self[tablename] = SQLTable(self, tablename, *fields) File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 1006, in __init__ 'define_table argument is not a SQLField' SyntaxError: define_table argument is not a SQLField Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19171] value for fault taken of another field
I need to fill a field with the same value of another field of the same table. I do the following thing: db.define_table('mytable', SQLField('field1', length=10, writable=False), ... SQLField('field2', length=10), ... ) db.mytable.field1.default = db.mytable.field2 But a mistake takes is produced. Traceback (most recent call last): File /usr/home/jose/web2py/gluon/restricted.py, line 98, in restricted exec ccode in environment File /usr/home/jose/web2py/applications/capc/controllers/ appadmin.py, line 271, in module File /usr/home/jose/web2py/gluon/globals.py, line 75, in lambda self._caller = lambda f: f() File /usr/home/jose/web2py/applications/capc/controllers/ appadmin.py, line 102, in insert if form.accepts(request.vars, session): File /usr/home/jose/web2py/gluon/sqlhtml.py, line 561, in accepts self.vars.id = self.table.insert(**fields) File /usr/home/jose/web2py/gluon/sql.py, line 1307, in insert query = self._insert(**fields) File /usr/home/jose/web2py/gluon/sql.py, line 1302, in _insert sql_v = ', '.join(vs) TypeError: sequence item 0: expected string, SQLField found What must I do? Regards Jose --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19172] Re: value for fault taken of another field
db.mytable.field1.default=request.vars.field2 On Apr 5, 1:12 pm, Jose jjac...@gmail.com wrote: I need to fill a field with the same value of another field of the same table. I do the following thing: db.define_table('mytable', SQLField('field1', length=10, writable=False), ... SQLField('field2', length=10), ... ) db.mytable.field1.default = db.mytable.field2 But a mistake takes is produced. Traceback (most recent call last): File /usr/home/jose/web2py/gluon/restricted.py, line 98, in restricted exec ccode in environment File /usr/home/jose/web2py/applications/capc/controllers/ appadmin.py, line 271, in module File /usr/home/jose/web2py/gluon/globals.py, line 75, in lambda self._caller = lambda f: f() File /usr/home/jose/web2py/applications/capc/controllers/ appadmin.py, line 102, in insert if form.accepts(request.vars, session): File /usr/home/jose/web2py/gluon/sqlhtml.py, line 561, in accepts self.vars.id = self.table.insert(**fields) File /usr/home/jose/web2py/gluon/sql.py, line 1307, in insert query = self._insert(**fields) File /usr/home/jose/web2py/gluon/sql.py, line 1302, in _insert sql_v = ', '.join(vs) TypeError: sequence item 0: expected string, SQLField found What must I do? Regards Jose --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19173] Re: Do you need a FILENAME_SELECTOR?
Could you explain more about what it does? On Apr 5, 12:03 pm, Iceberg iceb...@21cn.com wrote: Hi there, In one of my app I need to deal with local files. First I tried using INPUT(_type='text',...) to ask user to manually input the full path name of a specific file, such as C:\Program Files\Blah blah\foo \bar.exe. Obviously no one likes to type that long string. So I came up with this. Feel free to use it if you like. class FILENAME_SELECTOR(DIV): ''' Usage: In your controller: def action(): return {'':FORM(..., FILENAME_SELECTOR (_name='the_name'), ...)} After submit, the file name is in request.vars.the_name (but in UTF8 encoding!) ''' def __init__(self, *components, **attributes): name=attributes.get('_name','filename') components=[ INPUT(_type='file',_name='_%s'%abs(hash(self)), _onchange=document.getElementById ('%s').value=this.value%name), INPUT(_type='hidden',_name=name,_id=name),] super(FILENAME_SELECTOR,self).__init__(*components, **attributes) Regards, Iceberg --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19174] Re: change_password problem on GAE
I just saw another error - on form submit: Traceback (most recent call last): File /base/data/home/apps/myapp/1.332578716997575186/gluon/ restricted.py, line 98, in restricted exec ccode in environment File /base/data/home/apps/myapp/1.332578716997575186/applications/ init/controllers/default.py, line 118, in module File /base/data/home/apps/myapp/1.332578716997575186/gluon/ globals.py, line 75, in lambda self._caller = lambda f: f() File /base/data/home/apps/myapp/1.332578716997575186/applications/ init/controllers/default.py, line 102, in user return dict(form=auth()) File /base/data/home/apps/myapp/1.332578716997575186/gluon/ tools.py, line 412, in __call__ return self.change_password() File /base/data/home/apps/myapp/1.332578716997575186/gluon/ tools.py, line 902, in change_password onvalidation=onvalidation): File /base/data/home/apps/myapp/1.332578716997575186/gluon/ sqlhtml.py, line 476, in accepts onvalidation, File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 894, in accepts status = self._traverse(status) File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 290, in _traverse newstatus = c._traverse(status) and newstatus File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 290, in _traverse newstatus = c._traverse(status) and newstatus File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 290, in _traverse newstatus = c._traverse(status) and newstatus File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 290, in _traverse newstatus = c._traverse(status) and newstatus File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 296, in _traverse newstatus = self._validate() File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 707, in _validate (value, errors) = validator(value) File /base/data/home/apps/myapp/1.332578716997575186/gluon/ validators.py, line 266, in __call__ if self.dbset(field == value).count(): File /base/data/home/apps/myapp/1.332578716997575186/gluon/contrib/ gql.py, line 632, in __call__ raise SyntaxError SyntaxError: None On Apr 5, 8:13 pm, mdipierro mdipie...@cs.depaul.edu wrote: I think I fixed it in trunk. Please give it a try. Massimo On Apr 5, 11:28 am, Vidul Petrov vidul.r...@gmail.com wrote: change_password works fine except on GAE: Traceback (most recent call last): File /base/data/home/apps/myapp/1.332577102462600463/gluon/ restricted.py, line 98, in restricted exec ccode in environment File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 117, in module File /base/data/home/apps/myapp/1.332577102462600463/gluon/ globals.py, line 75, in lambda self._caller = lambda f: f() File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 101, in user return dict(form=auth()) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 411, in __call__ return self.change_password() File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 900, in change_password requires=[IS_EXPR('value==%s' % repr(pass1))])) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ sqlhtml.py, line 658, in form_factory return SQLFORM(SQLDB(None).define_table('no_table', *fields), File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 851, in define_table t = self[tablename] = SQLTable(self, tablename, *fields) File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 1006, in __init__ 'define_table argument is not a SQLField' SyntaxError: define_table argument is not a SQLField Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19175] Re: using web2py for Geo / GIS stuff
Hello, thanks for everyone how responded to my inquiry. I can see that the interest in geo stuff is there. What would you guys think of the idea to put the stuff from Sahana and pycon into a common respository and develop the geo functionality together? Thanks again and regards, Timmie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19176] Re: value for fault taken of another field
On 5 abr, 18:16, mdipierro mdipie...@cs.depaul.edu wrote: db.mytable.field1.default=request.vars.field2 Is this in the controller? Thank you very much Regards Jose --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19177] Re: change_password problem on GAE
Fixed in trunk. Please give it a try. Massimo On Apr 5, 1:21 pm, Vidul Petrov vidul.r...@gmail.com wrote: I just saw another error - on form submit: Traceback (most recent call last): File /base/data/home/apps/myapp/1.332578716997575186/gluon/ restricted.py, line 98, in restricted exec ccode in environment File /base/data/home/apps/myapp/1.332578716997575186/applications/ init/controllers/default.py, line 118, in module File /base/data/home/apps/myapp/1.332578716997575186/gluon/ globals.py, line 75, in lambda self._caller = lambda f: f() File /base/data/home/apps/myapp/1.332578716997575186/applications/ init/controllers/default.py, line 102, in user return dict(form=auth()) File /base/data/home/apps/myapp/1.332578716997575186/gluon/ tools.py, line 412, in __call__ return self.change_password() File /base/data/home/apps/myapp/1.332578716997575186/gluon/ tools.py, line 902, in change_password onvalidation=onvalidation): File /base/data/home/apps/myapp/1.332578716997575186/gluon/ sqlhtml.py, line 476, in accepts onvalidation, File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 894, in accepts status = self._traverse(status) File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 290, in _traverse newstatus = c._traverse(status) and newstatus File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 290, in _traverse newstatus = c._traverse(status) and newstatus File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 290, in _traverse newstatus = c._traverse(status) and newstatus File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 290, in _traverse newstatus = c._traverse(status) and newstatus File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 296, in _traverse newstatus = self._validate() File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 707, in _validate (value, errors) = validator(value) File /base/data/home/apps/myapp/1.332578716997575186/gluon/ validators.py, line 266, in __call__ if self.dbset(field == value).count(): File /base/data/home/apps/myapp/1.332578716997575186/gluon/contrib/ gql.py, line 632, in __call__ raise SyntaxError SyntaxError: None On Apr 5, 8:13 pm, mdipierro mdipie...@cs.depaul.edu wrote: I think I fixed it in trunk. Please give it a try. Massimo On Apr 5, 11:28 am, Vidul Petrov vidul.r...@gmail.com wrote: change_password works fine except on GAE: Traceback (most recent call last): File /base/data/home/apps/myapp/1.332577102462600463/gluon/ restricted.py, line 98, in restricted exec ccode in environment File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 117, in module File /base/data/home/apps/myapp/1.332577102462600463/gluon/ globals.py, line 75, in lambda self._caller = lambda f: f() File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 101, in user return dict(form=auth()) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 411, in __call__ return self.change_password() File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 900, in change_password requires=[IS_EXPR('value==%s' % repr(pass1))])) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ sqlhtml.py, line 658, in form_factory return SQLFORM(SQLDB(None).define_table('no_table', *fields), File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 851, in define_table t = self[tablename] = SQLTable(self, tablename, *fields) File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 1006, in __init__ 'define_table argument is not a SQLField' SyntaxError: define_table argument is not a SQLField Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19178] Re: using web2py for Geo / GIS stuff
I think it would be very valuable. On Apr 5, 1:43 pm, Tim Michelsen timmichel...@gmx-topmail.de wrote: Hello, thanks for everyone how responded to my inquiry. I can see that the interest in geo stuff is there. What would you guys think of the idea to put the stuff from Sahana and pycon into a common respository and develop the geo functionality together? Thanks again and regards, Timmie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19179] Re: value for fault taken of another field
anywhere you like as long as the left hand side is defined. On Apr 5, 1:46 pm, Jose jjac...@gmail.com wrote: On 5 abr, 18:16, mdipierro mdipie...@cs.depaul.edu wrote: db.mytable.field1.default=request.vars.field2 Is this in the controller? Thank you very much Regards Jose --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19180] Re: change_password problem on GAE
Perfect, thank you, Massimo. On Apr 5, 10:10 pm, mdipierro mdipie...@cs.depaul.edu wrote: Fixed in trunk. Please give it a try. Massimo On Apr 5, 1:21 pm, Vidul Petrov vidul.r...@gmail.com wrote: I just saw another error - on form submit: Traceback (most recent call last): File /base/data/home/apps/myapp/1.332578716997575186/gluon/ restricted.py, line 98, in restricted exec ccode in environment File /base/data/home/apps/myapp/1.332578716997575186/applications/ init/controllers/default.py, line 118, in module File /base/data/home/apps/myapp/1.332578716997575186/gluon/ globals.py, line 75, in lambda self._caller = lambda f: f() File /base/data/home/apps/myapp/1.332578716997575186/applications/ init/controllers/default.py, line 102, in user return dict(form=auth()) File /base/data/home/apps/myapp/1.332578716997575186/gluon/ tools.py, line 412, in __call__ return self.change_password() File /base/data/home/apps/myapp/1.332578716997575186/gluon/ tools.py, line 902, in change_password onvalidation=onvalidation): File /base/data/home/apps/myapp/1.332578716997575186/gluon/ sqlhtml.py, line 476, in accepts onvalidation, File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 894, in accepts status = self._traverse(status) File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 290, in _traverse newstatus = c._traverse(status) and newstatus File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 290, in _traverse newstatus = c._traverse(status) and newstatus File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 290, in _traverse newstatus = c._traverse(status) and newstatus File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 290, in _traverse newstatus = c._traverse(status) and newstatus File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 296, in _traverse newstatus = self._validate() File /base/data/home/apps/myapp/1.332578716997575186/gluon/ html.py, line 707, in _validate (value, errors) = validator(value) File /base/data/home/apps/myapp/1.332578716997575186/gluon/ validators.py, line 266, in __call__ if self.dbset(field == value).count(): File /base/data/home/apps/myapp/1.332578716997575186/gluon/contrib/ gql.py, line 632, in __call__ raise SyntaxError SyntaxError: None On Apr 5, 8:13 pm, mdipierro mdipie...@cs.depaul.edu wrote: I think I fixed it in trunk. Please give it a try. Massimo On Apr 5, 11:28 am, Vidul Petrov vidul.r...@gmail.com wrote: change_password works fine except on GAE: Traceback (most recent call last): File /base/data/home/apps/myapp/1.332577102462600463/gluon/ restricted.py, line 98, in restricted exec ccode in environment File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 117, in module File /base/data/home/apps/myapp/1.332577102462600463/gluon/ globals.py, line 75, in lambda self._caller = lambda f: f() File /base/data/home/apps/myapp/1.332577102462600463/applications/ init/controllers/default.py, line 101, in user return dict(form=auth()) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 411, in __call__ return self.change_password() File /base/data/home/apps/myapp/1.332577102462600463/gluon/ tools.py, line 900, in change_password requires=[IS_EXPR('value==%s' % repr(pass1))])) File /base/data/home/apps/myapp/1.332577102462600463/gluon/ sqlhtml.py, line 658, in form_factory return SQLFORM(SQLDB(None).define_table('no_table', *fields), File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 851, in define_table t = self[tablename] = SQLTable(self, tablename, *fields) File /base/data/home/apps/myapp/1.332577102462600463/gluon/sql.py, line 1006, in __init__ 'define_table argument is not a SQLField' SyntaxError: define_table argument is not a SQLField Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19181] Datetime support in GAE
Hi, I noticed an error in the GQL handler that prevents using datetime with GAE. In the GQL.py, function dateobj_to_datetime is dedicated to convert a date or time object into a datetime object. The issue is that the first test: if isinstance(object, datetime.date): object = datetime.datetime(object.year, object.month, object.day) is incorrect, because datetime.datetime inherits from datetime.date, and therefore the code intended solely for datetime.date is also applied to datetime.datetime. With the current implementation, hour, minutes and seconds are lost. Hopefully someone can make the change for a future release of web2py. Christophe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19182] Re: Controller sub-folders
Well, it is just a question as to whether this is possible. I was hoping to organize my project files via folders rather than simply controllers/functions. However, I realized I can achieve the same general effect via linking functions held within controller/sub-folder/ functions by importing them in controller/linker-controller. However, I was curious as it doesn't seem sub-folders are possible so far, and I was just wondering if someone was willing to play the devils advocate and just ask the question. I find it rather more productive to ask the question and ensure there is definetly a way to achieve the INTENT of project file organization with web2py via linking (which is actually completely fine). I just thought it might be interesting to have a controller and sub- folder tree that mirrors a website folder tree. I am just really not a fan of having 100 files in a single directory, and was hoping to keep it down to like 10 or less files per folder. Any suggestions as to some good practice for file management in web2py (file/folder make-up/organization)? My idea right now (based on what web2py can do), is have linker controllers under the Controllers folder, and have a bunch of sub- folders in the Controllers folder which will contain all the actual functions and business-logic. Any other ideas/suggestions? On Apr 5, 5:35 am, Vidul Petrov vidul.r...@gmail.com wrote: it is such an important feature for organizing a large project... Because? The controller itself provides a namespace, not the filesystem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19183] Re: Datetime support in GAE
Fixed in trunk. Can you please check? thanks. On Apr 5, 3:38 pm, Christophe christophe.p...@gmail.com wrote: Hi, I noticed an error in the GQL handler that prevents using datetime with GAE. In the GQL.py, function dateobj_to_datetime is dedicated to convert a date or time object into a datetime object. The issue is that the first test: if isinstance(object, datetime.date): object = datetime.datetime(object.year, object.month, object.day) is incorrect, because datetime.datetime inherits from datetime.date, and therefore the code intended solely for datetime.date is also applied to datetime.datetime. With the current implementation, hour, minutes and seconds are lost. Hopefully someone can make the change for a future release of web2py. Christophe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19184] Re: Controller sub-folders
Just so that I inderstand. Instead of having controller files (like default.py), you want to have controller folders, so that each action is its own file? Massimo On Apr 5, 4:04 pm, waTR roman.goldm...@gmail.com wrote: Well, it is just a question as to whether this is possible. I was hoping to organize my project files via folders rather than simply controllers/functions. However, I realized I can achieve the same general effect via linking functions held within controller/sub-folder/ functions by importing them in controller/linker-controller. However, I was curious as it doesn't seem sub-folders are possible so far, and I was just wondering if someone was willing to play the devils advocate and just ask the question. I find it rather more productive to ask the question and ensure there is definetly a way to achieve the INTENT of project file organization with web2py via linking (which is actually completely fine). I just thought it might be interesting to have a controller and sub- folder tree that mirrors a website folder tree. I am just really not a fan of having 100 files in a single directory, and was hoping to keep it down to like 10 or less files per folder. Any suggestions as to some good practice for file management in web2py (file/folder make-up/organization)? My idea right now (based on what web2py can do), is have linker controllers under the Controllers folder, and have a bunch of sub- folders in the Controllers folder which will contain all the actual functions and business-logic. Any other ideas/suggestions? On Apr 5, 5:35 am, Vidul Petrov vidul.r...@gmail.com wrote: it is such an important feature for organizing a large project... Because? The controller itself provides a namespace, not the filesystem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19185] Re: Controller sub-folders
Not necessarily. I am just wondering if it is possible to have a controller within a sub-folder of the Controllers folder. like app/ Controllers/user/register/newuser where user is a sub folder, and register is the controller. I can't come up with any specific example of why I need this, though I still want to know if it's possible. Right now I am going to achieve the same intent just by importing the functions from the register controller into another controller in the Controllers folder. I think that should be the way to do it anyway, as the current web2py app/controller/function/arg setup is clear, simple, and very workable. On Apr 5, 2:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Just so that I inderstand. Instead of having controller files (like default.py), you want to have controller folders, so that each action is its own file? Massimo On Apr 5, 4:04 pm, waTR roman.goldm...@gmail.com wrote: Well, it is just a question as to whether this is possible. I was hoping to organize my project files via folders rather than simply controllers/functions. However, I realized I can achieve the same general effect via linking functions held within controller/sub-folder/ functions by importing them in controller/linker-controller. However, I was curious as it doesn't seem sub-folders are possible so far, and I was just wondering if someone was willing to play the devils advocate and just ask the question. I find it rather more productive to ask the question and ensure there is definetly a way to achieve the INTENT of project file organization with web2py via linking (which is actually completely fine). I just thought it might be interesting to have a controller and sub- folder tree that mirrors a website folder tree. I am just really not a fan of having 100 files in a single directory, and was hoping to keep it down to like 10 or less files per folder. Any suggestions as to some good practice for file management in web2py (file/folder make-up/organization)? My idea right now (based on what web2py can do), is have linker controllers under the Controllers folder, and have a bunch of sub- folders in the Controllers folder which will contain all the actual functions and business-logic. Any other ideas/suggestions? On Apr 5, 5:35 am, Vidul Petrov vidul.r...@gmail.com wrote: it is such an important feature for organizing a large project... Because? The controller itself provides a namespace, not the filesystem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19186] Re: Datetime support in GAE
The fix works for me. Thanks for the quick action ! On Apr 5, 11:08 pm, mdipierro mdipie...@cs.depaul.edu wrote: Fixed in trunk. Can you please check? thanks. On Apr 5, 3:38 pm, Christophe christophe.p...@gmail.com wrote: Hi, I noticed an error in the GQL handler that prevents using datetime with GAE. In the GQL.py, function dateobj_to_datetime is dedicated to convert a date or time object into a datetime object. The issue is that the first test: if isinstance(object, datetime.date): object = datetime.datetime(object.year, object.month, object.day) is incorrect, because datetime.datetime inherits from datetime.date, and therefore the code intended solely for datetime.date is also applied to datetime.datetime. With the current implementation, hour, minutes and seconds are lost. Hopefully someone can make the change for a future release of web2py. Christophe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19187] width of the widget
Though I read that the width of the input adjusts according to the value of length of the fields type string, I see all equal, independently of the length. This is really like that or I understand something badly? Regards Jose --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19188] Re: Bug in crud.select?
On Mar 30, 7:13 pm, mdipierro mdipie...@cs.depaul.edu wrote: I will take a look tonight. Thanks to Massimo, this solution works (posted here for the archives): query = table.id 0 fields = [table[f] for f in table.fields if table[f].readable] rows=db(query).select(*fields) headers={} for field in fields: # Use custom or prettified label headers[str(field)]=field.label list=crud.select(table,fields=fields,headers=headers) F --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19189] Re: Input type button
Your last post did answer my question, though, the code didn't work. button onclick={{=URL(r=request,f='sayhi')}}click me/button when you click it will call the action sayhi(), For example def sayhi(): return dict(message=hello) The button does not redirect to the other page when clicked... On Apr 5, 7:04 am, mdipierro mdipie...@cs.depaul.edu wrote: The book on lulu.com should cost $12. On Apr 5, 5:03 am, Steve Shepherd sargs...@gmail.com wrote: Where did you find the book in pdf format for under $20? You should look at the the following code that allows a callback without updating the page. This would be great for a calculator. def index(): button1=TAG.BUTTON(_onclick=$.ajax({url: '%s', success: function (value) { $('#target').html(value); } }); % URL (r=request,f='callback')) div1=DIV(_id='target') return dict(button1=button1, div1=div1) class callback(): return H1('Hello world').xml() fixed a typo in code above. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19190] Re: width of the widget
No they are all the same. You can change the width with jQuery. Massimo On Apr 5, 4:25 pm, Jose jjac...@gmail.com wrote: Though I read that the width of the input adjusts according to the value of length of the fields type string, I see all equal, independently of the length. This is really like that or I understand something badly? Regards Jose --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19191] Re: A little app to make sema code...
i've just made a tiny tiny mod on this. in a controller: semaImageUrl = http://chart.apis.google.com/chart?chs=250x250chd=t:60,60cht=qrchoe=UTF-8chl=+statement and smth like this in a view: img src={{=semaImageUrl}}/ so I am using google chart api instead of calling local third party app, writing an image to disk.. reading image from disk.. This solution does not require installing third party code. I've done it for myself but maybe we should consider modyfing the appliance? In this case it would work out of the box. ? -- Kuba --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19192] Re: A little app to make sema code...
Nice useful! If you email me the new app I will post it. Massimo On Apr 5, 5:06 pm, Kuba Kucharski kuba.kuchar...@gmail.com wrote: i've just made a tiny tiny mod on this. in a controller: semaImageUrl = http://chart.apis.google.com/chart?chs=250x250chd=t:60,60cht=qrcho...+statement and smth like this in a view: img src={{=semaImageUrl}}/ so I am using google chart api instead of calling local third party app, writing an image to disk.. reading image from disk.. This solution does not require installing third party code. I've done it for myself but maybe we should consider modyfing the appliance? In this case it would work out of the box. ? -- Kuba --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19193] Issue displaying raw images inline
Hi all, hope someone has a suggestion on how to handle this issue, which I am running out of optiohns on how to deal with it. In MySQL, i have a table with a text (LONGTEXT) column that I use to store base64-encoded image information, I do low-level validation to make sure the data is actually an image, and the size and image properties (height, width) are always checked, in short, I only store data for very small images (avatars, in this case). I am positive that the base64-encoded data corresponds to that of a valid image if I base64-decode it. Since I store the raw data, I am also storing its content type in another column in the same table. Now, here is the problem: Here's my view: img src={{=apphelper.display_image(username=username)}} alt= / And my apphelper defined as a module and loaded up in one of my controllers has this: def display_image(self, auth_user): Returns the avatar raw data avatar_info = self.db (self.db.zf_member_avatars.auth_user==auth_user).select (self.db.zf_member_avatars.content_type, self.db.zf_member_avatars.avatar_image) if len(avatar_info): raw_image = base64.decodestring(avatar_info [0].avatar_image) self.response.headers['Content-Type'] = '%s' % (avatar_info [0].content_type) return raw_image Problem is that invariably I see the message The Image ... cannot be displayed because it contains errors. I am leaning towards this being some kind of encoding or something, if I view the contents of raw_image before is passed back to the view, the raw data is a correct, binary representation of my original file that I uploaded and encoded previously. Thanks for any pointers.. Julio --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19194] Re: Controller sub-folders
I am just trying to understand the limits of the framework... I just wonder if it is possible to have some controller functions written somewhere other than in files in the app/controllers/ folder, yet still have them be exposed via a file in controllers. Example: I have the following file structure: 1. app/controller/lib/sayhi.py - has code: def sayhi(): return dict (message=Hello) 2. app/controller/lib/__init__.py - empty file (maybe don't even have it there if not necessary to make this work) 3. app/controller/default.py - has code: def index(): return dict() and some code to expose sayhi() in app/controllers/lib/sayhi.py 4. app/view/index.html - has code: htmlbodya href={{=URL (r=request, f=sayhi)}}Say hi/a/body/html 5. app/view/sayhi.html - has code: htmlbody{{=message}}/body/ html On Apr 5, 2:24 pm, waTR roman.goldm...@gmail.com wrote: Not necessarily. I am just wondering if it is possible to have a controller within a sub-folder of the Controllers folder. like app/ Controllers/user/register/newuser where user is a sub folder, and register is the controller. I can't come up with any specific example of why I need this, though I still want to know if it's possible. Right now I am going to achieve the same intent just by importing the functions from the register controller into another controller in the Controllers folder. I think that should be the way to do it anyway, as the current web2py app/controller/function/arg setup is clear, simple, and very workable. On Apr 5, 2:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Just so that I inderstand. Instead of having controller files (like default.py), you want to have controller folders, so that each action is its own file? Massimo On Apr 5, 4:04 pm, waTR roman.goldm...@gmail.com wrote: Well, it is just a question as to whether this is possible. I was hoping to organize my project files via folders rather than simply controllers/functions. However, I realized I can achieve the same general effect via linking functions held within controller/sub-folder/ functions by importing them in controller/linker-controller. However, I was curious as it doesn't seem sub-folders are possible so far, and I was just wondering if someone was willing to play the devils advocate and just ask the question. I find it rather more productive to ask the question and ensure there is definetly a way to achieve the INTENT of project file organization with web2py via linking (which is actually completely fine). I just thought it might be interesting to have a controller and sub- folder tree that mirrors a website folder tree. I am just really not a fan of having 100 files in a single directory, and was hoping to keep it down to like 10 or less files per folder. Any suggestions as to some good practice for file management in web2py (file/folder make-up/organization)? My idea right now (based on what web2py can do), is have linker controllers under the Controllers folder, and have a bunch of sub- folders in the Controllers folder which will contain all the actual functions and business-logic. Any other ideas/suggestions? On Apr 5, 5:35 am, Vidul Petrov vidul.r...@gmail.com wrote: it is such an important feature for organizing a large project... Because? The controller itself provides a namespace, not the filesystem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19195] Re: Controller sub-folders
Hang on! This has already been proposed!! Has it been added yet? How was it resolved? Someone already proposed this, and it seems to have been accepted: http://groups.google.com/group/web2py/browse_thread/thread/1bc0711d6d7f925/e89d889a81099799?lnk=gstq=controllers#e89d889a81099799 This is EXACTLY what I am looking for. My web-app is a web-based accounting program, and I will have over 100 functions and I really want to keep the controllers folder organized and minimal and not have 100 .py files with 40 long functions in each file. I NEED a directory structure. However, I also don't want to screw with web2py's simplicity re controllers folder and url path (app/controller/function/ arg -- LOVE IT). Not having a proper source-code directory structure would totally screw-up my source-code management logic for this app. I really don't want to have all my functions defined in a long list of files under the same directory. Any status re the proposal in the post at this URL? http://groups.google.com/group/web2py/browse_thread/thread/1bc0711d6d7f925/e89d889a81099799?lnk=gstq=controllers#e89d889a81099799 On Apr 5, 4:15 pm, waTR roman.goldm...@gmail.com wrote: I am just trying to understand the limits of the framework... I just wonder if it is possible to have some controller functions written somewhere other than in files in the app/controllers/ folder, yet still have them be exposed via a file in controllers. Example: I have the following file structure: 1. app/controller/lib/sayhi.py - has code: def sayhi(): return dict (message=Hello) 2. app/controller/lib/__init__.py - empty file (maybe don't even have it there if not necessary to make this work) 3. app/controller/default.py - has code: def index(): return dict() and some code to expose sayhi() in app/controllers/lib/sayhi.py 4. app/view/index.html - has code: htmlbodya href={{=URL (r=request, f=sayhi)}}Say hi/a/body/html 5. app/view/sayhi.html - has code: htmlbody{{=message}}/body/ html On Apr 5, 2:24 pm, waTR roman.goldm...@gmail.com wrote: Not necessarily. I am just wondering if it is possible to have a controller within a sub-folder of the Controllers folder. like app/ Controllers/user/register/newuser where user is a sub folder, and register is the controller. I can't come up with any specific example of why I need this, though I still want to know if it's possible. Right now I am going to achieve the same intent just by importing the functions from the register controller into another controller in the Controllers folder. I think that should be the way to do it anyway, as the current web2py app/controller/function/arg setup is clear, simple, and very workable. On Apr 5, 2:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Just so that I inderstand. Instead of having controller files (like default.py), you want to have controller folders, so that each action is its own file? Massimo On Apr 5, 4:04 pm, waTR roman.goldm...@gmail.com wrote: Well, it is just a question as to whether this is possible. I was hoping to organize my project files via folders rather than simply controllers/functions. However, I realized I can achieve the same general effect via linking functions held within controller/sub-folder/ functions by importing them in controller/linker-controller. However, I was curious as it doesn't seem sub-folders are possible so far, and I was just wondering if someone was willing to play the devils advocate and just ask the question. I find it rather more productive to ask the question and ensure there is definetly a way to achieve the INTENT of project file organization with web2py via linking (which is actually completely fine). I just thought it might be interesting to have a controller and sub- folder tree that mirrors a website folder tree. I am just really not a fan of having 100 files in a single directory, and was hoping to keep it down to like 10 or less files per folder. Any suggestions as to some good practice for file management in web2py (file/folder make-up/organization)? My idea right now (based on what web2py can do), is have linker controllers under the Controllers folder, and have a bunch of sub- folders in the Controllers folder which will contain all the actual functions and business-logic. Any other ideas/suggestions? On Apr 5, 5:35 am, Vidul Petrov vidul.r...@gmail.com wrote: it is such an important feature for organizing a large project... Because? The controller itself provides a namespace, not the filesystem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group
[web2py:19196] Re: SQLFORM vs 3rd normal form...
Well I guess my particular need is in the ajax direction. I guess because I am new to the framework I am still trying to establish the best place to put code. On Mon, Apr 6, 2009 at 2:02 AM, mdipierro mdipie...@cs.depaul.edu wrote: However web2py seems to be moving more and more to constructing view elements in the controllers are with simple placement formating being defined in the views... what makes you think so? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19197] Re: using web2py for Geo / GIS stuff
I think it would be very valuable. Nice. What would you suggest? The web2py repository or an external one? Why not an example app? Regards, Timmie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19198] Re: The official Web2py Book by Massimo....for free?
Massimo you should place some really deep and exact explanation about the book status and reasons why it is not free to the website..:) agreed - why does Massimo never weigh in on these threads? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19199] Re: The official Web2py Book by Massimo....for free?
On Apr 5, 12:48 am, Yarko Tymciurak yark...@gmail.com wrote: Books will stand on their own, and (naturally) be the domain of the authors. that did not prevent the Django Project from both selling their book and allowing free downloads. On Apr 4, 11:59 pm, Kuba Kucharski kuba.kuchar...@gmail.com wrote: IT IS NOT ABOUT THE MONEY http://groups.google.com/group/web2py/msg/fa8ed72beefa7100 http://groups.google.com/group/web2py/msg/334375c7e0c4be53 Please, google before asking a question. Yes this question has been asked before, but it needs to be asked again because it is not yet resolved. Massimo says selling the book is not about money but that he needs to publish for academia. I am sure that is true because most authors do not make much money. However, as the Django Project shows it is possible to both publish and allow free download so this is not a real obstacle. For the record I did buy the book because I have already been using web2py for some time, but a beginner is unlikely. And my version is fast becoming out of date with all the new features. Unfortunately the wiki right now is still pretty empty and doesn't look like approaching the coverage of the manual for a long time. Baron --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19200] Re: session variable as parameter in SQL WHERE clause
Just getting back to this after a week. Massimo, the syntax you provided for the case indicated does indeed work. Thanks. Now I'm trying a variation of that case - adding an AND to the WHERE - and can't seem to get the syntax quite right (again). For the record, this is the case that works... rows=db.executesql('SELECT ... \ FROM ... \ WHERE table1.column = %s;' % sanitize (session.mysession1,'string','sqlite')) ... and this is the variation that's giving me trouble... rows=db.executesql('SELECT ... \ FROM ... \ WHERE table1.column = %s % sanitize (session.mysession1,'string','sqlite') \ ANDtable2.column = %s;' % sanitize (session.mysession2,'string','sqlite')) Above is one way I tried dealing with it, with no luck. I tried some other things too, like one sanitize() at the end with multiple arguments. Also, no luck. Any assistance is appreciated. On Mar 30, 10:03 am, mdipierro mdipie...@cs.depaul.edu wrote: On Mar 30, 8:51 am, ctalley ctal...@caci.com wrote: Is it possible to use a session variable as a parameter in a SQL WHERE clause? See example below. #assign value to session variable session.mysession = ... #use session variable in web2py DAL query #*this works* rows=db(db.table.column==session.mysession).select(...) this you can do #use session variable in SQL query #*this doesn't work* - 'no such column' error #is there any way to do this? rows=db.executesql('SELECT ... FROM ... WHERE table.column = session.mysession;') this you can but the syntax has to be different and you have to do in a way safe to prevent SQL injections. Should be: from gluon.sql import sql_represent as sanitize rows=db.executesql('SELECT ... FROM ... WHERE table.column = %s;' % sanitize (session.mysession,'string','sqlite') ) The obvious answer here is to just use what works (the DAL). However, I have some very complex queries already written in SQL and would rather not have to go to the trouble of morphing them into web2py DAL syntax. Thanks.- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19201] Invalid Markup
Hi, Is it possible to make the default markup for SQLFORMs w3c valid ? Right now there are hidden inputs (I suppose they're here for anti- CSRF) which are not in block elements. This problem can be addressed easily by using a fieldset. And also textareas have a type attribute which is not valid (what for ?). These issues may be minor but since browsers are very sensible, I prefer to avoid quirks. Mickael. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19202] Re: SQLFORM vs 3rd normal form...
Hi Steve, Erm, I'm not sure, I'm manually updating each field after verification so I guess you can update whatever you like there, I'm pretty new to this though so apologies if I'm missing your point! One of the issues that arises when trying to do this, as Massimo correctly predicted above, is the namespace clash when you have the same field name in multiple tables. I guess the way to deal with that is to prepend the table name onto the html input's name but for the time being I've just made sure all the field names I might need to stick in a form are unique in my model. I agree, generating significant html in the controller is something to be avoided longterm, ideally the controller would just pass all the constituent parts up to the view. I'm pretty new to web2py but I gather for a controller to be able to understand the returned values from a form the form has to be generated in that controller as it also generates other stuff like a nonce that it needs to matchup again after submission. I think the thing to do is to have a function just like form_factory except that it would return a dictionary of constituent parts rather than raw html. Something like... return { '_labels' : [ ('Enter Name','contact_name'), ('Enter Email','email_address') ], 'email_address' : 'input class=string id=no_table_email_address name=email_address type=text value= / ', 'contact_name' : 'input class=string id=no_table_contact_name name=contact_name type=text value= / ', '_form_start' : 'form action= enctype=multipart/ form-data method=post', '_form_end': 'input name=_formkey type=hidden value=afae447e-fb27-4bd1-b89c-d5bb6c130401 //form' } So you could write something like this in the view... {{ =form_bits['_form_start'] }} Please enter a name: {{=form_bits[contact_name]}}br And an Email: {{=form_bits[email_address]}}br {{ =form_bits['_form_end'] }} Or iterate through the _labels list and generate it programatically. I might have a look at the code later, see if it would be practical. The promise of autogenerated autoverified forms was one of the things that attracted me to web2py but there's no way I can use it longterm if it's going to insist on embedding them in tables! :) Roger. On Apr 5, 5:38 am, Steve Shepherd sargs...@gmail.com wrote: @Roger Does this address any hidden fields you may want updating. ie modified date, modfied by, ID? I like where your going... The only problem I have with this area is we are putting visual UI into controllers. The MVC model is supposed to put UI in the V portion. However web2py seems to be moving more and more to constructing view elements in the controllers are with simple placement formating being defined in the views... Just my ramblings --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19203] Database borked??
Hi, Somehow (don't ask me how!) I've managed to bork my database :-/ Appadmin let's me see all my tables except one, when I click on it's name it spews the message below. I don't care about the data inside, I'd just like to have my database rebuilt from the model so what's the best way to do that? db.my_table.truncate? db.my_table.drop? delete the contents of the 'databases' folder? Traceback (most recent call last): File /rahrahrah/web2py/gluon/restricted.py, line 98, in restricted exec ccode in environment File /rahrahrah/web2py/applications/tcrm/views/appadmin.html, line 102, in module File /rahrahrah/web2py/gluon/sqlhtml.py, line 605, in __init__ for (rc, record) in enumerate(sqlrows): File /rahrahrah/web2py/gluon/sql.py, line 2127, in __iter__ yield self[i] File /rahrahrah/web2py/gluon/sql.py, line 2082, in __getitem__ str(value)[:10].strip().split('-')] ValueError: need more than 1 value to unpack Cheers, Roger. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19204] Re: Do you need a FILENAME_SELECTOR?
Supposed for some reason our app need a full path filename (the name itself, not necessary the content), currently we have only one way to do that. We use a blank TEXT input field for user to type a long long dir name such as D:\Inside\a\deep\deep\dir\there\is\my\big \datafile.iso. It is not user friendly. The INPUT type=file... almost does the job but it only provide the file's basename i.e. datafile.iso in above example. (Perhaps I should change my proposed name FILENAME_SELECTOR into FULLNAME_SELECTOR.) My above conclusion is gathered on Windows. Don't know whether Linux or Mac has the same problem. However, the proposed FILENAME_SELECTOR should work cross platform because it only depends on javascript. Need an code example? 1) Put the class definition in my first post into a models/selector.py 2) write your controller: def test(): form=FORM(FILENAME_SELECTOR(_name='fullname'), INPUT(_type='submit')) if form.accepts(request.vars): return {'':request.vars.fullname} # Got a FULL path name return {'':form} This feature is useful if you are developing a file sharing system based on web2py, which need to know the full path name for later streaming. Or if you are developing a web-ui system to wrap all your command-line tools, you also need the full path name for a os.system (...) later. On Apr6, 2:19am, mdipierro mdipie...@cs.depaul.edu wrote: Could you explain more about what it does? On Apr 5, 12:03 pm, Iceberg iceb...@21cn.com wrote: Hi there, In one of my app I need to deal with local files. First I tried using INPUT(_type='text',...) to ask user to manually input the full path name of a specific file, such as C:\Program Files\Blah blah\foo \bar.exe. Obviously no one likes to type that long string. So I came up with this. Feel free to use it if you like. class FILENAME_SELECTOR(DIV): ''' Usage: In your controller: def action(): return {'':FORM(..., FILENAME_SELECTOR (_name='the_name'), ...)} After submit, the file name is in request.vars.the_name (but in UTF8 encoding!) ''' def __init__(self, *components, **attributes): name=attributes.get('_name','filename') components=[ INPUT(_type='file',_name='_%s'%abs(hash(self)), _onchange=document.getElementById ('%s').value=this.value%name), INPUT(_type='hidden',_name=name,_id=name),] super(FILENAME_SELECTOR,self).__init__(*components, **attributes) Regards, Iceberg --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19205] Possible Bug with Auth API on Web2Py ???
Hello mate, For some reasons when using a custom form with two forms in the same view the validation is not properly done. Here is an example with two forms (Login and Register) in the same view. The validation for the Email on the register form is not correct; the user is able to register several users with the same email even if this is set when the table is define (table.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, '%s.email' % self.settings.table_user._tablename)])... This problem occur ONLY when there are two forms on the same view... There is no problem on Email validation when we only have one form. Below is the sample of the controller and view: #Controller ### def logreg(): loginform = auth.login(next=profile) regform = auth.register(next=login) if regform.accepts(request.vars, formname='register'): pass if loginform.accepts(request.vars,formname='login'): pass return dict(regform = regform, loginform = loginform) #View ### # Register Form form action= enctype=multipart/form-data method=post input class=string id=auth_user_first_name name=first_name type=text value= {{=regform.latest.first_name}} //td input class=string id=auth_user_last_name name=last_name type=text value={{=regform.latest.last_name}} / input class=string id=auth_user_email name=email type=text value={{=regform.latest.email}} / input name=password2 type=password value={{=regform.latest.password}}/ input type=submit value=Submit / {{=regform.hidden_fields()}} /form # Login Form form action= enctype=multipart/form-data method=post input class=string id=auth_user_email name=email type=text value={{=loginform.latest.email}} / input class=password id=auth_user_password name=password type=password value={{=loginform.latest.password}}/ input type=submit value=Submit / {{=loginform.hidden_fields()}} /form # Did anyone already had the same issue ? Thanks for your attention, Yannick P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19207] Re: Possible Bug with Auth API on Web2Py ???
Hi Yannick, I see no problem with the following validation: db.auth_user.email.requires=[IS_EMAIL(),IS_NOT_IN_DB (db,'auth_user.email')] On Apr 6, 5:36 am, Yannick ytchatch...@gmail.com wrote: Hello mate, For some reasons when using a custom form with two forms in the same view the validation is not properly done. Here is an example with two forms (Login and Register) in the same view. The validation for the Email on the register form is not correct; the user is able to register several users with the same email even if this is set when the table is define (table.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, '%s.email' % self.settings.table_user._tablename)])... This problem occur ONLY when there are two forms on the same view... There is no problem on Email validation when we only have one form. Below is the sample of the controller and view: #Controller ### def logreg(): loginform = auth.login(next=profile) regform = auth.register(next=login) if regform.accepts(request.vars, formname='register'): pass if loginform.accepts(request.vars,formname='login'): pass return dict(regform = regform, loginform = loginform) #View ### # Register Form form action= enctype=multipart/form-data method=post input class=string id=auth_user_first_name name=first_name type=text value= {{=regform.latest.first_name}} //td input class=string id=auth_user_last_name name=last_name type=text value={{=regform.latest.last_name}} / input class=string id=auth_user_email name=email type=text value={{=regform.latest.email}} / input name=password2 type=password value={{=regform.latest.password}}/ input type=submit value=Submit / {{=regform.hidden_fields()}} /form # Login Form form action= enctype=multipart/form-data method=post input class=string id=auth_user_email name=email type=text value={{=loginform.latest.email}} / input class=password id=auth_user_password name=password type=password value={{=loginform.latest.password}}/ input type=submit value=Submit / {{=loginform.hidden_fields()}} /form # Did anyone already had the same issue ? Thanks for your attention, Yannick P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19209] Re: web2py and Python3
On Sun, Apr 5, 2009 at 12:07 AM, mdipierro mdipie...@cs.depaul.edu wrote: This issue is not porting. The issues are: 1) the database drivers have to be ported first. web2py and Django depend more or less on the same drivers 2) web2py supports the Google App Engine and that is Python 2.5. If we move to 3.0 your applications will not run anymore on the GAE. Google has no plan to move to 3.0. 3) A framework is not just based on Python. It requires that you code in Python. If people port Django to Python 3.0. Your Django applications will no longer work. The same is true for web2py. The bottom line is that we could port web2py to 3.0 in one week (technically it does not take much, except for str vs unicode we are already compliant) but it would be pointless to lose driver support, GAE support and break compatibility of all the current apps. When GAE moves to 3.0 and the database drivers for all supported backends become available we will release something like web3py (TM). Since we are going to break language backward compatibility that will also be a good time to include other non-backward compatible changes. 2010-2011 are reasonable dates but just a guess. You should not measure progress of a framework from this deadline, but from the number of commits. What feature of 3.0 do you consider so important to constraint you? Specifically, none. I only would want to know about the future of web2py to know when I'll have to invest in porting to Python 3. -- Álvaro Justen Peta5 - Telecomunicações e Software Livre 21 3021-6001 / 9898-0141 http://www.peta5.com.br/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19210] Is there a way to store session in memory?
Hi, does anyone know, is there a way to store session in memory? Even this means sessions will be lost if web2py restarts, but that is fine for some non-critical apps. Besides, this way we don't need to worry about cleaning up the old sessions anymore. And perhaps slightly faster. I have tried these in models/db.py but failed. (1) db=SQLDB('sqlite:memory:') # Actually here we get a new empty db everytime session.connect(request,response,db=db) # So sessions in last mem db can not bring to next click. (2) db=cache.ram('sqlmem',lambda:SQLDB('sqlite:memory:'),3600) session.connect(request, response, db=db) # It is tricky but doesn't work. Because this way sqlite complains multi thread accessing one db instance. (3) Actually I tried some more complicated code, trying to backup raw session data in cache.ram, and read them back into a new empty sqlite memory db. It almost works, but I don't know when I shall do the backup. The current session data seems not exist yet when the db.py is executing? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19211] Re: important about ajax forms
Here is one more demo: http://www.web2py.com/events/default/index Here is the source code: http://www.web2py.com/examples/static/web2py.app.events.tar Look into default.py and the associated view. Massimo On Apr 4, 2:24 pm, ceej cjlaz...@googlemail.com wrote: I think there should defiantly be an option to have the contents already loaded without having to click a link. On Apr 4, 11:50 am, mdipierro mdipie...@cs.depaul.edu wrote: Note to self. Things to be fixed: 1) the action needs knowledge on whether it is in a container. Solution: add a header that says so. 2) the action response needs to be able to reference other containers in order to trigger actions there. Right now each container is identified by a unique but random id and there is no way to guess it. Solution: have the user specify the name of each container. 3) if a container contains a form that selft submit and then redirect the content to a another action that also has a form. This second form will not work properly. Solution 1: the programmer needs to specify the [SQL]FORM(_action=) but this is a problem form legacy code that you want to ajaxify. Solution 2: have the jDiv code automatically determine the action from context. 4) right now every container has a link (that triggers the loading of the content) and a div with the content. To what extent should this be customizable? For example, you may want the container to have a top bar with additional buttons. Should this customization be a feature of the current container class (jDiv) or should the class be subclassed? This opens a big can of worms since the frame of the components needs to have some standard hooks in order to expose functions like reload the content, close it, etc. (what else?). can you think of anything else? Massimo On Apr 4, 1:02 am, mdipierro mdipie...@cs.depaul.edu wrote: I re-posted a slightly better version. The new version work in this way: say you have an action like: def myform(): form=SQLFORM(...) if form.accepts(): # do something redirect(URL()); return dict(form=form) You can turn it into a partial by replacing redirect with jDiv.redirect or jDiv.flash def myform(): form=SQLFORM(...) if form.accepts(): # do something jDiv.redirect(done!!!); return dict(form=form) and create a view that DOES NOT extend the layout and does not have HTML and BODY tags. Something like this will do: {{=form}} Then create a parent action and in the view embed this partial {{=jDiv(click me to ajax the partial,URL(r=request,f=myform))}} Mind that a partial can be served by another application (within the same web2py installation), can be a proxy to a different web-site and can contain an IFRAME (not recommended but possible). @Yarko. I agree that this that this is not yet a complete solution but more of a hack. Nevertheless it lets you take forms you have already created and turn them into ajax forms. It does not require any modification in web2py nor any third party libraries (it only requires the new layout and new web2py_ajax.html). I have been looking but I cannot really find a detailed decsription of how those other systems work. On Apr 3, 11:19 pm, ceej cjlaz...@googlemail.com wrote: I'm really liking this idea Massimo, I'm going to be using it in a project I'm about to start and grow on it :) Keeps using ajax very DRY. On Apr 3, 4:08 pm, mdipierro mdipie...@cs.depaul.edu wrote: There has been a lot of discussion in the past about forms that submit via ajax and may or may not refresh the entire page. It is also useful to be able to break html pages into modules or plugins or components each with its own model, view, controller in such a way that they communicate both serversize (by sharing session and database) and clientsize (one boxed component should be able for example to refresh the entire page or trigger a flash). I have prototype application that does this. http://www.web2py.com/examples/static/web2py.app.events.tar It uses jquery publisher subscriber mechanism. All the code is in a new web2py_ajax and a class call jDiv (similar to Rails Partial but more powerful in my opinion) which I could include in html.py It allows you to write code like this: def index(): return dict(partial1=jDiv('click me for text','mycallback1'), partial2=jDiv('click me for flash','mycallback2'), partial3=jDiv('click me to redirect','mycallback3'), partial4=jDiv('click me for form','mycallback4')) def mycallback1(): return 'hello world' def mycallback2(): return jDiv.flash('this is a test') # flash on the container page def
[web2py:19213] Re: Controller sub-folders
That is a very old thread about T2. As in any Python program/framework you can define functions in modules and create any directory structure you want. In order to expose a function from a module as an action you still need one line in the controller: #in default.py import applications.myapp.modules.sayhi as mymodule def sayhi(): return mymodule.sayhi() You will have to pass globals() or request, response, session, cache and T to the function in the module. Massimo On Apr 5, 6:29 pm, waTR roman.goldm...@gmail.com wrote: Hang on! This has already been proposed!! Has it been added yet? How was it resolved? Someone already proposed this, and it seems to have been accepted:http://groups.google.com/group/web2py/browse_thread/thread/1bc0711d6d... This is EXACTLY what I am looking for. My web-app is a web-based accounting program, and I will have over 100 functions and I really want to keep the controllers folder organized and minimal and not have 100 .py files with 40 long functions in each file. I NEED a directory structure. However, I also don't want to screw with web2py's simplicity re controllers folder and url path (app/controller/function/ arg -- LOVE IT). Not having a proper source-code directory structure would totally screw-up my source-code management logic for this app. I really don't want to have all my functions defined in a long list of files under the same directory. Any status re the proposal in the post at this URL?http://groups.google.com/group/web2py/browse_thread/thread/1bc0711d6d... On Apr 5, 4:15 pm, waTR roman.goldm...@gmail.com wrote: I am just trying to understand the limits of the framework... I just wonder if it is possible to have some controller functions written somewhere other than in files in the app/controllers/ folder, yet still have them be exposed via a file in controllers. Example: I have the following file structure: 1. app/controller/lib/sayhi.py - has code: def sayhi(): return dict (message=Hello) 2. app/controller/lib/__init__.py - empty file (maybe don't even have it there if not necessary to make this work) 3. app/controller/default.py - has code: def index(): return dict() and some code to expose sayhi() in app/controllers/lib/sayhi.py 4. app/view/index.html - has code: htmlbodya href={{=URL (r=request, f=sayhi)}}Say hi/a/body/html 5. app/view/sayhi.html - has code: htmlbody{{=message}}/body/ html On Apr 5, 2:24 pm, waTR roman.goldm...@gmail.com wrote: Not necessarily. I am just wondering if it is possible to have a controller within a sub-folder of the Controllers folder. like app/ Controllers/user/register/newuser where user is a sub folder, and register is the controller. I can't come up with any specific example of why I need this, though I still want to know if it's possible. Right now I am going to achieve the same intent just by importing the functions from the register controller into another controller in the Controllers folder. I think that should be the way to do it anyway, as the current web2py app/controller/function/arg setup is clear, simple, and very workable. On Apr 5, 2:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Just so that I inderstand. Instead of having controller files (like default.py), you want to have controller folders, so that each action is its own file? Massimo On Apr 5, 4:04 pm, waTR roman.goldm...@gmail.com wrote: Well, it is just a question as to whether this is possible. I was hoping to organize my project files via folders rather than simply controllers/functions. However, I realized I can achieve the same general effect via linking functions held within controller/sub-folder/ functions by importing them in controller/linker-controller. However, I was curious as it doesn't seem sub-folders are possible so far, and I was just wondering if someone was willing to play the devils advocate and just ask the question. I find it rather more productive to ask the question and ensure there is definetly a way to achieve the INTENT of project file organization with web2py via linking (which is actually completely fine). I just thought it might be interesting to have a controller and sub- folder tree that mirrors a website folder tree. I am just really not a fan of having 100 files in a single directory, and was hoping to keep it down to like 10 or less files per folder. Any suggestions as to some good practice for file management in web2py (file/folder make-up/organization)? My idea right now (based on what web2py can do), is have linker controllers under the Controllers folder, and have a bunch of sub- folders in the Controllers folder which will contain all the actual functions and business-logic. Any other ideas/suggestions? On Apr 5, 5:35 am, Vidul Petrov vidul.r...@gmail.com wrote:
[web2py:19214] Re: using web2py for Geo / GIS stuff
I would just create a separate project on launchpad or somewhere else. Massimo On Apr 5, 6:49 pm, Tim Michelsen timmichel...@gmx-topmail.de wrote: I think it would be very valuable. Nice. What would you suggest? The web2py repository or an external one? Why not an example app? Regards, Timmie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19215] Re: session variable as parameter in SQL WHERE clause
This should work rows=db.executesql('SELECT ... \ FROM ... \ WHERE table1.column = %s ANDtable2.column = %s;' % \ (sanitize(session.mysession1,'string','sqlite'), sanitize(session.mysession2,'string','sqlite'))) why are you doing this again? On Apr 5, 7:17 pm, ctalley ctal...@caci.com wrote: Just getting back to this after a week. Massimo, the syntax you provided for the case indicated does indeed work. Thanks. Now I'm trying a variation of that case - adding an AND to the WHERE - and can't seem to get the syntax quite right (again). For the record, this is the case that works... rows=db.executesql('SELECT ... \ FROM ... \ WHERE table1.column = %s;' % sanitize (session.mysession1,'string','sqlite')) ... and this is the variation that's giving me trouble... rows=db.executesql('SELECT ... \ FROM ... \ WHERE table1.column = %s % sanitize (session.mysession1,'string','sqlite') \ AND table2.column = %s;' % sanitize (session.mysession2,'string','sqlite')) Above is one way I tried dealing with it, with no luck. I tried some other things too, like one sanitize() at the end with multiple arguments. Also, no luck. Any assistance is appreciated. On Mar 30, 10:03 am, mdipierro mdipie...@cs.depaul.edu wrote: On Mar 30, 8:51 am, ctalley ctal...@caci.com wrote: Is it possible to use a session variable as a parameter in a SQL WHERE clause? See example below. #assign value to session variable session.mysession = ... #use session variable in web2py DAL query #*this works* rows=db(db.table.column==session.mysession).select(...) this you can do #use session variable in SQL query #*this doesn't work* - 'no such column' error #is there any way to do this? rows=db.executesql('SELECT ... FROM ... WHERE table.column = session.mysession;') this you can but the syntax has to be different and you have to do in a way safe to prevent SQL injections. Should be: from gluon.sql import sql_represent as sanitize rows=db.executesql('SELECT ... FROM ... WHERE table.column = %s;' % sanitize (session.mysession,'string','sqlite') ) The obvious answer here is to just use what works (the DAL). However, I have some very complex queries already written in SQL and would rather not have to go to the trouble of morphing them into web2py DAL syntax. Thanks.- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19216] Re: Invalid Markup
This may break backward compatibility. Anyway, send me an example of how you think the output should be. Massimo On Apr 5, 8:09 pm, desfrenes desfre...@gmail.com wrote: Hi, Is it possible to make the default markup for SQLFORMs w3c valid ? Right now there are hidden inputs (I suppose they're here for anti- CSRF) which are not in block elements. This problem can be addressed easily by using a fieldset. And also textareas have a type attribute which is not valid (what for ?). These issues may be minor but since browsers are very sensible, I prefer to avoid quirks. Mickael. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19217] Re: Possible Bug with Auth API on Web2Py ???
I am very confused by this: loginform = auth.login(next=profile) regform = auth.register(next=login) if regform.accepts(request.vars, formname='register'): ## WRONG pass if loginform.accepts(request.vars,formname='login'): ## WRONG pass auth.login(...) INCLUDES form processing (accepts). On Apr 5, 9:36 pm, Yannick ytchatch...@gmail.com wrote: Hello mate, For some reasons when using a custom form with two forms in the same view the validation is not properly done. Here is an example with two forms (Login and Register) in the same view. The validation for the Email on the register form is not correct; the user is able to register several users with the same email even if this is set when the table is define (table.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, '%s.email' % self.settings.table_user._tablename)])... This problem occur ONLY when there are two forms on the same view... There is no problem on Email validation when we only have one form. Below is the sample of the controller and view: #Controller ### def logreg(): loginform = auth.login(next=profile) regform = auth.register(next=login) if regform.accepts(request.vars, formname='register'): pass if loginform.accepts(request.vars,formname='login'): pass return dict(regform = regform, loginform = loginform) #View ### # Register Form form action= enctype=multipart/form-data method=post input class=string id=auth_user_first_name name=first_name type=text value= {{=regform.latest.first_name}} //td input class=string id=auth_user_last_name name=last_name type=text value={{=regform.latest.last_name}} / input class=string id=auth_user_email name=email type=text value={{=regform.latest.email}} / input name=password2 type=password value={{=regform.latest.password}}/ input type=submit value=Submit / {{=regform.hidden_fields()}} /form # Login Form form action= enctype=multipart/form-data method=post input class=string id=auth_user_email name=email type=text value={{=loginform.latest.email}} / input class=password id=auth_user_password name=password type=password value={{=loginform.latest.password}}/ input type=submit value=Submit / {{=loginform.hidden_fields()}} /form # Did anyone already had the same issue ? Thanks for your attention, Yannick P. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19218] Re: Controller sub-folders
I think that might solve it. Though, are there any plans to make it a little easier? Like say by making a expose(mymodule) or something? Nothing serious, though. The method you describe is sufficient to achieve the desired results, and listing one-liner definition links are no big deal. Cheers On Apr 5, 9:35 pm, mdipierro mdipie...@cs.depaul.edu wrote: That is a very old thread about T2. As in any Python program/framework you can define functions in modules and create any directory structure you want. In order to expose a function from a module as an action you still need one line in the controller: #in default.py import applications.myapp.modules.sayhi as mymodule def sayhi(): return mymodule.sayhi() You will have to pass globals() or request, response, session, cache and T to the function in the module. Massimo On Apr 5, 6:29 pm, waTR roman.goldm...@gmail.com wrote: Hang on! This has already been proposed!! Has it been added yet? How was it resolved? Someone already proposed this, and it seems to have been accepted:http://groups.google.com/group/web2py/browse_thread/thread/1bc0711d6d... This is EXACTLY what I am looking for. My web-app is a web-based accounting program, and I will have over 100 functions and I really want to keep the controllers folder organized and minimal and not have 100 .py files with 40 long functions in each file. I NEED a directory structure. However, I also don't want to screw with web2py's simplicity re controllers folder and url path (app/controller/function/ arg -- LOVE IT). Not having a proper source-code directory structure would totally screw-up my source-code management logic for this app. I really don't want to have all my functions defined in a long list of files under the same directory. Any status re the proposal in the post at this URL?http://groups.google.com/group/web2py/browse_thread/thread/1bc0711d6d... On Apr 5, 4:15 pm, waTR roman.goldm...@gmail.com wrote: I am just trying to understand the limits of the framework... I just wonder if it is possible to have some controller functions written somewhere other than in files in the app/controllers/ folder, yet still have them be exposed via a file in controllers. Example: I have the following file structure: 1. app/controller/lib/sayhi.py - has code: def sayhi(): return dict (message=Hello) 2. app/controller/lib/__init__.py - empty file (maybe don't even have it there if not necessary to make this work) 3. app/controller/default.py - has code: def index(): return dict() and some code to expose sayhi() in app/controllers/lib/sayhi.py 4. app/view/index.html - has code: htmlbodya href={{=URL (r=request, f=sayhi)}}Say hi/a/body/html 5. app/view/sayhi.html - has code: htmlbody{{=message}}/body/ html On Apr 5, 2:24 pm, waTR roman.goldm...@gmail.com wrote: Not necessarily. I am just wondering if it is possible to have a controller within a sub-folder of the Controllers folder. like app/ Controllers/user/register/newuser where user is a sub folder, and register is the controller. I can't come up with any specific example of why I need this, though I still want to know if it's possible. Right now I am going to achieve the same intent just by importing the functions from the register controller into another controller in the Controllers folder. I think that should be the way to do it anyway, as the current web2py app/controller/function/arg setup is clear, simple, and very workable. On Apr 5, 2:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Just so that I inderstand. Instead of having controller files (like default.py), you want to have controller folders, so that each action is its own file? Massimo On Apr 5, 4:04 pm, waTR roman.goldm...@gmail.com wrote: Well, it is just a question as to whether this is possible. I was hoping to organize my project files via folders rather than simply controllers/functions. However, I realized I can achieve the same general effect via linking functions held within controller/sub-folder/ functions by importing them in controller/linker-controller. However, I was curious as it doesn't seem sub-folders are possible so far, and I was just wondering if someone was willing to play the devils advocate and just ask the question. I find it rather more productive to ask the question and ensure there is definetly a way to achieve the INTENT of project file organization with web2py via linking (which is actually completely fine). I just thought it might be interesting to have a controller and sub- folder tree that mirrors a website folder tree. I am just really not a fan of having 100 files in a single directory, and was hoping to keep it down to like 10 or less files per folder.
[web2py:19219] Re: Database borked??
Let me guess... you changed a field from 'string' to 'datetime' using sqlite? sqlite does not enforces field types hence it let you do the migration even if there was data in there that is not of type 'datetime'. You need to clean up that column. In your model do this db(db.youtable.id0).update(thedatetimefield=None) run appadmin once than remove the above line. Massimo On Apr 5, 9:10 pm, web2py at technicalbloke.com technicalbl...@googlemail.com wrote: Hi, Somehow (don't ask me how!) I've managed to bork my database :-/ Appadmin let's me see all my tables except one, when I click on it's name it spews the message below. I don't care about the data inside, I'd just like to have my database rebuilt from the model so what's the best way to do that? db.my_table.truncate? db.my_table.drop? delete the contents of the 'databases' folder? Traceback (most recent call last): File /rahrahrah/web2py/gluon/restricted.py, line 98, in restricted exec ccode in environment File /rahrahrah/web2py/applications/tcrm/views/appadmin.html, line 102, in module File /rahrahrah/web2py/gluon/sqlhtml.py, line 605, in __init__ for (rc, record) in enumerate(sqlrows): File /rahrahrah/web2py/gluon/sql.py, line 2127, in __iter__ yield self[i] File /rahrahrah/web2py/gluon/sql.py, line 2082, in __getitem__ str(value)[:10].strip().split('-')] ValueError: need more than 1 value to unpack Cheers, Roger. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19220] Re: WSGI alias root + other WSGI apps.
I strongly suggest you do not run web2py as root. On Apr 5, 11:00 pm, gabe gplax...@gmail.com wrote: I am trying to host a website with web2py. The main site is built with web2py and host with apache + mod_wsgi -- WSGIScriptAlias as root. Now, I also host a wiki (moinmoin w/ wsgi) and WSGIScriptAlias as / moin. All the directives are in one virtual host file: the Web2py stuff per Dr. Di Pierro's book, and moinmoin per their website (http://moinmo.in/ HelpOnInstalling/ApacheWithModWSGI). Obviously, since web2py is root, no other wsgi app can be rendered -- eg: link to /mydomain.com/wiki -- Invalid request. How do I get around this? I researched online and tried to reconfigure unsuccesfully. Anyone have any suggestions and/or links to direct me to. Thanks for your help (and not letting my weekend become unproductive). -Gabe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19221] Re: Is there a way to store session in memory?
I think... from gluon.contrib.memdb import MEMDB session.connect(request, response, db=MEMDB(cache.ram)) On Apr 5, 11:14 pm, Iceberg iceb...@21cn.com wrote: Hi, does anyone know, is there a way to store session in memory? Even this means sessions will be lost if web2py restarts, but that is fine for some non-critical apps. Besides, this way we don't need to worry about cleaning up the old sessions anymore. And perhaps slightly faster. I have tried these in models/db.py but failed. (1) db=SQLDB('sqlite:memory:') # Actually here we get a new empty db everytime session.connect(request,response,db=db) # So sessions in last mem db can not bring to next click. (2) db=cache.ram('sqlmem',lambda:SQLDB('sqlite:memory:'),3600) session.connect(request, response, db=db) # It is tricky but doesn't work. Because this way sqlite complains multi thread accessing one db instance. (3) Actually I tried some more complicated code, trying to backup raw session data in cache.ram, and read them back into a new empty sqlite memory db. It almost works, but I don't know when I shall do the backup. The current session data seems not exist yet when the db.py is executing? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19222] Re: Controller sub-folders
Look into gluon/tools.py and how Auth exposes multiple methods with a single controller action. On Apr 5, 11:58 pm, waTR roman.goldm...@gmail.com wrote: I think that might solve it. Though, are there any plans to make it a little easier? Like say by making a expose(mymodule) or something? Nothing serious, though. The method you describe is sufficient to achieve the desired results, and listing one-liner definition links are no big deal. Cheers On Apr 5, 9:35 pm, mdipierro mdipie...@cs.depaul.edu wrote: That is a very old thread about T2. As in any Python program/framework you can define functions in modules and create any directory structure you want. In order to expose a function from a module as an action you still need one line in the controller: #in default.py import applications.myapp.modules.sayhi as mymodule def sayhi(): return mymodule.sayhi() You will have to pass globals() or request, response, session, cache and T to the function in the module. Massimo On Apr 5, 6:29 pm, waTR roman.goldm...@gmail.com wrote: Hang on! This has already been proposed!! Has it been added yet? How was it resolved? Someone already proposed this, and it seems to have been accepted:http://groups.google.com/group/web2py/browse_thread/thread/1bc0711d6d... This is EXACTLY what I am looking for. My web-app is a web-based accounting program, and I will have over 100 functions and I really want to keep the controllers folder organized and minimal and not have 100 .py files with 40 long functions in each file. I NEED a directory structure. However, I also don't want to screw with web2py's simplicity re controllers folder and url path (app/controller/function/ arg -- LOVE IT). Not having a proper source-code directory structure would totally screw-up my source-code management logic for this app. I really don't want to have all my functions defined in a long list of files under the same directory. Any status re the proposal in the post at this URL?http://groups.google.com/group/web2py/browse_thread/thread/1bc0711d6d... On Apr 5, 4:15 pm, waTR roman.goldm...@gmail.com wrote: I am just trying to understand the limits of the framework... I just wonder if it is possible to have some controller functions written somewhere other than in files in the app/controllers/ folder, yet still have them be exposed via a file in controllers. Example: I have the following file structure: 1. app/controller/lib/sayhi.py - has code: def sayhi(): return dict (message=Hello) 2. app/controller/lib/__init__.py - empty file (maybe don't even have it there if not necessary to make this work) 3. app/controller/default.py - has code: def index(): return dict() and some code to expose sayhi() in app/controllers/lib/sayhi.py 4. app/view/index.html - has code: htmlbodya href={{=URL (r=request, f=sayhi)}}Say hi/a/body/html 5. app/view/sayhi.html - has code: htmlbody{{=message}}/body/ html On Apr 5, 2:24 pm, waTR roman.goldm...@gmail.com wrote: Not necessarily. I am just wondering if it is possible to have a controller within a sub-folder of the Controllers folder. like app/ Controllers/user/register/newuser where user is a sub folder, and register is the controller. I can't come up with any specific example of why I need this, though I still want to know if it's possible. Right now I am going to achieve the same intent just by importing the functions from the register controller into another controller in the Controllers folder. I think that should be the way to do it anyway, as the current web2py app/controller/function/arg setup is clear, simple, and very workable. On Apr 5, 2:11 pm, mdipierro mdipie...@cs.depaul.edu wrote: Just so that I inderstand. Instead of having controller files (like default.py), you want to have controller folders, so that each action is its own file? Massimo On Apr 5, 4:04 pm, waTR roman.goldm...@gmail.com wrote: Well, it is just a question as to whether this is possible. I was hoping to organize my project files via folders rather than simply controllers/functions. However, I realized I can achieve the same general effect via linking functions held within controller/sub-folder/ functions by importing them in controller/linker-controller. However, I was curious as it doesn't seem sub-folders are possible so far, and I was just wondering if someone was willing to play the devils advocate and just ask the question. I find it rather more productive to ask the question and ensure there is definetly a way to achieve the INTENT of project file organization with web2py via linking (which is actually completely fine). I just thought it might be interesting to
[web2py:19223] Re: Database borked??
Actually no, I moved the web2py folder somewhere else,worked on my project for a while then noticed said weirdness, moved it back to where it was but still problem remains. As I said there's no data I need in the db so I figure wiping it would be faster than trying to diagnose and fix the error. I take it from the procedure above 'truncate' would do this? :) Roger. On Apr 6, 1:01 am, mdipierro mdipie...@cs.depaul.edu wrote: Let me guess... you changed a field from 'string' to 'datetime' using sqlite? sqlite does not enforces field types hence it let you do the migration even if there was data in there that is not of type 'datetime'. You need to clean up that column. In your model do this db(db.youtable.id0).update(thedatetimefield=None) run appadmin once than remove the above line. Massimo On Apr 5, 9:10 pm, web2py at technicalbloke.com technicalbl...@googlemail.com wrote: Hi, Somehow (don't ask me how!) I've managed to bork my database :-/ Appadmin let's me see all my tables except one, when I click on it's name it spews the message below. I don't care about the data inside, I'd just like to have my database rebuilt from the model so what's the best way to do that? db.my_table.truncate? db.my_table.drop? delete the contents of the 'databases' folder? Traceback (most recent call last): File /rahrahrah/web2py/gluon/restricted.py, line 98, in restricted exec ccode in environment File /rahrahrah/web2py/applications/tcrm/views/appadmin.html, line 102, in module File /rahrahrah/web2py/gluon/sqlhtml.py, line 605, in __init__ for (rc, record) in enumerate(sqlrows): File /rahrahrah/web2py/gluon/sql.py, line 2127, in __iter__ yield self[i] File /rahrahrah/web2py/gluon/sql.py, line 2082, in __getitem__ str(value)[:10].strip().split('-')] ValueError: need more than 1 value to unpack Cheers, Roger. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19224] Re: The official Web2py Book by Massimo....for free?
First of all this question pops up almost weekly and I have responded many times. Anyway, I am going to respond once more, but please first ask yourself: How do you earn your leaving? Why don't you work for free? I do not make money from the book (just enough to pay for web2py expenses, like the web2py pycon hats) but I make money as a professor (in order to pay my mortgage and feed my family). In my job I get evaluated yearly for my publications not for the open source code I write. The printed book counts as a publication and partially accounts for the time I spend on web2py. Moreover a printed book gives web2py a certain weight among professionals (who understands that not everything comes for free). Finally, you should know, that I have contacted many publishers and I have been unable to find a publisher that would allow me to publish the book and also allow me to release it for free. This is not a book written by the community and there are books on Django, Rails, TG, etc, that do not have a free online version. The creators of Django make money from software development and consulting. For them the book is publicity. I find very odd that you ask me to justify why not everything I do is free. I guess I could change the business model, give the book for free, quit my job and charge you to answer your questions about web2py. Massimo On Apr 5, 6:54 pm, Baron richar...@gmail.com wrote: Massimo you should place some really deep and exact explanation about the book status and reasons why it is not free to the website..:) agreed - why does Massimo never weigh in on these threads? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19225] Re: Database borked??
This problem cannot originate from moving the database unless you moved the database but not the .table files (which contain metadata required for migrations). In this case the only the safe way is drop the table and delete the associated databases/*.table files. Massimo On Apr 6, 12:15 am, web2py at technicalbloke.com technicalbl...@googlemail.com wrote: Actually no, I moved the web2py folder somewhere else,worked on my project for a while then noticed said weirdness, moved it back to where it was but still problem remains. As I said there's no data I need in the db so I figure wiping it would be faster than trying to diagnose and fix the error. I take it from the procedure above 'truncate' would do this? :) Roger. On Apr 6, 1:01 am, mdipierro mdipie...@cs.depaul.edu wrote: Let me guess... you changed a field from 'string' to 'datetime' using sqlite? sqlite does not enforces field types hence it let you do the migration even if there was data in there that is not of type 'datetime'. You need to clean up that column. In your model do this db(db.youtable.id0).update(thedatetimefield=None) run appadmin once than remove the above line. Massimo On Apr 5, 9:10 pm, web2py at technicalbloke.com technicalbl...@googlemail.com wrote: Hi, Somehow (don't ask me how!) I've managed to bork my database :-/ Appadmin let's me see all my tables except one, when I click on it's name it spews the message below. I don't care about the data inside, I'd just like to have my database rebuilt from the model so what's the best way to do that? db.my_table.truncate? db.my_table.drop? delete the contents of the 'databases' folder? Traceback (most recent call last): File /rahrahrah/web2py/gluon/restricted.py, line 98, in restricted exec ccode in environment File /rahrahrah/web2py/applications/tcrm/views/appadmin.html, line 102, in module File /rahrahrah/web2py/gluon/sqlhtml.py, line 605, in __init__ for (rc, record) in enumerate(sqlrows): File /rahrahrah/web2py/gluon/sql.py, line 2127, in __iter__ yield self[i] File /rahrahrah/web2py/gluon/sql.py, line 2082, in __getitem__ str(value)[:10].strip().split('-')] ValueError: need more than 1 value to unpack Cheers, Roger. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:19226] Re: Is there a way to store session in memory?
Thanks for the hint. I did not notice MEMDB. But, too bad that it does not work either. Traceback (most recent call last): File gluon/main.py, line 323, in wsgibase File gluon/globals.py, line 313, in _try_store_in_db File gluon/contrib/memdb.py, line 250, in insert File gluon/contrib/memdb.py, line 285, in _create_id AttributeError: 'CacheInRam' object has no attribute 'incr' It seems the memdb.py does not wrap enough interface to simulate a db? On Apr6, 1:04pm, mdipierro mdipie...@cs.depaul.edu wrote: I think... from gluon.contrib.memdb import MEMDB session.connect(request, response, db=MEMDB(cache.ram)) On Apr 5, 11:14 pm, Iceberg iceb...@21cn.com wrote: Hi, does anyone know, is there a way to store session in memory? Even this means sessions will be lost if web2py restarts, but that is fine for some non-critical apps. Besides, this way we don't need to worry about cleaning up the old sessions anymore. And perhaps slightly faster. I have tried these in models/db.py but failed. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---