[web2py] Re: Python 3 and the future of web2py
Let us know about any problems you find when you try web2py on Py3.x, ok?
[web2py] web2py - Best Practice
Dear friends, I am a huge web2py fan and would like to propose an idea to the community. I understand that web2py is a development environment and has it’s roots as an educational platform. One of the things that I have personally found most useful are the free appliances. However as web2py has matured over time a lot of these have become dated and as new developments have emerged I have often been confused about best practices going forward. I would like to propose that we develop a suite of products (open source of course) based on the best practices of web2py that would be: Useful and usable by non-programmers Serve as a focal point for the community on just how great web2py could be Serve as a template for developers To be clear the idea is to create a separate project from web2py itself and then find the best of breed products and develop them in web2py. Things like: A Wiki / Blog / CMS / Forum An Online Store A Personal Accounting System A Media Center etc ... The focus would be on producing complete usable and beautiful applications. I feel that the creation of a separate project will have some important advantages such as: We can create a “brand” around the products. It will not “hijack” the core web2py focus. Can have separate focus such as functionality and look and feel Can include complimentary, tested projects such as open source icons and skins Can have it’s own development cycle, (eg release every 6 months) Can have it’s own repositories etc. Ultimately the products could be made available by web hosts just by the click of a button just like the php ones are now. I am very interested in the thoughts of the community and if there is interest I will move to the next step and create a site (probably on GAE) for further discussion such as: decide on a name decide on goals decide on processes find a home decide on products etc ...
[web2py] Re: Web2py uses Django... on GAE
This is a GAE bug and we should open a ticket. GAE should not issue warning about libraries we do not use and we should not reference libraries we do not use to make the warnings go away. Do you want to file the bug report? I not, I will do it. On Jul 12, 7:45 pm, howesc how...@umich.edu wrote: this warning popped up recently when GAE started bundling 2 versions of django. by default it still uses the old version of django in case you needed it for your project. there is a flag somewhere that can be set to tell GAE to use the new version of django. i assume we could find and set the flag even though we use none of the django code.
[web2py] Re: Admin security: https vs localhost
that cannot be done. The admin password is set locally always, never remotely (unless you change it via admin). On Jul 12, 7:55 pm, Anthony abasta...@gmail.com wrote: If you add a complexity requirement, make it for remote connections only. Anthony On Tuesday, July 12, 2011 6:32:48 PM UTC-4, Massimo Di Pierro wrote: we can make a delay default to 1 second and double it every failed attempt. we should add complexity. I would take a patch or add an issue in google code. On Jul 12, 8:01 am, cjrh caleb.h...@gmail.com wrote: I like the timeout/delay idea for a failed password, and I very much like the IP block after a number of failed attempts, but I am not too fond of a complexity requirement. During development on my local machine (bound to localhost), my standard admin password is a. I would have to have to deal with a complexity checker during development; and if we then say it will be enabled only for production but not dev, then we need more code and error-handling to manage the distinction, and it all becomes a lot of work. I think the safeguards that are currently in web2py are quite sufficient, and we can improve it a little bit more by penalizing brute force on the password, as pbreit pointed out is currently vulnerable.
[web2py] Re: After CAS login, password is reset
I suspect your problem is that both apps connect to the same databases. If you use CAS youhave consumer and provider. If the two apps use the same DB, there is no need for CAS. You use CAS because the two apps do not have the same db. Therefore is correct for the consumer to reset the password to null since the consumer must use the provider password for login. On Jul 13, 12:28 am, Lucas D'Avila lucass...@gmail.com wrote: Hello! I'm making some tests with the new CAS, but at some point after login the user's password is reset (set to NULL in the database), I think it's because in line 1629 of Class gluon.tools.Auth (trunk version), the variable cas_user [passfield] is set as None, then the method self.get_or_create_user() is called that updates the password to null in database This is a bug, or i'm doing something wrong? My environment are two applications (copies of wellcome app), with the following models: * * *accounts_app/models/db.py:* auth_db = DAL('postgres://postgres:postgres@localhost/accounts') db_session = DAL('sqlite://storage.sqlite') session.connect(request = request, response = response, db = db_session) from gluon.tools import Auth auth = Auth(db = auth_db) auth.define_tables(username=True) *client_app/models/db.py:* auth_db = DAL('postgres://postgres:postgres@localhost/accounts') db_session = DAL('sqlite://storage.sqlite') session.connect(request = request, response = response, db = db_session) auth = Auth(db = auth_db, cas_provider='http://localhost:8000/accounts/default/user/cas') auth.define_tables(username=True, migrate = False) auth.settings.login_form=CasAuth(globals(), urlbase = http://localhost:8000/accounts/default/user/cas;, actions=['login', 'validate', 'logout']) One more doubt, is correct to connect both applications on the same (auth) database? was the way I found to keep the permissions centralized in one place. -- *Lucas D'Avila*https://github.com/lucasdavila
[web2py] tomorrow in San Francisco
I look forward to meet some of you tomorrow: http://www.meetup.com/sfpython/events/24721631/ If you are at the meeting please come say hello. Do not be offended if I do not remember your name but I probably will remember your google username. ;-) Massimo
Re: [web2py] web2py - Best Practice
On 13/07/2011 07:45, nic wrote: Dear friends, [...] I would like to propose that we develop a suite of products (open source of course) based on the best practices of web2py that would be: +1 :) Manuele
[web2py] Re: web2py - Best Practice
I am all for this! Massimo On Jul 13, 12:45 am, nic nicbythe...@gmail.com wrote: Dear friends, I am a huge web2py fan and would like to propose an idea to the community. I understand that web2py is a development environment and has it’s roots as an educational platform. One of the things that I have personally found most useful are the free appliances. However as web2py has matured over time a lot of these have become dated and as new developments have emerged I have often been confused about best practices going forward. I would like to propose that we develop a suite of products (open source of course) based on the best practices of web2py that would be: Useful and usable by non-programmers Serve as a focal point for the community on just how great web2py could be Serve as a template for developers To be clear the idea is to create a separate project from web2py itself and then find the best of breed products and develop them in web2py. Things like: A Wiki / Blog / CMS / Forum An Online Store A Personal Accounting System A Media Center etc ... The focus would be on producing complete usable and beautiful applications. I feel that the creation of a separate project will have some important advantages such as: We can create a “brand” around the products. It will not “hijack” the core web2py focus. Can have separate focus such as functionality and look and feel Can include complimentary, tested projects such as open source icons and skins Can have it’s own development cycle, (eg release every 6 months) Can have it’s own repositories etc. Ultimately the products could be made available by web hosts just by the click of a button just like the php ones are now. I am very interested in the thoughts of the community and if there is interest I will move to the next step and create a site (probably on GAE) for further discussion such as: decide on a name decide on goals decide on processes find a home decide on products etc ...
[web2py] Re: Admin security: https vs localhost
I think AB means that the complexity of the Admin password can be analysed when remote connections are made, and if they don't pass some requirement, then do something. I haven't thought it through fully either, and tbh I don't think we need to enforce complexity either. Would it not be sufficient to ask for confirmation when the admin password is entered: e.g. Enter password: a That password is not complex enough and could fall to a brute-force attack. You need len=8, uppercase, lowercase, numeric, and a non-alphanumeric. Do you want to try again ([Y]/n)? Enter password: abc That password is not complex enough and could fall to a brute-force attack. You need len=8, uppercase, lowercase, numeric, and a non-alphanumeric. Do you want to try again ([Y]/n)? Enter password: 12345 That password is not complex enough and could fall to a brute-force attack. You need len=8, uppercase, lowercase, numeric, and a non-alphanumeric. Do you want to try again ([Y]/n)? Enter password: @MyPassword123 Password is sufficiently complex for remote connections. If the user selects no, the not-complex-enough password still gets used, which is the current behaviour. How say you?
Re: [web2py] Re: web2py - Best Practice
like this, +1
[web2py] Re: web2py - Best Practice
On Wednesday, July 13, 2011 7:45:18 AM UTC+2, nic wrote: A Wiki / Blog / CMS / Forum An Online Store A Personal Accounting System A Media Center etc ... How about an issue tracker? We're currently using Redmine, and it's really clunky and features very high memory consumption.It has a lot more features compared to Trac, however. Google Code is tricky for companies to use as their internal issue tracker.
Re: [web2py] Re: web2py - Best Practice
On 13.7.2011 10:23, cjrh wrote: On Wednesday, July 13, 2011 7:45:18 AM UTC+2, nic wrote: A Wiki / Blog / CMS / Forum An Online Store A Personal Accounting System A Media Center etc ... How about an issue tracker? We're currently using Redmine, and it's really clunky and features very high memory consumption.It has a lot more features compared to Trac, however. Google Code is tricky for companies to use as their internal issue tracker. Issue tracker sounds very nice. 1+, online store also. Why not add an Office suite to and we can skip all other programs :=) If you need help with setting up and creating the workplace for this project let us know. Kenneth
Re: [web2py] web2py - Best Practice
Let me add the advantage that the initiative stimulates focuses contribution and supplies a platform for learning. Some people may not wish, have the time or expertise to get involved with the development of the web2py framework. This sort of initiative supplies a narrower ground for contribution that is likely to impose less demands on contribution or to be more accessible. Thus, it also provides a route for many to increase both individual knowledge and for the community to explore and develop framework usage patterns. Miguel On Wed, Jul 13, 2011 at 6:45 AM, nic nicbythe...@gmail.com wrote: Dear friends, I am a huge web2py fan and would like to propose an idea to the community. I understand that web2py is a development environment and has it’s roots as an educational platform. One of the things that I have personally found most useful are the free appliances. However as web2py has matured over time a lot of these have become dated and as new developments have emerged I have often been confused about best practices going forward. I would like to propose that we develop a suite of products (open source of course) based on the best practices of web2py that would be: Useful and usable by non-programmers Serve as a focal point for the community on just how great web2py could be Serve as a template for developers To be clear the idea is to create a separate project from web2py itself and then find the best of breed products and develop them in web2py. Things like: A Wiki / Blog / CMS / Forum An Online Store A Personal Accounting System A Media Center etc ... The focus would be on producing complete usable and beautiful applications. I feel that the creation of a separate project will have some important advantages such as: We can create a “brand” around the products. It will not “hijack” the core web2py focus. Can have separate focus such as functionality and look and feel Can include complimentary, tested projects such as open source icons and skins Can have it’s own development cycle, (eg release every 6 months) Can have it’s own repositories etc. Ultimately the products could be made available by web hosts just by the click of a button just like the php ones are now. I am very interested in the thoughts of the community and if there is interest I will move to the next step and create a site (probably on GAE) for further discussion such as: decide on a name decide on goals decide on processes find a home decide on products etc ...
[web2py] Limitation in template system
I think this behavior I've just found is worth sharing. Templates don't honor the if statement that conditionally try to include or exclude template blocks. I've just detected this (in 1.96.4 I think) and upgrade to 1.97.1 and the issue/behavior remains. {{rsd=None}} {{if rsd!=None:}} {{block right_sidebar}} {{=rsd==None}} {{=repr(rsd)}} {{end}} {{pass}} The solution is to put the condition *inside the template block* (tested in 1.97.1) {{rsd=None}} {{block right_sidebar}} {{if rsd!=None:}} {{=rsd==None}} {{=repr(rsd)}} {{pass}} {{end}} Miguel
[web2py] Re: how to use contrib/login_methods/linkedin_account.py
did you find a solution? On Jun 26, 8:17 pm, Luis Goncalves lgoncal...@gmail.com wrote: One more clue: In the infinite loop, every loop through the linkedin grant access (/oas/oauth/authorize) page has a new oauth_token, such as https://www.linkedin.com/uas/oauth/authorize?oauth_token=f9eef16e-4f4... L.
Re: [web2py] web2py - Best Practice
On Wed, Jul 13, 2011 at 7:45 AM, nic nicbythe...@gmail.com wrote: A Wiki / Blog / CMS / Forum An Online Store A Personal Accounting System A Media Center etc ... This is great idea, I had it few months ago, but never wrote it here. Next week I'll start programming a Forum software (with web2py ofc). Main goals are: optimized performance and powerful plug-in system. I will open few discussions here, very soon. My idea was to make every popular PHP app. done with web2py. Few more ideas: - web-based email application (like SquirrelMail etc) - database managment (like phpmyadmin, phppgadmin etc) - system administration (like cpanel)
[web2py] Re: Two problems with LOAD; one may be a bug(?)
Thank you. I will fix that. On Jul 12, 7:57 pm, pbreit pbreitenb...@gmail.com wrote: Maybe try: {{=LOAD('users', 'quals.load', args=(request.args(0)), ajax=True)}} The c= and f= are fine but not necessary. The extra .load is definitely unnecessary and may have been causing the problem. You can insert .load in either place but not both. If that works, try adding back the target. Also, as you have done, try it with ajax=False.
[web2py] Re: Two problems with LOAD; one may be a bug(?)
Thank you. I'll clean up the repeated divs. On Jul 12, 8:49 pm, Anthony abasta...@gmail.com wrote: On Tuesday, July 12, 2011 5:43:55 PM UTC-4, Cliff wrote: Running Version 1.97.1 (2011-06-26 19:25:44) First problem: This is a snippet from a view file. It works except that it displays the output of the quals function. Apparently it cannot find my quals.load file and is using the generic load file in its place. div id=tabs-3 {{=LOAD(c='users',f='quals.load', extension='load', args=(request.args(0)), ajax=True, target='tabs-3')}} /div Note, LOAD itself returns a div, and the id of that div is whatever you specify as the 'target' argument (if you don't specify 'target', it creates a random id). So, you're actually nesting the LOAD div inside another div, and they both have the same id (i.e., tabs-3). So, either don't put the LOAD inside a div, or make sure you give it a different id. Also, you don't need to specify the '.load' in your f argument if you also specify the extension argument (in that case, I think it will end up ignoring the extension argument). Second problem: In trying to find out if setting ajax to True was causing my first problem, I stumbled over a second. Setting 'ajax=False' or not setting ajax at all causes an exception. Could this be a bug? If so, please let me know where and how to report the thing. It's totally reproducible on my system. There is currently a bug with ajax=False where response.generic_patterns is not getting passed to the component, so generic views are not working with non-ajax components at the moment. If you're getting an invalid view error, that could be the problem. Anthony
Re: [web2py] Multiple Domains, Subdomains, and Applications with SSL. Single web2py Instance on Apache
it looks correct, and shouldn't make any difference as long as indentation is correct. Maybe try lowercasing the domain names. Also, do you have any other routing options besides this one?
[web2py] Re: web2py - Best Practice
On Jul 13, 1:05 pm, Marin Pranjic marin.pran...@gmail.com wrote: On Wed, Jul 13, 2011 at 7:45 AM, nic nicbythe...@gmail.com wrote: A Wiki / Blog / CMS / Forum An Online Store A Personal Accounting System A Media Center etc ... This is great idea, I had it few months ago, but never wrote it here. Next week I'll start programming a Forum software (with web2py ofc). Main goals are: optimized performance and powerful plug-in system. I will open few discussions here, very soon. My idea was to make every popular PHP app. done with web2py. Few more ideas: - web-based email application (like SquirrelMail etc) - database managment (like phpmyadmin, phppgadmin etc) - system administration (like cpanel) a simple ERP like the php weberp or dolibarr, or the phyton tryton?
[web2py] Re: Paid project: Open source GAE blobstore upload feature in web2py
Thank you, Martin and Christian, for working on this! Of course, I would gladly donate to web2py, as I have also offered in the google code ticket that I created. I'll keep following this thread for any updates that you can share. Thank you, once again! - Anand On Jul 13, 5:54 am, howesc how...@umich.edu wrote: my comments are at the bottom of the slice that Martin linked above. I'm using (perhaps a variant of) the code onwww.elizabethscanvas.org. i don't know of a good way to package it with web2py, but feel free to try the slice and let me know where it is broken. for starmakerstudios.com i need to integrate that blob upload for profile pictures, so i'll be in that code again in the next week or two, let's get it cleaned up and shared!! Anand, if we get this working for you feel free to just contribute your cash to web2py. ;) christian
[web2py] Re: Admin security: https vs localhost
I have created Issue 336 with a patch that adds brute-force attack protection to the admin application using the input gathered from everyone: http://code.google.com/p/web2py/issues/detail?id=336 This does NOT add a password complexity requirement, as it seems this is a touchy issue at the moment (understandable). Instead, this takes Massimo's idea of an increasing delay based on the number of failed attempts. After the fourth failed login attempt, the user is told they have one more attempt before being locked out. After the fifth failed attempt, the IP address is locked out permanently. If, at any time before the lock out, the user enters the correct password, then failed attempt counter is reset to zero. The Google Code issue has all the details, including instructions on how to unblock an IP address. I have done some extensive testing using a number of use cases, so I hope this works as advertised.
Re: [web2py] Multiple Domains, Subdomains, and Applications with SSL. Single web2py Instance on Apache
2011/7/13 Ross Peoples ross.peop...@gmail.com it looks correct, and shouldn't make any difference as long as indentation is correct. Maybe try lowercasing the domain names. Also, do you have any other routing options besides this one? yeah, it is very weird, but suddenly after stoping, wait for about 10 secs and then starting apache now it works. I was using the *restart* command of apache before but it didn't work, so maybe is something with the cache or alike. I remark on suddenly because I did the same procedure a few times before without changes. At least now is still working. Thank you anyway, and for that you decided been informative to others in the first post. best regards :)
[web2py] Re: Python 3 and the future of web2py
The problem is, it would break backward compatibility. On Wednesday, July 13, 2011 12:54:57 AM UTC-4, Rahul wrote: Its true that there are existing python versions 2.6, 2.7.x but what I would like is Web2py support for Python 3. Reasons: 1. We should provide early support for Python 3 (regardless of what wsgi standard it will provide) because it may trigger a lot of python users to adopt Web2py as it might be the ONLY Full Stack Framework that will be supporting Python 3 2. Python 3.x is the future of Python (I see this to be very true) Eventually we would all be using Python 3.x in our production systems. 3. Lets progress rather than remaining stagnant with existing versions of Python only. I mean Why Not the latest Python ?? Cheers, Rahul D On Jul 12, 5:38 pm, pbreit pbreit...@gmail.com wrote: I suspect 2.6 is going to be popular for some time since that's what's in the current Ubuntu LTS (10.04).
[web2py] Re: Python 3 and the future of web2py
Very true, we would need to create another branch of web2py, do the initial conversion to Python 3, then try to maintain it, coding updates and new features twice: once for Python 2.x and once again for Python 3.x, since the two have different coding requirements. Then both would need to be tested extensively to ensure that they both work identically. Don't get me wrong, I'm all for making web2py as cutting edge and portable as possible, but this may be one of those cases where the potential problems outweigh the benefits. Besides, Python 3 has been benchmarked to run 10% slower than Python 2.x, so until they can get that fixed, I doubt any high-traffic sites would risk it. Since Python 3 is so different by nature, that might be the time, where Massimo mentioned that a web3py would be created. New features, ideas, and ways of doing things could be created without breaking backwards-compatibility because your Python2.x web2py apps wouldn't work on Python 3 anyways, so it would be the perfect time to try new things. But again, it's a lot of work, and if a web3py were to be created now, it would probably be nothing more than a pet project until Python 3 gets it act together and becomes more popular.
[web2py] Re: Python 3 and the future of web2py
Small correction here: New features, ideas, and ways of doing things could be created without *worrying about* breaking backwards-compatibility because your Python2.x web2py apps wouldn't work on Python 3 anyways
[web2py] Re: Python 3 and the future of web2py
I think Massimo may have indicated that one idea for Python 3 is to start from scratch and he had some ideas (hence, Web3py). The only big reason I could see doing anything on Python 3 right now is that it'd be the only framework on 3 since I don't think anyone is really contemplating using 3 anytime soon.
Re: [web2py] Re: Python 3 and the future of web2py
Agreed, I think web2py on Py3 is pointless. An entirely different project, called, let's say, web3py, which runs on Py3 is a different animal altogether... On 13 July 2011 15:50, Anthony abasta...@gmail.com wrote: The problem is, it would break backward compatibility. On Wednesday, July 13, 2011 12:54:57 AM UTC-4, Rahul wrote: Its true that there are existing python versions 2.6, 2.7.x but what I would like is Web2py support for Python 3. Reasons: 1. We should provide early support for Python 3 (regardless of what wsgi standard it will provide) because it may trigger a lot of python users to adopt Web2py as it might be the ONLY Full Stack Framework that will be supporting Python 3 2. Python 3.x is the future of Python (I see this to be very true) Eventually we would all be using Python 3.x in our production systems. 3. Lets progress rather than remaining stagnant with existing versions of Python only. I mean Why Not the latest Python ?? Cheers, Rahul D On Jul 12, 5:38 pm, pbreit pbreit...@gmail.com wrote: I suspect 2.6 is going to be popular for some time since that's what's in the current Ubuntu LTS (10.04).
Re: [web2py] Re: Web2py uses Django... on GAE
On Jul 12, 2011, at 11:40 PM, Massimo Di Pierro wrote: This is a GAE bug and we should open a ticket. GAE should not issue warning about libraries we do not use and we should not reference libraries we do not use to make the warnings go away. Do you want to file the bug report? I not, I will do it. There's some commonly used generic library that's included with the Django installation that some (many?) non-Django Python apps link to on GAE. I remember reading about it a few months ago, and even running into that message. But I don't remember the details, and I can't google them up right now. On Jul 12, 7:45 pm, howesc how...@umich.edu wrote: this warning popped up recently when GAE started bundling 2 versions of django. by default it still uses the old version of django in case you needed it for your project. there is a flag somewhere that can be set to tell GAE to use the new version of django. i assume we could find and set the flag even though we use none of the django code.
[web2py] Re: Python 3 and the future of web2py
On Wednesday, July 13, 2011 10:28:03 AM UTC-4, pbreit wrote: The only big reason I could see doing anything on Python 3 right now is that it'd be the only framework on 3... Except for CherryPy: http://www.cherrypy.org/wiki/WhatsNewIn32
Re: [web2py] Re: web2py - Best Practice
+1 On Wed, Jul 13, 2011 at 7:37 AM, newnomad uti...@gmail.com wrote: On Jul 13, 1:05 pm, Marin Pranjic marin.pran...@gmail.com wrote: On Wed, Jul 13, 2011 at 7:45 AM, nic nicbythe...@gmail.com wrote: A Wiki / Blog / CMS / Forum An Online Store A Personal Accounting System A Media Center etc ... This is great idea, I had it few months ago, but never wrote it here. Next week I'll start programming a Forum software (with web2py ofc). Main goals are: optimized performance and powerful plug-in system. I will open few discussions here, very soon. My idea was to make every popular PHP app. done with web2py. Few more ideas: - web-based email application (like SquirrelMail etc) - database managment (like phpmyadmin, phppgadmin etc) - system administration (like cpanel) a simple ERP like the php weberp or dolibarr, or the phyton tryton?
[web2py] Help : SQLFORM.factory with multiple submit button ?
Hello, I have series of forms with in final validation. I would like that the user could go forward and backward between forms. Quite classical. I use SQLFORM.factory which I think is right equilibrium for the application. I would like to have in the forms one button forward and one button backward. The user could have made some modification in the displayed form, he would not understand why his modifications are lost. In SQLFORM.factory there is only one submit_button. I have try to change the string to a list or better a dictionnary but the result is not what I expected :-( I am suprised that I did not found any topic about this in web2py discussion. Perhaps I miss something. Is there a way to implement multiple submit button in SQLFORM in web2py ? I know a workarround is to add radio-buttons or check boxes , but I admit it is not smart for the final user. Thank in advance for your response. -- Patrick Installé (pinsta...@gmal.com)
[web2py] An issue with including extending views
Hi, Our develpment team were previously using web2py version 1.94.6 and recently updated to the version 1.97.1. We noticed a significant difference in functionality when including a view that extend another view. We considered this to be a bug and decided to report it here. Let's say we have a controller and a function in it. The function uses a view template named 'alpha.html'. The view contains the following piece of code: h1Alpha page/h1 {{include 'beta.html'}} As you can see, the view includes a view called 'beta.html' to it. Let the 'beta.html' have this code in it: {{extend 'gamma.html'}} pThis is paragraph is from beta./p This view extends a third view called 'gamma.html'. Let it have this code: pThis paragraph is from gamma./p {{include}} What you would expect as a result when rendering 'alpha.html' (and what the previous web2py version actually procuded) is the following page: h1Alpha page/h1 pThis paragraph is from gamma./p pThis is paragraph is from beta./p What we get instead, in the new version, is just this: h1Alpha page/h1 pThis paragraph is from gamma./p The content rendered in 'beta.html' is left out, which is quite surprising. There are no errors, the template code is just not run. This issue can actually be avoided by replacing the {{include 'beta.html'}} tag with the following tag: {{response.write(response.render('beta.html', dict()), escape=False)}} However, this solution hides any possible errors raised in 'beta.html' by wrapping them in a RestrictedError. Also, the include-tag would be much more elegant. Our project, due to its complexity, has a need for a possibility to include views that extend other views.
[web2py] Re: Python 3 and the future of web2py
+1 On Jul 13, 9:28 am, Caleb Hattingh caleb.hatti...@gmail.com wrote: Agreed, I think web2py on Py3 is pointless. An entirely different project, called, let's say, web3py, which runs on Py3 is a different animal altogether... On 13 July 2011 15:50, Anthony abasta...@gmail.com wrote: The problem is, it would break backward compatibility. On Wednesday, July 13, 2011 12:54:57 AM UTC-4, Rahul wrote: Its true that there are existing python versions 2.6, 2.7.x but what I would like is Web2py support for Python 3. Reasons: 1. We should provide early support for Python 3 (regardless of what wsgi standard it will provide) because it may trigger a lot of python users to adopt Web2py as it might be the ONLY Full Stack Framework that will be supporting Python 3 2. Python 3.x is the future of Python (I see this to be very true) Eventually we would all be using Python 3.x in our production systems. 3. Lets progress rather than remaining stagnant with existing versions of Python only. I mean Why Not the latest Python ?? Cheers, Rahul D On Jul 12, 5:38 pm, pbreit pbreit...@gmail.com wrote: I suspect 2.6 is going to be popular for some time since that's what's in the current Ubuntu LTS (10.04).
Re: [web2py] web2py - Best Practice
Is what I want to achieve in powerpack, but now I'm reworking it in boilerplate https://bitbucket.org/mulonemartin/web2pyboilerplate/src . Nic you are right, web2py fit perfect for starter or as education platform, althought myself I use to teach some web programming to others. But in the next level is another thing, when the applications grows, nobody is pointing you, you are at your own.. well I think you have to do python. What is python is OO programming lang, and the big points are classes and import. The models are great but you have to be carefull when you are working in a big application or a complicated logic, because you can polute the namespace or make it unnecesary slow. A few people know, that now you can do: from mymodule import myclass or from plugins.myplugin.mymodule import anything in web2py. And yes we need a plugin system, and I'm not talking about the PluginManager in web2py that do almost nothing, we need an standart or base class, that you can make myplugin = MyPlugin(), myplugin.install(), myplugin.uninstall(), pluginmanager.add(myplugin), myplugin = pluginmanager.plugins('myplugin') etc. You have my +1, and my help. 2011/7/13 nic nicbythe...@gmail.com: Dear friends, I am a huge web2py fan and would like to propose an idea to the community. I understand that web2py is a development environment and has it’s roots as an educational platform. One of the things that I have personally found most useful are the free appliances. However as web2py has matured over time a lot of these have become dated and as new developments have emerged I have often been confused about best practices going forward. I would like to propose that we develop a suite of products (open source of course) based on the best practices of web2py that would be: Useful and usable by non-programmers Serve as a focal point for the community on just how great web2py could be Serve as a template for developers To be clear the idea is to create a separate project from web2py itself and then find the best of breed products and develop them in web2py. Things like: A Wiki / Blog / CMS / Forum An Online Store A Personal Accounting System A Media Center etc ... The focus would be on producing complete usable and beautiful applications. I feel that the creation of a separate project will have some important advantages such as: We can create a “brand” around the products. It will not “hijack” the core web2py focus. Can have separate focus such as functionality and look and feel Can include complimentary, tested projects such as open source icons and skins Can have it’s own development cycle, (eg release every 6 months) Can have it’s own repositories etc. Ultimately the products could be made available by web hosts just by the click of a button just like the php ones are now. I am very interested in the thoughts of the community and if there is interest I will move to the next step and create a site (probably on GAE) for further discussion such as: decide on a name decide on goals decide on processes find a home decide on products etc ... -- http://martin.tecnodoc.com.ar
Re: [web2py] web2py - Best Practice
On Jul 12, 2011, at 10:45 PM, nic wrote: Things like: A Wiki / Blog / CMS / Forum An Online Store A Personal Accounting System A Media Center etc ... The focus would be on producing complete usable and beautiful applications. That's a very ambitious goal. I use, for a couple of purposes, WordPress and MediaWiki, both PHP-based. The reason I use them has nothing to do with their language, and everything to do with the fact that each of them has dozens, if not hundreds, of developers working on them and their ecological system. And that's not because of language/framework overhead. It's because there's *lot* of functionality in those packages. The open-source world is littered with half-baked, poorly maintained alternatives to the major packages, including more than a couple based on web2py. I think it'd be great to have software like that that I could work on myself when I felt the need and had the time, but I think it's important to figure out what the compelling use case is for them, and how the necessary thousands of developer hours are going to get committed and coordinated to make it happen.
Re: [web2py] Re: After CAS login, password is reset
You're right in this case is not necessary to use CAS, thanks for the clarification :) -- Lucas D'Avila http://github.com/lucasdavila sent from a smartphone Em 13/07/2011 03:46, Massimo Di Pierro massimo.dipie...@gmail.com escreveu: I suspect your problem is that both apps connec I suspect your problem is that both apps connect to the same databases. If you use CAS youhave consumer and provider. If the two apps use the same DB, there is no need for CAS. You use CAS because the two apps do not have the same db. Therefore is correct for the consumer to reset the password to null since the consumer must use the provider password for login. On Jul 13, 12:28 am, Lucas D'Avila lucass...@gmail.com wrote: Hello! I'm making some tests with the new CAS, but at some point after login the user's password is reset (set to NULL in the database), I think it's because in line 1629 of Class gluon.tools.Auth (trunk version), the variable cas_user [passfield] is set as None, then the method self.get_or_create_user() is called that updates the password to null in database This is a bug, or i'm doing something wrong? My environment are two applications (copies of wellcome app), with the following models: * * *accounts_app/models/db.py:* auth_db = DAL('postgres://postgres:postgres@localhost/accounts') db_session = DAL('sqlite://storage.sqlite') session.connect(request = request, response = response, db = db_session) from gluon.tools import Auth auth = Auth(db = auth_db) auth.define_tables(username=True) *client_app/models/db.py:* auth_db = DAL('postgres://postgres:postgres@localhost/accounts') db_session = DAL('sqlite://storage.sqlite') session.connect(request = request, response = response, db = db_session) auth = Auth(db = auth_db, cas_provider=' http://localhost:8000/accounts/default/user/cas') auth.define_tables(username=True, migrate = False) auth.settings.login_form=CasAuth(globals(), urlbase = http://localhost:8000/accounts/default/user/cas;, actions=['login', 'validate', 'logout']) One more doubt, is correct to connect both applications on the same (auth) database? was the way I found to keep the permissions centralized in one place. -- *Lucas D'Avila*https://github.com/lucasdavila
Re: [web2py] web2py - Best Practice
Martin, i totally agree with your analysis. We need to make easier code sharing with a well defined interface to extend the core. Mic Il giorno 13/lug/2011 17:32, Martín Mulone mulone.mar...@gmail.com ha scritto: Is what I want to achieve in powerpack, but now I'm reworking it in boilerplate https://bitbucket.org/mulonemartin/web2pyboilerplate/src . Nic you are right, web2py fit perfect for starter or as education platform, althought myself I use to teach some web programming to others. But in the next level is another thing, when the applications grows, nobody is pointing you, you are at your own.. well I think you have to do python. What is python is OO programming lang, and the big points are classes and import. The models are great but you have to be carefull when you are working in a big application or a complicated logic, because you can polute the namespace or make it unnecesary slow. A few people know, that now you can do: from mymodule import myclass or from plugins.myplugin.mymodule import anything in web2py. And yes we need a plugin system, and I'm not talking about the PluginManager in web2py that do almost nothing, we need an standart or base class, that you can make myplugin = MyPlugin(), myplugin.install(), myplugin.uninstall(), pluginmanager.add(myplugin), myplugin = pluginmanager.plugins('myplugin') etc. You have my +1, and my help. 2011/7/13 nic nicbythe...@gmail.com: Dear friends, I am a huge web2py fan and would like to propose an idea to the community. I understand that web2py is a development environment and has it’s roots as an educational platform. One of the things that I have personally found most useful are the free appliances. However as web2py has matured over time a lot of these have become dated and as new developments have emerged I have often been confused about best practices going forward. I would like to propose that we develop a suite of products (open source of course) based on the best practices of web2py that would be: Useful and usable by non-programmers Serve as a focal point for the community on just how great web2py could be Serve as a template for developers To be clear the idea is to create a separate project from web2py itself and then find the best of breed products and develop them in web2py. Things like: A Wiki / Blog / CMS / Forum An Online Store A Personal Accounting System A Media Center etc ... The focus would be on producing complete usable and beautiful applications. I feel that the creation of a separate project will have some important advantages such as: We can create a “brand” around the products. It will not “hijack” the core web2py focus. Can have separate focus such as functionality and look and feel Can include complimentary, tested projects such as open source icons and skins Can have it’s own development cycle, (eg release every 6 months) Can have it’s own repositories etc. Ultimately the products could be made available by web hosts just by the click of a button just like the php ones are now. I am very interested in the thoughts of the community and if there is interest I will move to the next step and create a site (probably on GAE) for further discussion such as: decide on a name decide on goals decide on processes find a home decide on products etc ... -- http://martin.tecnodoc.com.ar
Re: [web2py] Re: Python 3 and the future of web2py
Is it worth calling the prototype version *before* web3py: web3000py? Or would that be unbearably geeky? Sent from my iPad On 13 Jul 2011, at 5:21 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: +1 On Jul 13, 9:28 am, Caleb Hattingh caleb.hatti...@gmail.com wrote: Agreed, I think web2py on Py3 is pointless. An entirely different project, called, let's say, web3py, which runs on Py3 is a different animal altogether... On 13 July 2011 15:50, Anthony abasta...@gmail.com wrote: The problem is, it would break backward compatibility. On Wednesday, July 13, 2011 12:54:57 AM UTC-4, Rahul wrote: Its true that there are existing python versions 2.6, 2.7.x but what I would like is Web2py support for Python 3. Reasons: 1. We should provide early support for Python 3 (regardless of what wsgi standard it will provide) because it may trigger a lot of python users to adopt Web2py as it might be the ONLY Full Stack Framework that will be supporting Python 3 2. Python 3.x is the future of Python (I see this to be very true) Eventually we would all be using Python 3.x in our production systems. 3. Lets progress rather than remaining stagnant with existing versions of Python only. I mean Why Not the latest Python ?? Cheers, Rahul D On Jul 12, 5:38 pm, pbreit pbreit...@gmail.com wrote: I suspect 2.6 is going to be popular for some time since that's what's in the current Ubuntu LTS (10.04).
[web2py] SQLFORM - crud.create in a popup
hi! How could I put a SQLForm or a crud.create form in a modal and send it some url attributes?
Re: [web2py] Re: Python 3 and the future of web2py
May be, the new project could be a kind of merge with Bottle ( http://bottlepy.org/docs/dev/, Web2py libs fits perfectly with Bottle, and bottle has a very nice base system. Maybe we cam have a bottle2py-project with Python3 as goal.
Re: [web2py] Help : SQLFORM.factory with multiple submit button ?
I think this is what you are looking for: http://labs.blouweb.com/powerformwizard http://www.google.com/url?sa=Dq=http://labs.blouweb.com/powerformwizard Kenneth Hello, I have series of forms with in final validation. I would like that the user could go forward and backward between forms. Quite classical. I use SQLFORM.factory which I think is right equilibrium for the application. I would like to have in the forms one button forward and one button backward. The user could have made some modification in the displayed form, he would not understand why his modifications are lost. In SQLFORM.factory there is only one submit_button. I have try to change the string to a list or better a dictionnary but the result is not what I expected :-( I am suprised that I did not found any topic about this in web2py discussion. Perhaps I miss something. Is there a way to implement multiple submit button in SQLFORM in web2py ? I know a workarround is to add radio-buttons or check boxes , but I admit it is not smart for the final user. Thank in advance for your response.
Re: [web2py] SQLFORM - crud.create in a popup
hi! How could I put a SQLForm or a crud.create form in a modal and send it some url attributes? There is many different ways: http://easyframework.com/demo_popup.php A sure way is: http://www.web2py.com/plugins/static/web2py.plugin.*mmodal*.w2p http://www.google.com/url?sa=Dq=http://www.web2py.com/plugins/static/web2py.plugin.mmodal.w2p read more on: http://groups.google.com/group/web2py/browse_thread/thread/809bf7eb5072651f/90ecd2c59b3dacc6?lnk=gstq=mmodal#90ecd2c59b3dacc6 Kenneth
Re: [web2py] Help : SQLFORM.factory with multiple submit button ?
I have used two approaches, the old one that you can find here: http://www.web2pyslices.com/slices/take_slice/127 and the new way using a plugin: http://labs.blouweb.com/powerformwizard With the first you can have more custom options and can use forms for different tables, with the former you can have client side validation. 2011/7/13 Kenneth Lundström kenneth.t.lundst...@gmail.com I think this is what you are looking for: http://labs.blouweb.com/powerformwizardhttp://www.google.com/url?sa=Dq=http://labs.blouweb.com/powerformwizard Kenneth Hello, I have series of forms with in final validation. I would like that the user could go forward and backward between forms. Quite classical. I use SQLFORM.factory which I think is right equilibrium for the application. I would like to have in the forms one button forward and one button backward. The user could have made some modification in the displayed form, he would not understand why his modifications are lost. In SQLFORM.factory there is only one submit_button. I have try to change the string to a list or better a dictionnary but the result is not what I expected :-( I am suprised that I did not found any topic about this in web2py discussion. Perhaps I miss something. Is there a way to implement multiple submit button in SQLFORM in web2py ? I know a workarround is to add radio-buttons or check boxes , but I admit it is not smart for the final user. Thank in advance for your response. -- -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] [ Aprenda a programar: http://CursoDePython.com.br ] [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] [ Consultoria em desenvolvimento web: http://www.blouweb.com ]
Re: [web2py] Help : SQLFORM.factory with multiple submit button ?
PowerFormWizard? http://labs.blouweb.com/powerformwizard -Jim On 7/13/2011 9:27 AM, Patrick Installe wrote: Hello, I have series of forms with in final validation. I would like that the user could go forward and backward between forms. Quite classical. I use SQLFORM.factory which I think is right equilibrium for the application. I would like to have in the forms one button forward and one button backward. The user could have made some modification in the displayed form, he would not understand why his modifications are lost. In SQLFORM.factory there is only one submit_button. I have try to change the string to a list or better a dictionnary but the result is not what I expected :-( I am suprised that I did not found any topic about this in web2py discussion. Perhaps I miss something. Is there a way to implement multiple submit button in SQLFORM in web2py ? I know a workarround is to add radio-buttons or check boxes , but I admit it is not smart for the final user. Thank in advance for your response.
[web2py] Simultaneous multi-language system.
Hi everyone, i don't know if Simultaneous multi-language system is the correct way to say what i need... i'll explain myself. I'm developing an application that by request of our customer, needs to have 2 languages at the same time. For example, if this app were in spanish and english, in the navigator should appear something like: Casa / House In the view we want to do something like this {{=T(House, es-es)}} / {{=T(House, en-en)}} But i don't know if web2py can permit to do this or something like that. I was thinking of writing a function like this: def MultiT(text,separator= / ): T.force(es-es) ret_text = T(text) T.force(en-en) ret_text += separator + T(text) return ret_text But it does not work. Also, do not know how this affects the system when updating the language files with the strings to translate (now the files are updated automatically when pressing the update languages button in admin, and I guess that it would make it on run time. Any sugestions? Best regards Daniel
Re: [web2py] Re: component refresh with jQuery UI tab plugin
A lot of thing happen since that time... Here the solutions I found with help of Anthony : if form.accepts(request.vars, session): session.flash = T('form accepted') if table == 'ref_fnaregistry': next = URL('ref', 'creation', args=1, extension=False, host=True) elif table == 'ref_vregistry': next = URL('ref', 'creation', args=2, extension=False, host=True) elif table == 'ref_tregistry': next = URL('ref', 'creation', args=3, extension=False, host=True) response.js = 'window.location.replace(%s)' % next # With redirection (only a problem with the nav back arrow not working) if table == 'ref_fnaregistry': response.js=web2py_component('%s','two'); % URL('ref','create_fvte',args='ref_vregistry') response.js+=web2py_component('%s','three'); % URL('ref','create_fvte',args='ref_tregistry') elif table == 'ref_vregistry': response.js=web2py_component('%s','three') % URL('ref','create_fvte',args='ref_tregistry') elif table == 'ref_tregistry': response.js=web2py_component('%s','four') % URL('ref','create_fvte',args='ref_eregistry') # Without redirection to make sure the next coming component is updated Note that the commented line breake the navigator workflow and the back arrow not working... I do prefer to not redirect the user... Thanks Cliff. Richard On Mon, Jul 11, 2011 at 6:20 PM, Cliff cjk...@gmail.com wrote: Hello Richard, Your post and Massimo's reply helped me understand better how this is supposed to work. So maybe I can return the favor a little bit. I understand from your posts that you have a field on tab_1 and you would like to see the contents of that field included in a dropdown on tab_2. I'm assuming that if there is a value in this field it causes DAL to insert a row into some table. Are these inserts actually taking place? If they're not, I don't have an answer for that because I haven't tackled yet how to make a tab click do the work of a submit. On the other hand, if the values are getting into the required table and you don't see them in the drop down I may be able to help. All of your LOAD calls point to the same 'create_fvte', which means that they are fetching the same load file from the view directory. What's working for me so far is to have a separate load file for each tab, with a separate function to fetch and render the data. Please excuse my pseudocode. What's working for me looks something like this: Controller foobar.py: def foo(): allfoos = db.foo.select(id0) return dict(allfoos=allfoos) def bar(): allbars = db.bar.select(id0) return dict(allbars = allbars) -- view foo.load: {{for eachfoo in allfoos:}} {{ # do something }} {{pass}} -- view foobar.html . . . div id=tabs ul lia href=#tabs-1{{=T('foo').capitalize()}}/a/li lia href=#tabs-2{{=T('bar').capitalize()}}/a/li /ul div id=tabs-1 {{=LOAD(c='foobar', f='foo', ajax=True, target='tabs-1')}} /div div id=tabs-2 {{=LOAD(c='foobar', f='bar', ajax=True, target='tabs-2')}} /div . . . Good luck. On Jun 6, 11:32 am, Richard Vézina ml.richard.vez...@gmail.com wrote: Hello Massimo, Was it available in 1.94.6?? I try all sort of things and can't makes it work... No refresh. Richard On Fri, Jun 3, 2011 at 10:02 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Give a name to your components {{=LOAD(...,target='one')}} {{=LOAD(...,target='two')}} {{=LOAD(...,target='three')}} now any action can trigger a component reload response.js=web2py_component('action','target') where action is the URL of the component and 'target' is 'one', 'two', 'three'', etc. On Jun 2, 4:21 pm, Richard Vézina ml.richard.vez...@gmail.com wrote: Hello, Here my view code : {{extend 'layout_form.html'}} style type=text/css title=currentStyle @import {{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundle/th emes/base/jquery.ui.all.css')}}; /style script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/js/jquery-1.4.4.m in.js')}}/script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundl e/ui/jquery.ui.core.js')}}/script script type=text/javascript charset=utf-8 src={{=URL('static','plugin_added/jquery-ui-1.8.9.custom/development-bundl e/ui/jquery.ui.widget.js')}}/script script type=text/javascript
[web2py] INSERT Error? or Bug?
hi! I'm very confused, I'm trying to do a simple Insert, like this, db.person.insert(name = 'foo'), but It doesn't work (from a controller). I tried trough appadmin in the query field (same query) and it shows me an error: (1064, uYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 6' at line 1) This number is the corresponding ID of the inserted record. but, if I exit the page and then enter again the record is there and fine!! I need it to work from a controller but I can't. I'm using MySQL 5.1.41 and web2py 1.94.5
Re: [web2py] INSERT Error? or Bug?
hi! I'm very confused, I'm trying to do a simple Insert, like this, db.person.insert(name = 'foo'), but It doesn't work (from a controller). What happens when you do it in a controller? Do you get an error? If not how do you know it does not work? Kenneth I tried trough appadmin in the query field (same query) and it shows me an error: (1064, uYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 6' at line 1) This number is the corresponding ID of the inserted record. but, if I exit the page and then enter again the record is there and fine!! I need it to work from a controller but I can't. I'm using MySQL 5.1.41 and web2py 1.94.5
Re: [web2py] INSERT Error? or Bug?
well, nothing is inserted 2011/7/13 Kenneth Lundström kenneth.t.lundst...@gmail.com hi! I'm very confused, I'm trying to do a simple Insert, like this, db.person.insert(name = 'foo'), but It doesn't work (from a controller). What happens when you do it in a controller? Do you get an error? If not how do you know it does not work? Kenneth I tried trough appadmin in the query field (same query) and it shows me an error: (1064, uYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 6' at line 1) This number is the corresponding ID of the inserted record. but, if I exit the page and then enter again the record is there and fine!! I need it to work from a controller but I can't. I'm using MySQL 5.1.41 and web2py 1.94.5
Re: [web2py] INSERT Error? or Bug?
Maybe you forgot : db.commit() Richard On Wed, Jul 13, 2011 at 1:59 PM, Ismael Alejandro ialejandr...@gmail.comwrote: well, nothing is inserted 2011/7/13 Kenneth Lundström kenneth.t.lundst...@gmail.com hi! I'm very confused, I'm trying to do a simple Insert, like this, db.person.insert(name = 'foo'), but It doesn't work (from a controller). What happens when you do it in a controller? Do you get an error? If not how do you know it does not work? Kenneth I tried trough appadmin in the query field (same query) and it shows me an error: (1064, uYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 6' at line 1) This number is the corresponding ID of the inserted record. but, if I exit the page and then enter again the record is there and fine!! I need it to work from a controller but I can't. I'm using MySQL 5.1.41 and web2py 1.94.5
Re: [web2py] INSERT Error? or Bug?
Not working :( On Wed, Jul 13, 2011 at 1:02 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Maybe you forgot : db.commit() Richard On Wed, Jul 13, 2011 at 1:59 PM, Ismael Alejandro ialejandr...@gmail.comwrote: well, nothing is inserted 2011/7/13 Kenneth Lundström kenneth.t.lundst...@gmail.com hi! I'm very confused, I'm trying to do a simple Insert, like this, db.person.insert(name = 'foo'), but It doesn't work (from a controller). What happens when you do it in a controller? Do you get an error? If not how do you know it does not work? Kenneth I tried trough appadmin in the query field (same query) and it shows me an error: (1064, uYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 6' at line 1) This number is the corresponding ID of the inserted record. but, if I exit the page and then enter again the record is there and fine!! I need it to work from a controller but I can't. I'm using MySQL 5.1.41 and web2py 1.94.5
Re: [web2py] INSERT Error? or Bug?
Would you show your model? Richard On Wed, Jul 13, 2011 at 2:08 PM, Ismael Alejandro ialejandr...@gmail.comwrote: Not working :( On Wed, Jul 13, 2011 at 1:02 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Maybe you forgot : db.commit() Richard On Wed, Jul 13, 2011 at 1:59 PM, Ismael Alejandro ialejandr...@gmail.com wrote: well, nothing is inserted 2011/7/13 Kenneth Lundström kenneth.t.lundst...@gmail.com hi! I'm very confused, I'm trying to do a simple Insert, like this, db.person.insert(name = 'foo'), but It doesn't work (from a controller). What happens when you do it in a controller? Do you get an error? If not how do you know it does not work? Kenneth I tried trough appadmin in the query field (same query) and it shows me an error: (1064, uYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 6' at line 1) This number is the corresponding ID of the inserted record. but, if I exit the page and then enter again the record is there and fine!! I need it to work from a controller but I can't. I'm using MySQL 5.1.41 and web2py 1.94.5
Re: [web2py] INSERT Error? or Bug?
db.define_table('person', Field('name','string')) On Wed, Jul 13, 2011 at 1:11 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Would you show your model? Richard On Wed, Jul 13, 2011 at 2:08 PM, Ismael Alejandro ialejandr...@gmail.comwrote: Not working :( On Wed, Jul 13, 2011 at 1:02 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Maybe you forgot : db.commit() Richard On Wed, Jul 13, 2011 at 1:59 PM, Ismael Alejandro ialejandr...@gmail.com wrote: well, nothing is inserted 2011/7/13 Kenneth Lundström kenneth.t.lundst...@gmail.com hi! I'm very confused, I'm trying to do a simple Insert, like this, db.person.insert(name = 'foo'), but It doesn't work (from a controller). What happens when you do it in a controller? Do you get an error? If not how do you know it does not work? Kenneth I tried trough appadmin in the query field (same query) and it shows me an error: (1064, uYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 6' at line 1) This number is the corresponding ID of the inserted record. but, if I exit the page and then enter again the record is there and fine!! I need it to work from a controller but I can't. I'm using MySQL 5.1.41 and web2py 1.94.5
Re: [web2py] Multiple Domains, Subdomains, and Applications with SSL. Single web2py Instance on Apache
Glad you got it resolved. And I'm glad this is helping others. I should mention though that the Apache configurations mentioned in my original post disable admin and app admin access completely (even over SSL). This is a good idea unless you absolutely need it, since web2py's admin application doesn't have any protection against brute-force hacking attempts. However, I have submitted a patch that adds this protection to the admin application. If it gets accepted, it may be moderately safe to enable the admin application over SSL, but only if you need it. To enable admin over SSL, you would simply change these lines in the Apache site configuration files: Location /admin Deny from all /Location LocationMatch ^/([^/]+)/appadmin Deny from all /LocationMatch You can remove these lines, or simply put a hash mark (#) in front of the Deny from all part. Using the hash marks could make it easier to switch admin on and off if you only want it on when needed. Just keep in mind that you would need to run: sudo /etc/init.d/apache2 reload In order for the change to take effect. If for some reason the changes don't get applied, then doing an Apache restart instead of a reload should do the trick.
Re: [web2py] INSERT Error? or Bug?
And what about the db=DAL('mysql://username:password@localhost/test')... Can you see if web2py has create you person table into you mysql database? You can also try to make a little app that work with sqlite by default and try your exact same code in in so you will be able to determine if your problem come from mysql ou connection or web2py or even a bug in web2py... Richard It should be like this for mysql On Wed, Jul 13, 2011 at 2:12 PM, Ismael Alejandro ialejandr...@gmail.comwrote: db.define_table('person', Field('name','string')) On Wed, Jul 13, 2011 at 1:11 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Would you show your model? Richard On Wed, Jul 13, 2011 at 2:08 PM, Ismael Alejandro ialejandr...@gmail.com wrote: Not working :( On Wed, Jul 13, 2011 at 1:02 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Maybe you forgot : db.commit() Richard On Wed, Jul 13, 2011 at 1:59 PM, Ismael Alejandro ialejandr...@gmail.com wrote: well, nothing is inserted 2011/7/13 Kenneth Lundström kenneth.t.lundst...@gmail.com hi! I'm very confused, I'm trying to do a simple Insert, like this, db.person.insert(name = 'foo'), but It doesn't work (from a controller). What happens when you do it in a controller? Do you get an error? If not how do you know it does not work? Kenneth I tried trough appadmin in the query field (same query) and it shows me an error: (1064, uYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 6' at line 1) This number is the corresponding ID of the inserted record. but, if I exit the page and then enter again the record is there and fine!! I need it to work from a controller but I can't. I'm using MySQL 5.1.41 and web2py 1.94.5
[web2py] Thanks for the awesome framework/setting up PostgreSQL
Dear Massimo and the rest of the dev team, You and your team have assembled a wonderful framework here. Coming from a PHP/CakePHP background (non-professional other than some work as a web designer in the late 1990s), I decided to switch to a python- based framework and spent the past week carefully researching options. After seriously considering Django, I ended up deciding upon web2py, first and foremost because it's clear that you and your team very publically stand behind your product. Thanks again for a wonderful tool -- it's much appreciated (and I just made a donation to the project to express my appreciation more concretely). I've started playing around with the framework on an EC2 instance, which is probably where I'll keep it for a small app I'm developing. I do have a question for the list: I'd like to set it up to work with PostgreSQL instead of SQlite. Is this the latest HOWTO on setting web2py up with PostgreSQL: http://www.web2pyslices.com/slices/take_slice/14 It looks like a very good HOWTO but I want to be sure it's current before I use it. I've got it set up on my virtual machine and I'm very familiar with SQL so it should not be too hard for me to set up the database; I just need recent documentation on setting web2py to work with it instead of sqlite. Thanks in advance for any input on guides to setting up PostgreSQL with web2py. Kind regards, Eric Eric Scott Bullington
Re: [web2py] INSERT Error? or Bug?
What happens if you insert a record directly to mysql, can you view it from web2py. In controller return db(db.person.id 0).select() Kenneth db.define_table('person', Field('name','string')) On Wed, Jul 13, 2011 at 1:11 PM, Richard Vézina ml.richard.vez...@gmail.com mailto:ml.richard.vez...@gmail.com wrote: Would you show your model? Richard On Wed, Jul 13, 2011 at 2:08 PM, Ismael Alejandro ialejandr...@gmail.com mailto:ialejandr...@gmail.com wrote: Not working :( On Wed, Jul 13, 2011 at 1:02 PM, Richard Vézina ml.richard.vez...@gmail.com mailto:ml.richard.vez...@gmail.com wrote: Maybe you forgot : db.commit() Richard On Wed, Jul 13, 2011 at 1:59 PM, Ismael Alejandro ialejandr...@gmail.com mailto:ialejandr...@gmail.com wrote: well, nothing is inserted 2011/7/13 Kenneth Lundström kenneth.t.lundst...@gmail.com mailto:kenneth.t.lundst...@gmail.com hi! I'm very confused, I'm trying to do a simple Insert, like this, db.person.insert(name = 'foo'), but It doesn't work (from a controller). What happens when you do it in a controller? Do you get an error? If not how do you know it does not work? Kenneth I tried trough appadmin in the query field (same query) and it shows me an error: (1064, uYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 6' at line 1) This number is the corresponding ID of the inserted record. but, if I exit the page and then enter again the record is there and fine!! I need it to work from a controller but I can't. I'm using MySQL 5.1.41 and web2py 1.94.5
[web2py] multiselect with part of a table
I have currently this multiselect generated by list:references: db.py: db.define_table('instance',Field('app',db.application),Field('server',db.server),Field('type','string'),format=lambda r: '%s %s' %(db.application[r.app].name,db.server[r.server].hostname)) ... db.define_table('audienceInstances', Field('instances','list:reference instance'),Field('user',db.auth_user,writable=False, readable=False)) default.py: monitoredInstances = db.audienceInstances(db.audienceInstances.user == auth.user.id) #Generates a form for the updation of the list of monitored instances instancesForm = SQLFORM(db.audienceInstances, monitoredInstances, submit_button='Update', showid=False) if instancesForm.accepts(request.vars, session): response.flash = 'list updated' elif instancesForm.errors: response.flash = 'form has errors' That shows a list select among all instances. But what if I'd like to show a subset of that list, I mean I added a type field in instance table, and like to get the instances of the type the user has selected in its profile. The only way I can think of is creating a separate audienceInstances table for each type. Is there any othere way? Thanks, Nico
Re: [web2py] INSERT Error? or Bug?
MySQL 5.1.41 is kind of old... http://dev.mysql.com/doc/refman/5.1/en/news-5-1-41.html D.1.23. Changes in MySQL 5.1.41 (05 November 2009) Richard 2011/7/13 Kenneth Lundström kenneth.t.lundst...@gmail.com What happens if you insert a record directly to mysql, can you view it from web2py. In controller return db(db.person.id 0).select() Kenneth db.define_table('person', Field('name','string')) On Wed, Jul 13, 2011 at 1:11 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Would you show your model? Richard On Wed, Jul 13, 2011 at 2:08 PM, Ismael Alejandro ialejandr...@gmail.com wrote: Not working :( On Wed, Jul 13, 2011 at 1:02 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Maybe you forgot : db.commit() Richard On Wed, Jul 13, 2011 at 1:59 PM, Ismael Alejandro ialejandr...@gmail.com wrote: well, nothing is inserted 2011/7/13 Kenneth Lundström kenneth.t.lundst...@gmail.com hi! I'm very confused, I'm trying to do a simple Insert, like this, db.person.insert(name = 'foo'), but It doesn't work (from a controller). What happens when you do it in a controller? Do you get an error? If not how do you know it does not work? Kenneth I tried trough appadmin in the query field (same query) and it shows me an error: (1064, uYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 6' at line 1) This number is the corresponding ID of the inserted record. but, if I exit the page and then enter again the record is there and fine!! I need it to work from a controller but I can't. I'm using MySQL 5.1.41 and web2py 1.94.5
Re: [web2py] INSERT Error? or Bug?
I think is solved I was working in another function with almost the same name xD Sorry 2011/7/13 Kenneth Lundström kenneth.t.lundst...@gmail.com What happens if you insert a record directly to mysql, can you view it from web2py. In controller return db(db.person.id 0).select() Kenneth db.define_table('person', Field('name','string')) On Wed, Jul 13, 2011 at 1:11 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Would you show your model? Richard On Wed, Jul 13, 2011 at 2:08 PM, Ismael Alejandro ialejandr...@gmail.com wrote: Not working :( On Wed, Jul 13, 2011 at 1:02 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Maybe you forgot : db.commit() Richard On Wed, Jul 13, 2011 at 1:59 PM, Ismael Alejandro ialejandr...@gmail.com wrote: well, nothing is inserted 2011/7/13 Kenneth Lundström kenneth.t.lundst...@gmail.com hi! I'm very confused, I'm trying to do a simple Insert, like this, db.person.insert(name = 'foo'), but It doesn't work (from a controller). What happens when you do it in a controller? Do you get an error? If not how do you know it does not work? Kenneth I tried trough appadmin in the query field (same query) and it shows me an error: (1064, uYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 6' at line 1) This number is the corresponding ID of the inserted record. but, if I exit the page and then enter again the record is there and fine!! I need it to work from a controller but I can't. I'm using MySQL 5.1.41 and web2py 1.94.5
[web2py] Re: Thanks for the awesome framework/setting up PostgreSQL
Welcome Eric, and thanks for the contribution. I believe that the slice you refer to should still work. If you are already familiar with setting up PostgreSQL, then you don't have to do anything special for web2py. The only thing you need is a Python driver for PostgreSQL, which is why the slice tells you to install python-psycopg2. Besides that, setting DAL to use 'postgres://username:password@localhost:5432/mydb' in your db.py file is all that's left. I haven't started using PostgreSQL with my web2py projects yet, but there are a lot of people here that do. I'm sure someone will be able to help you if you run into any trouble. Hope you enjoy web2py, I certainly have since I started using it.
[web2py] Re: Thanks for the awesome framework/setting up PostgreSQL
There's also this section in the book: http://web2py.com/book/default/chapter/11#PostgreSQL Note, be sure to use Psycopg2 2.0.8 or later (current is 2.4.2), as there was a bug in prior versions that could cause errors. Anthony On Wednesday, July 13, 2011 11:35:50 AM UTC-4, Eric Scott wrote: Dear Massimo and the rest of the dev team, You and your team have assembled a wonderful framework here. Coming from a PHP/CakePHP background (non-professional other than some work as a web designer in the late 1990s), I decided to switch to a python- based framework and spent the past week carefully researching options. After seriously considering Django, I ended up deciding upon web2py, first and foremost because it's clear that you and your team very publically stand behind your product. Thanks again for a wonderful tool -- it's much appreciated (and I just made a donation to the project to express my appreciation more concretely). I've started playing around with the framework on an EC2 instance, which is probably where I'll keep it for a small app I'm developing. I do have a question for the list: I'd like to set it up to work with PostgreSQL instead of SQlite. Is this the latest HOWTO on setting web2py up with PostgreSQL: http://www.web2pyslices.com/slices/take_slice/14 It looks like a very good HOWTO but I want to be sure it's current before I use it. I've got it set up on my virtual machine and I'm very familiar with SQL so it should not be too hard for me to set up the database; I just need recent documentation on setting web2py to work with it instead of sqlite. Thanks in advance for any input on guides to setting up PostgreSQL with web2py. Kind regards, Eric Eric Scott Bullington
Re: [web2py] Thanks for the awesome framework/setting up PostgreSQL
That slice is still works. The version number of postgres might be different, so instead of 8.3 use 8.4 or similar. You might also find things like auto_vacuum come set on by default in newer versions of postgres. Some of the web2py setup gets confusing at the end since I made some assumptions on how to configure the paths and used scripts the generation of apache config files. However by that point you could pick up at the book on enabling web2py through wsgi and apache. -- Thadeus On Wed, Jul 13, 2011 at 10:35 AM, Eric Scott erictransla...@gmail.comwrote: Dear Massimo and the rest of the dev team, You and your team have assembled a wonderful framework here. Coming from a PHP/CakePHP background (non-professional other than some work as a web designer in the late 1990s), I decided to switch to a python- based framework and spent the past week carefully researching options. After seriously considering Django, I ended up deciding upon web2py, first and foremost because it's clear that you and your team very publically stand behind your product. Thanks again for a wonderful tool -- it's much appreciated (and I just made a donation to the project to express my appreciation more concretely). I've started playing around with the framework on an EC2 instance, which is probably where I'll keep it for a small app I'm developing. I do have a question for the list: I'd like to set it up to work with PostgreSQL instead of SQlite. Is this the latest HOWTO on setting web2py up with PostgreSQL: http://www.web2pyslices.com/slices/take_slice/14 It looks like a very good HOWTO but I want to be sure it's current before I use it. I've got it set up on my virtual machine and I'm very familiar with SQL so it should not be too hard for me to set up the database; I just need recent documentation on setting web2py to work with it instead of sqlite. Thanks in advance for any input on guides to setting up PostgreSQL with web2py. Kind regards, Eric Eric Scott Bullington
[web2py] Re: Thanks for the awesome framework/setting up PostgreSQL
Yes, I always seem to forget to mention the book. The web2py book is probably the most often quoted and linked to resource in this group. It is an excellent source of information and contains most of the information required to bring anyone up from newbie to novice. I think the book is updated once a year (will probably be updated again this October). The book is slightly behind, but everything in it will work with the latest trunk version. I think it closely follows web2py around version 1.95.1. We are on 1.97.1 now, and are probably close to 1.98.1 by now. So just browsing the changelog for each release since 1.95.1 should give you a good idea of the new developments since the book was last updated.
Re: [web2py] Thanks for the awesome framework/setting up PostgreSQL
I use PostgreSQL as well with great success. Another thing to keep in mind is if you restart the database server and are using apache with web2py then you should restart apache as well. The reason is the connection pool if used as a number 0 in the DAL() connection statement will have stale connections resulting in errors.
[web2py] Re: Get date from datetime with DAL
Hi Angelo, sorry, I missed the datetime in the title (duh!). The date function belongs to the datetime object so it would be available in the rows only, the field does not have it: for row in rows: print row.data.date() Note that the year month day hour minute second functions might not be available in all DBs since the SQL implementation varies. By the way, the MSSQL adapter has it wrong in 1.94.5, I have to check on the newer versions. Hmmm... that means I have never came across the need for those functions. If you are only working with SQLite then adding date() or time() would not be hard and they seem like sensible options. Maybe even add them to other adapters as well. Is the row.data.date() option enough for you?. Denes. On Jul 12, 5:39 pm, Angelo Compagnucci angelo.compagnu...@gmail.com wrote: Sorry for being pedantic! I made an empty application with only a table in the model defined as: db.define_table('test',Field('data','datetime')) and inserted some datetimes. then I made a method in the controller: def getdata(): rows = db(db.test).select() return dict(rows=rows) and it works. It works also: def getdata(): rows = db(db.test).select(db.test.data.year()) return dict(rows=rows) but if I try: def getdata(): rows = db(db.test).select(db.test.data.date()) return dict(rows=rows) web2py throws an exception with the message: File /home/angelo/DEV/web2py/applications/welcome/controllers/default.py, line 13, in getdata rows = db(db.test.ALL).select(db.test.data.data()) AttributeError: 'Field' object has no attribute 'date' So what's wrong? Thank you! 2011/7/12 pbreit pbreitenb...@gmail.com: I believe datetime is a Python datetime.datetime object and gets validated by IS_DATETIME(). http://docs.python.org/library/datetime.html#datetime.datetime http://web2py.com/book/default/chapter/07?search=IS_DATETIME
[web2py] Off topic: are Google Groups wires crossed?
The recent activity of a group user can be viewed by clicking on the view profile link on any post made by him/her, but I am seeing activity in groups that I have never even heard about, let alone become a member of, and the posts certainly belong to this group. Maybe that could explain why some post have been disappearing from our group. I can see this happening not only on my profile but on other group user profiles as well. Comments? Suggestions?. (besides contacting Google I mean).
Re: [web2py] Thanks for the awesome framework/setting up PostgreSQL
All I do is install postgres and change the connection string and it seems to work OK. I'm not sure what all the extra stuff is in the slice. The one thing you have to be careful about is that SQLite is more forgiving during migrations. You have to be a bit more careful when editing models. I have migrate_enabled=False in production and I run migrations more manually.
[web2py] Re: web2py - Best Practice
I think this is a worthwhile aspiration but I suspect we will only get there organically. The problem with some of those categories is that there are multiple good solutions that make it difficult to decide to use a probably inferior solution. I was beginning to create a generic shopping cart but went a little nuts and turned it into pricetack.com which is more specialized.
[web2py] Re: tomorrow in San Francisco
I'll be there. Looking forward to meeting Massimo and anyone else. Happy to meet up before or after if there is interest.
[web2py] URL() args encoding
My Web-programming and Python noobs continues to show. Thanks for bearing with me. I have a view with a fragment along the lines of the following to generates a list of links. foos has been generated in the controller. {{for foo in foos:}} lia href={{=URL('show', args=foo.name)}}{{=foo.name}}/a/li {{pass}} This works fine until foo.name has spaces and/or other URL-unfriendly chars in it. So the questions are: * Does web2py have its own mechanism for encoding/decoding URLs that is useful here? * If not, what is the preferred Python lib for doing URL encoding/ decoding? (P.S. I am aware that there are other ways of addressing this issue: e.g., use vars (which web2py seems to automatically encode) instead of args, or use args=foo.id instead or args=foo.name. In any event, it'd be good to know the web2py way to encode/decode URLs.)
[web2py] Re: Off topic: are Google Groups wires crossed?
Yes, I pointed this out a couple months ago. It appears that entire web2py threads are completely reposted within other groups (e.g., https://groups.google.com/forum/#!topic/fameisfame/Og_-6Z86DfE). The content of these other groups generally appears to be spam. I have no idea how this happens. Anthony On Wednesday, July 13, 2011 4:30:56 PM UTC-4, DenesL wrote: The recent activity of a group user can be viewed by clicking on the view profile link on any post made by him/her, but I am seeing activity in groups that I have never even heard about, let alone become a member of, and the posts certainly belong to this group. Maybe that could explain why some post have been disappearing from our group. I can see this happening not only on my profile but on other group user profiles as well. Comments? Suggestions?. (besides contacting Google I mean).
[web2py] Re: Web2py uses Django... on GAE
opened as ticket 337. i got far enough to even link to the google documentation on this, didn't get to testing it out though.
[web2py] Re: URL() args encoding
You may need to use urllib.urlencode: http://docs.python.org/library/urllib.html#urllib.urlencode
[web2py] Re: Simultaneous multi-language system.
Wow, that's a weird request. I suspect it is going to be easiest just to program the two variations without T().
[web2py] Trouble with database?!
I'm working on an app. During development, I wanted to make sure I could do a clean build of the db. So I wiped everything -- deleted all files under databases, sessions, errors, and any uploaded files and old static files that were generated by the app. So I start over populating the db. Some of the data I'm entering by CSV and some manually. One of the things I'm entering manually is a table created thus: def create(): form=SQLFORM.factory(db.mygroup,Field('invite','string')) if form.accepts(request.vars,session): mygroup_id=form.vars.id admin=auth.add_group('mygroup%d'%mygroup_id,'Group leader') auth.add_membership(admin) auth.add_permission(...) auth.add_permission(...) auth.add_permission(...) session.flash=DIV('Created mygroup: %s'%form.vars.name,_class='info') redirect(URL(r=request,f='show_mygroups')) elif form.errors: response.flash=DIV('Please correct errors and resubmit form',_class='error') return dict(title=T('Build Group'),form=form) Before wiping the db, this used to work OK. Now, the mygroup_id gets stuck on the first entry and doesn't budge off of 1, no matter how many times I submit the group. Obviously, the db is not being updated. However, eclipse shows the body of the form.accepts being executed. What's going on?
[web2py] Re: how to POST a file without using a form?
Isn't that on the receiving end? How do I POST the file. On Jul 12, 5:28 pm, pbreit pbreitenb...@gmail.com wrote: Can you just grab the request.var? def receive_posted_file() f = request.vars.ifile #process f
Re: [web2py] Re: how to POST a file without using a form?
Using urllib import urllib into your project and google for a post example On Jul 13, 2011 6:50 PM, weheh richard_gor...@verizon.net wrote: Isn't that on the receiving end? How do I POST the file. On Jul 12, 5:28 pm, pbreit pbreitenb...@gmail.com wrote: Can you just grab the request.var? def receive_posted_file() f = request.vars.ifile #process f
[web2py] Re: Trouble with database?!
Maybe try: 'mygroup%s' % mygroup_id Does SQLFORM.factory return a form.vars.id? I thought only happened when there was a DB insert?
[web2py] Re: dal trying to insert 0 instead of null?
Hi cjwebb Your suspect is correct and I had a similar barrier. Pay attention this part of log: File c:\web2py\gluon\sqlhtml.py, line 1205, in accepts self.vars.id = self.table.insert(**fields) Before the line 1205 accepts method tries to set up recipe_id with fields[fieldname]=. Probaly you must pass request.vars as a first parameter to accepts in your controller, and request.vars.recipe_id is an empty str type. Follow this sequence in the algorithm to understand what happens: Line(1020) fields = {} Line(1155) elif fieldname in self.vars: fields[fieldname] = self.vars[fieldname] Line (1160) value = fields.get(fieldname,None) **If you debug in this point, fields may return something like: {.., 'recipe_id': '',...} ** ... Line (1170) elif field.type.startswith('reference'): (1) -- if value != None and isinstance(self.table, Table) and not keyed: fields[fieldname] = safe_int(value) This field is a reference recipes type and in fields variable is empty intead None, So, in (1) the decision is evaluated as True, and after safe_int is called and returns 0. In my particular case, I have a table with a foreign key that accepts null values db.define_table( 'receivables', Field( 'matrix_id', db.matrices, ondelete=SET NULL, requires=[], label=T('matrix_id') ), Field( requires=[] overrides default validation, but I want keep the feature references and to use in queries. SET NULL assures that in database level I don't have problems when I erase a primary key in matrices. To fix the problem of empty value in matrix_id, I check in my controller if request.vars.matrix_id is differente than None and if it is a digit, otherwise I set to None. Also I can use autocomplete to store primary key from matrices (In models) db.receivables.matrix_id.widget=SQLFORM.widgets.autocomplete( request, db.matrices.matrix_composed, id_field=db.matrices.id, limitby=(0,10), min_length=2, ) Now I ask for everyone: If the column is defined as integer and as a reference to another table in the models, its value is empty when the field is submited, Web2py can solve this situation by setting a null value or fetch the value from default parameter? How can I avoid writing this kind of solution? Does anyone have any suggestions?
[web2py] Re: Trouble with database?! [closed]
Now I feel more than a little stupid. Obviously, I had it as form=SQLFORM(db.mygroup) originally, then added the Field later, which turned SQLFORM into SQLFORM.factory, which causes me to have to insert into the db manually. Must be having a senior moment. On Jul 13, 6:48 pm, weheh richard_gor...@verizon.net wrote: I'm working on an app. During development, I wanted to make sure I could do a clean build of the db. So I wiped everything -- deleted all files under databases, sessions, errors, and any uploaded files and old static files that were generated by the app. So I start over populating the db. Some of the data I'm entering by CSV and some manually. One of the things I'm entering manually is a table created thus: def create(): form=SQLFORM.factory(db.mygroup,Field('invite','string')) if form.accepts(request.vars,session): mygroup_id=form.vars.id admin=auth.add_group('mygroup%d'%mygroup_id,'Group leader') auth.add_membership(admin) auth.add_permission(...) auth.add_permission(...) auth.add_permission(...) session.flash=DIV('Created mygroup: %s'%form.vars.name,_class='info') redirect(URL(r=request,f='show_mygroups')) elif form.errors: response.flash=DIV('Please correct errors and resubmit form',_class='error') return dict(title=T('Build Group'),form=form) Before wiping the db, this used to work OK. Now, the mygroup_id gets stuck on the first entry and doesn't budge off of 1, no matter how many times I submit the group. Obviously, the db is not being updated. However, eclipse shows the body of the form.accepts being executed. What's going on?
[web2py] How to to get SQLFORM.factory to show only a subset of records ?
This will probably a facepalm moment but I can not figure it out. My present used form function form = SQLFORM.factory( Field('setup', requires=IS_IN_DB(db, db.setup.setupname, '%(setupname)s') )) Model db.define_table('setup', Field('setupname', type='string', unique=True, label=T('Setup name')), Field('description', type='string', label=T('Description')), Field('frame_id', db.frame, label=T('Frame ID')), Field('course_id', db.course, label=T('Course ID')), Field('ready', type='boolean', default=False, label=T('Ready for use')), Field('nostorage', type='boolean', default=False, label=T('No storage needed')), Field('noprofiles', type='boolean', default=False, label=T('No profiles needed')), Field('nonim', type='boolean', default=False, label=T('No nim actions needed')), Field('securitylevel', type='integer', default=0, label=T('Security Level')), Field('created_on','datetime',default=request.now, label=T('Created On'),writable=False,readable=False), Field('modified_on','datetime',default=request.now, label=T('Modified On'),writable=False,readable=False, update=request.now), format='%(setupname)s', migrate=settings.migrate) What I try to get is that the form only shows the setupname of the records where setup.read==True and then returns setup.id so I can use that. A addtional would be that the first selection is the first record and not empty. Thanks in advance. With regards, Mike Veltman
Re: [web2py] How to to get SQLFORM.factory to show only a subset of records ?
IS_IN_DB takes a DAL set, so you can limit the records returned. If you want the record ID returned, use db.setup.id. So, maybe something like this: Field('setup', requires=IS_IN_DB(db(db.setup.ready==True), db.setup.id, '%(setupname)s')) Anthony On Wednesday, July 13, 2011 9:06:03 PM UTC-4, Gwayne aka Mike Veltman wrote: This will probably a facepalm moment but I can not figure it out. My present used form function form = SQLFORM.factory( Field('setup', requires=IS_IN_DB(db, db.setup.setupname, '%(setupname)s') )) Model db.define_table('setup', Field('setupname', type='string', unique=True, label=T('Setup name')), Field('description', type='string', label=T('Description')), Field('frame_id', db.frame, label=T('Frame ID')), Field('course_id', db.course, label=T('Course ID')), Field('ready', type='boolean', default=False, label=T('Ready for use')), Field('nostorage', type='boolean', default=False, label=T('No storage needed')), Field('noprofiles', type='boolean', default=False, label=T('No profiles needed')), Field('nonim', type='boolean', default=False, label=T('No nim actions needed')), Field('securitylevel', type='integer', default=0, label=T('Security Level')), Field('created_on','datetime',default=request.now, label=T('Created On'),writable=False,readable=False), Field('modified_on','datetime',default=request.now, label=T('Modified On'),writable=False,readable=False, update=request.now), format='%(setupname)s', migrate=settings.migrate) What I try to get is that the form only shows the setupname of the records where setup.read==True and then returns setup.id so I can use that. A addtional would be that the first selection is the first record and not empty. Thanks in advance. With regards, Mike Veltman
Re: [web2py] How to to get SQLFORM.factory to show only a subset of records ?
For reference, see http://web2py.com/book/default/chapter/07#Database-Validators. On Wednesday, July 13, 2011 9:21:54 PM UTC-4, Anthony wrote: IS_IN_DB takes a DAL set, so you can limit the records returned. If you want the record ID returned, use db.setup.id. So, maybe something like this: Field('setup', requires=IS_IN_DB(db(db.setup.ready==True), db.setup.id, '%(setupname)s')) Anthony On Wednesday, July 13, 2011 9:06:03 PM UTC-4, Gwayne aka Mike Veltman wrote: This will probably a facepalm moment but I can not figure it out. My present used form function form = SQLFORM.factory( Field('setup', requires=IS_IN_DB(db, db.setup.setupname, '%(setupname)s') )) Model db.define_table('setup', Field('setupname', type='string', unique=True, label=T('Setup name')), Field('description', type='string', label=T('Description')), Field('frame_id', db.frame, label=T('Frame ID')), Field('course_id', db.course, label=T('Course ID')), Field('ready', type='boolean', default=False, label=T('Ready for use')), Field('nostorage', type='boolean', default=False, label=T('No storage needed')), Field('noprofiles', type='boolean', default=False, label=T('No profiles needed')), Field('nonim', type='boolean', default=False, label=T('No nim actions needed')), Field('securitylevel', type='integer', default=0, label=T('Security Level')), Field('created_on','datetime',default=request.now, label=T('Created On'),writable=False,readable=False), Field('modified_on','datetime',default=request.now, label=T('Modified On'),writable=False,readable=False, update=request.now), format='%(setupname)s', migrate=settings.migrate) What I try to get is that the form only shows the setupname of the records where setup.read==True and then returns setup.id so I can use that. A addtional would be that the first selection is the first record and not empty. Thanks in advance. With regards, Mike Veltman
Re: [web2py] How to to get SQLFORM.factory to show only a subset of records ?
Oh, and to get rid of the empty choice at the top of the list, add zero=None: IS_IN_DB(..., zero=None) On Wednesday, July 13, 2011 9:22:50 PM UTC-4, Anthony wrote: For reference, see http://web2py.com/book/default/chapter/07#Database-Validators. On Wednesday, July 13, 2011 9:21:54 PM UTC-4, Anthony wrote: IS_IN_DB takes a DAL set, so you can limit the records returned. If you want the record ID returned, use db.setup.id. So, maybe something like this: Field('setup', requires=IS_IN_DB(db(db.setup.ready==True), db.setup.id, '%(setupname)s')) Anthony On Wednesday, July 13, 2011 9:06:03 PM UTC-4, Gwayne aka Mike Veltman wrote: This will probably a facepalm moment but I can not figure it out. My present used form function form = SQLFORM.factory( Field('setup', requires=IS_IN_DB(db, db.setup.setupname, '%(setupname)s') )) Model db.define_table('setup', Field('setupname', type='string', unique=True, label=T('Setup name')), Field('description', type='string', label=T('Description')), Field('frame_id', db.frame, label=T('Frame ID')), Field('course_id', db.course, label=T('Course ID')), Field('ready', type='boolean', default=False, label=T('Ready for use')), Field('nostorage', type='boolean', default=False, label=T('No storage needed')), Field('noprofiles', type='boolean', default=False, label=T('No profiles needed')), Field('nonim', type='boolean', default=False, label=T('No nim actions needed')), Field('securitylevel', type='integer', default=0, label=T('Security Level')), Field('created_on','datetime',default=request.now, label=T('Created On'),writable=False,readable=False), Field('modified_on','datetime',default=request.now, label=T('Modified On'),writable=False,readable=False, update=request.now), format='%(setupname)s', migrate=settings.migrate) What I try to get is that the form only shows the setupname of the records where setup.read==True and then returns setup.id so I can use that. A addtional would be that the first selection is the first record and not empty. Thanks in advance. With regards, Mike Veltman
[web2py] [closed] Re: one form for multiple tables - updating record
Thanks Anthony. I checked that out but prefer Jay Kelnar take here: http://groups.google.com/group/web2py/msg/bc03cef19067fa83 In short, SQLFORM.factory has no record argument. You must retrieve the previous record and store it in form.vars. Jay shared me his code and I modified it here: http://pastie.org/2210228 hth
[web2py] Re: web2py - Best Practice
Great !!! Looks like there is some interest. Thanks for all the comments. I totally agree it's important to figure out what the compelling use case is for them, and how the necessary thousands of developer hours are going to get committed and coordinated to make it happen Unless someone has a better idea as a first step, I will create a wiki on gae using the vanilla plugin_wiki. (which I think is fantastic) From there we can set up a discussion board to flesh out the goals of the project.
Re: [web2py] Re: web2py - Best Practice
I like this as well! On Wed, Jul 13, 2011 at 10:54 PM, nic nicbythe...@gmail.com wrote: Great !!! Looks like there is some interest. Thanks for all the comments. I totally agree it's important to figure out what the compelling use case is for them, and how the necessary thousands of developer hours are going to get committed and coordinated to make it happen Unless someone has a better idea as a first step, I will create a wiki on gae using the vanilla plugin_wiki. (which I think is fantastic) From there we can set up a discussion board to flesh out the goals of the project.
Re: [web2py] How to to get SQLFORM.factory to show only a subset of records ?
Thanks about 1 zillion times :) Oh, and to get rid of the empty choice at the top of the list, add zero=None: IS_IN_DB(..., zero=None) On Wednesday, July 13, 2011 9:22:50 PM UTC-4, Anthony wrote: For reference, see http://web2py.com/book/default/chapter/07#Database-Validators. On Wednesday, July 13, 2011 9:21:54 PM UTC-4, Anthony wrote: IS_IN_DB takes a DAL set, so you can limit the records returned. If you want the record ID returned, use db.setup.id. So, maybe something like this: Field('setup', requires=IS_IN_DB(db(db.setup.ready==True), db.setup.id, '%(setupname)s')) Anthony On Wednesday, July 13, 2011 9:06:03 PM UTC-4, Gwayne aka Mike Veltman wrote: This will probably a facepalm moment but I can not figure it out. My present used form function form = SQLFORM.factory( Field('setup', requires=IS_IN_DB(db, db.setup.setupname, '%(setupname)s') )) Model db.define_table('setup', Field('setupname', type='string', unique=True, label=T('Setup name')), Field('description', type='string', label=T('Description')), Field('frame_id', db.frame, label=T('Frame ID')), Field('course_id', db.course, label=T('Course ID')), Field('ready', type='boolean', default=False, label=T('Ready for use')), Field('nostorage', type='boolean', default=False, label=T('No storage needed')), Field('noprofiles', type='boolean', default=False, label=T('No profiles needed')), Field('nonim', type='boolean', default=False, label=T('No nim actions needed')), Field('securitylevel', type='integer', default=0, label=T('Security Level')), Field('created_on','datetime',default=request.now, label=T('Created On'),writable=False,readable=False), Field('modified_on','datetime',default=request.now, label=T('Modified On'),writable=False,readable=False, update=request.now), format='%(setupname)s', migrate=settings.migrate) What I try to get is that the form only shows the setupname of the records where setup.read==True and then returns setup.id so I can use that. A addtional would be that the first selection is the first record and not empty. Thanks in advance. With regards, Mike Veltman With regards, Mike Veltman
[web2py] Re: [closed] Re: one form for multiple tables - updating record
Looks good. Thanks for sharing. On Wednesday, July 13, 2011 9:39:09 PM UTC-4, niknok wrote: Thanks Anthony. I checked that out but prefer Jay Kelnar take here: http://groups.google.com/group/web2py/msg/bc03cef19067fa83 In short, SQLFORM.factory has no record argument. You must retrieve the previous record and store it in form.vars. Jay shared me his code and I modified it here: http://pastie.org/2210228 hth
[web2py] Re: How to temporarily redirect all requests
Hello Anthony, and others! I implemented your very first suggestion, code in a model, outside of a function, as you (and pbreit) suggested. It worked fine! It's been very hectic (meetings/travel) and I haven't had a chance to reply until now. Thanks for your help (everybody!) !!! Luis.
[web2py] Re: how to use contrib/login_methods/linkedin_account.py
I didn't. But by doing the authentication manually (that is, in an interactive shell), I was able to connect to linked in. I realized that I wouldn't be able to get the information that I wanted though (email address - never provided by linkedin!), so I gave up. But the web2py linked-in auth is broken, as far as I can tell. The same thing with facebook. I think there are some steps that are just missing in the web2py implementation. I have a simple script that works with facebook auth (I can get all the info from a person and their graph on facebook) -- but I don't know how to integrate that with the web2py auth. If you, or anyone else, wants my facebook login script, I can post it. Luis.
[web2py] Re: Python 3 and the future of web2py
I am fine with Web3py. Atleast we start a step that way towards Python 3.x .. On Jul 13, 7:28 pm, Caleb Hattingh caleb.hatti...@gmail.com wrote: Agreed, I think web2py on Py3 is pointless. An entirely different project, called, let's say, web3py, which runs on Py3 is a different animal altogether... On 13 July 2011 15:50, Anthony abasta...@gmail.com wrote: The problem is, it would break backward compatibility. On Wednesday, July 13, 2011 12:54:57 AM UTC-4, Rahul wrote: Its true that there are existing python versions 2.6, 2.7.x but what I would like is Web2py support for Python 3. Reasons: 1. We should provide early support for Python 3 (regardless of what wsgi standard it will provide) because it may trigger a lot of python users to adopt Web2py as it might be the ONLY Full Stack Framework that will be supporting Python 3 2. Python 3.x is the future of Python (I see this to be very true) Eventually we would all be using Python 3.x in our production systems. 3. Lets progress rather than remaining stagnant with existing versions of Python only. I mean Why Not the latest Python ?? Cheers, Rahul D On Jul 12, 5:38 pm, pbreit pbreit...@gmail.com wrote: I suspect 2.6 is going to be popular for some time since that's what's in the current Ubuntu LTS (10.04).
[web2py] utf-8 issue
I think I always get tied up by utf-8 encoding and web2py is no exception. I'm uploading a text file, extracting some info, which I stuff into Fields, and then writing the modified text file to an upload Field. The Fields that I directly write from data read from the original text file all look OK. Something like Español ends up looking like Español. However, for the upload Field, Español ends up looking like Español. Two questions: does web2py treat encoding of field data and file streams differently? If I want to write the file so that Español reads Español, how do I do it? What encoding is needed?
[web2py] how to get user name before login is completed
How would one get auth.messages.logged_in to be something like Welcome Massimoupon login? auth.user_id is None at the time the auth.messages.logged_in is evaluated.