[web2py] Re: database query on nested tables
hi, consider this : # e.g. 1 work for row in db(db.product).select(): print row.rack.branch # e.g. 2 not work print db(db.product.rack.branch == 1).select() is it possible to have the example 2 work? thanks and best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] bug when starting external cron job in web2py 2.9.5
since I have serious problems with internal cron I want to switch to external cron. I created a test controller function which I can call like this: python web2py.py -J -M -S myapp/dev/test_cron in previous web2py versions (2.4.6 to be precise) this call works, but with 2.9.5 I get this error message: IOError: [Errno 2] No such file or directory: 'applications/myapp/compiled/controllers_dev_test_cron.pyc' this file is not found because the compiled file is saved as controllers.dev.test_cron.pyc (instead of controller_dev_test_cron.pyc in previous versions). So I assume this is a bug in web2py when directly calling a controller function from the command line. regards, Alex -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: What is the purpose of auth.settings.login_userfield?
Thanks for the response. BTW I am trying to change my system from username login to email login, AND at the same time I want those old (existing) users to continue using username to login. So I end up using username, but with a IS_EMAIL() validator. Is there any side effect for that? Anthony abasta...@gmail.com wrote: Yes, seems like a bug. I guess no one uses this setting (probably because it's not documented). Anthony On Sunday, April 6, 2014 3:02:41 PM UTC-4, Ray (a.k.a. Iceberg) wrote: On Sunday, April 6, 2014 12:03:59 AM UTC-7, Ray (a.k.a. Iceberg) wrote: Just want to double confirm. 1. I found many following lines in tools.py: userfield = self.settings.login_userfield or 'username' \ if 'username' in table_user.fields else 'email' it means: if 'username' in table_user.fields: userfield = self.settings.login_userfield or 'username' else: userfield = 'email 2. If we used a slightly different source code like this: userfield = self.settings.login_userfield or ('username' if 'username' in table_user.fields else 'email') it means something quite different: if self.settings.login_userfield: # if user explicitly define the login_userfield userfield = self.settings.login_userfield # then use it unconditionally else: # otherwise automatically determine one userfield = 'username' if 'username' in table_user.fields else 'email' So, to double confirm, what is the design purpose of auth.settings.login_userfield? If it is #1, I recommend to use a pair of brackets to avoid misunderstanding. userfield = (self.settings.login_userfield or 'username' ) if 'username' in table_user.fields else 'email' Well, now I believe the #2 purpose is the design intention, based on this section in Auth.register(): table_user = self.table_user() if self.settings.login_userfield: username = self.settings.login_userfield elif 'username' in table_user.fields: username = 'username' else: username = 'email' In this case, I believe #1 is a bug and need to be fixed. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/wZhiUboCRLw/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] routing issue
I have a web2py driven website. http://162.218.210.94/new_spin2/default/events works every time. However the routed version spinjazz.net/events which points to the same page works 80% of the time, 20% of the time it gets. invalid request. Now I think that this might just be true because of conditions currently in operation about speed of operation. eg it did not seem true yesterday, but is consistently true at the moment. So are there timing issues that can cause routing to go wrong? Is there anything I can do to avoid getting the 'invalid request message'? Thanks Peter -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: What is the purpose of auth.settings.login_userfield?
Are you storing the email address in both the username field and the email field? On Tuesday, April 8, 2014 11:47:05 AM UTC-4, Ray (a.k.a. Iceberg) wrote: Thanks for the response. BTW I am trying to change my system from username login to email login, AND at the same time I want those old (existing) users to continue using username to login. So I end up using username, but with a IS_EMAIL() validator. Is there any side effect for that? Anthony abasta...@gmail.com wrote: Yes, seems like a bug. I guess no one uses this setting (probably because it's not documented). Anthony On Sunday, April 6, 2014 3:02:41 PM UTC-4, Ray (a.k.a. Iceberg) wrote: On Sunday, April 6, 2014 12:03:59 AM UTC-7, Ray (a.k.a. Iceberg) wrote: Just want to double confirm. 1. I found many following lines in tools.py: userfield = self.settings.login_userfield or 'username' \ if 'username' in table_user.fields else 'email' it means: if 'username' in table_user.fields: userfield = self.settings.login_userfield or 'username' else: userfield = 'email 2. If we used a slightly different source code like this: userfield = self.settings.login_userfield or ('username' if 'username' in table_user.fields else 'email') it means something quite different: if self.settings.login_userfield: # if user explicitly define the login_userfield userfield = self.settings.login_userfield # then use it unconditionally else: # otherwise automatically determine one userfield = 'username' if 'username' in table_user.fields else 'email' So, to double confirm, what is the design purpose of auth.settings.login_userfield? If it is #1, I recommend to use a pair of brackets to avoid misunderstanding. userfield = (self.settings.login_userfield or 'username' ) if 'username' in table_user.fields else 'email' Well, now I believe the #2 purpose is the design intention, based on this section in Auth.register(): table_user = self.table_user() if self.settings.login_userfield: username = self.settings.login_userfield elif 'username' in table_user.fields: username = 'username' else: username = 'email' In this case, I believe #1 is a bug and need to be fixed. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/wZhiUboCRLw/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: database query on nested tables
On Wednesday, April 10, 2013 7:31:35 AM UTC-7, Niphlod wrote: I did say see it prettydate as it is takes a date and calculates automatically the timedelta to now. You need to have your own prettydate to be able to pass a timedelta of your own. If you've got a datetime.datetime kind of date, which is what the DAL returns, then the usual Python functions should allow you to pull pieces out, or just use strftime(). If you're working with a datetime.timedelta object, then you can also pull out the pieces pretty easily, which should make it easy to emulate prettydate. /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: routing issue
On Tuesday, April 8, 2014 9:51:55 AM UTC-7, peter wrote: I have a web2py driven website. http://162.218.210.94/new_spin2/default/events works every time. However the routed version spinjazz.net/events which points to the same page works 80% of the time, 20% of the time it gets. invalid request. Now I think that this might just be true because of conditions currently in operation about speed of operation. eg it did not seem true yesterday, but is consistently true at the moment. So are there timing issues that can cause routing to go wrong? Is there anything I can do to avoid getting the 'invalid request message'? Thanks Peter Well, doesn't the answer depend on how you're interfacing Web2Py to the internet? Are you using the stock Rocket server, or Apache+wsgi, or nginx, or ? If Apache, the gurus might also want to know how many threads you're setting up, etc. /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Web Editor Blank Screen
That's what I thought, the web editor is actually running in an iframe, and without that header, the webpage just refuses to load... On Saturday, April 5, 2014 9:05:29 PM UTC-7, James Ryan wrote: Derek, thank you so much. Appending the line below that you suggested to /etc/apache2/apache2.conf has fixed it! Header always append X-Frame-Options SAMEORIGIN On Tue, Apr 1, 2014 at 5:44 AM, Derek sp1...@gmail.com javascript:wrote: also, make sure you have this line in your apache config... Header always append X-Frame-Options SAMEORIGIN On Monday, March 31, 2014 11:25:23 AM UTC-7, Derek wrote: The 'canceled' message can be caused by a few different routes, either a navigation away to a different page, a user clicking the 'stop' button, or an ad blocker... you should look at your network data to get better answers. http://dev.chromium.org/for-testers/providing-network-details There are other situations that chrome will cancel requests, such as the dom object which caused the request getting deleted, or another request going to the same server had an error (it will stop the request to prevent from getting another error). I'd hazard a guess and say it's likely a dom object getting deleted, but you'll have to investigate further. If this happens a lot with your RPI it could be an indication of the server returning an error (and chrome cancels pending requests). On Friday, March 28, 2014 7:18:38 PM UTC-7, James Ryan wrote: Hi guys, Having an issue with the web editor. Other's have experienced this problem before with no resolution: https://groups.google.com/forum/#!topic/web2py/fIuUAqdSieQ https://groups.google.com/forum/#!topic/web2py/SxYJX90zszY http://comments.gmane.org/gmane.comp.python.web2py/120843 I'm running web2py on a raspberry pi on the local network. I can access it fine, log into the admin interface, create a new app, and peek at the files. When I go to edit any files the page loads but the file doesn't. I've tried on multiple machines and browsers. The raspberry pi is headless and doesn't have xserver so I can't try locally. Using Chrome's debugger I can see the http request being cancelled and there's no response data in the header http://imgur.com/5HUd3cp http://imgur.com/wBPwRRl Looking at /var/log/apache2/access.log the http request returns 200 OK Any thoughts what this might be? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Help defining architecture for app
There was a post a while back which gives you the recommended settings for Apache. Apache is very slow for Web2py and other python projects. nginx is much better. On Saturday, April 5, 2014 9:37:59 AM UTC-7, Francisco Betancourt wrote: I have not tuned Apache nor Postgres, their both vanilla installs through APT. I don't have the top or iostat output right now, I will simulate the load tomorrow that users don't work on the app and post back on monday. I will also enable PostgreSQL statistics and post them too. Thanks for the help. El viernes, 4 de abril de 2014 21:14:32 UTC-6, LightDot escribió: On Friday, April 4, 2014 7:14:39 PM UTC+2, Francisco Betancourt wrote: Hello LightDot Thanks for the interest in my post, hope we can come up with a way to improve performance. This is my current setup: - Host: Digital Ocean (and yes I do think their Droplets (as instances are called) are KVM) - OS: Ubuntu 13.04 - Web Server: Apache 2.2 - Database: PostgreSQL 9.1 - Memory usage in peak times is about 1.4GB (out of 2GB) - By the way I have no swap partition - I don't know how to count db connections, but in my db definition I used the poolsize=50, but again I don't know how to check the amount of connections at any given time - Disk usage acording to Digital Ocean metrics is medium never high (do truly I have never understand their graph) - CPU usage at some points gets close to 50% (since this a dual core I would assume one of the cores is at 100%) I don't know what else to mention but, if I missed anything please ask. And thanks again. This is good information to start with. Do you have more statistics, such as top and iostat output at the peak times, etc. ? Postgresql itself has statistics available, for example see http://www.postgresql.org/docs/9.1/static/monitoring-stats.html Did you already tune apache or postgresql in any way? if so, what are your settings..? On the web2py side and for your current use case, the poolsize=50 setting might be ok or not, depending on your apache/pg setup... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: What does this timeout error in pg8000 mean?
That's easy, it means your postgresql query timed out while rolling back. It was trying to read 1024 bytes but that didn't happen before the time expired. On Saturday, April 5, 2014 6:13:06 AM UTC-7, Mobility wrote: Versionweb2py™Version 2.9.5-stable+timestamp.2014.03.16.02.35.39PythonPython 2.7.5: /usr/bin/python (prefix: /System/Library/Frameworks/Python.framework/Versions/2.7)Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. Traceback (most recent call last): File /Library/Server/web2py/gluon/main.py, line 539, in wsgibase BaseAdapter.close_all_instances('rollback') File /Library/Server/web2py/gluon/dal.py, line 600, in close_all_instances db._adapter.close(action) File /Library/Server/web2py/gluon/dal.py, line 580, in close getattr(self, action)() File /Library/Server/web2py/gluon/dal.py, line 1923, in rollback return self.connection.rollback() File /Library/Server/web2py/gluon/contrib/pg8000/dbapi.py, line 455, in _fn return fn(self, *args, **kwargs) File /Library/Server/web2py/gluon/contrib/pg8000/dbapi.py, line 551, in rollback self.conn.rollback() File /Library/Server/web2py/gluon/contrib/pg8000/interface.py, line 622, in rollback self._rollback.execute() File /Library/Server/web2py/gluon/contrib/pg8000/interface.py, line 166, in execute self.c.close_portal(self._portal_name) File /Library/Server/web2py/gluon/contrib/pg8000/protocol.py, line 1326, in close_portal reader.handle_messages() File /Library/Server/web2py/gluon/contrib/pg8000/protocol.py, line 906, in handle_messages msg = self._conn._read_message() File /Library/Server/web2py/gluon/contrib/pg8000/protocol.py, line 1033, in _read_message bytes = self._read_bytes(5) File /Library/Server/web2py/gluon/contrib/pg8000/protocol.py, line 1021, in _read_bytes self._sock_buf = self._sock.recv(1024) timeout: timed out -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Apache ProxyPass to web2py
Hello web2py community! I have an Apache server that proxies all incoming requests of the nature x/y/z to my web2py application that is running on localhost using the Rocket web server. I did it with the following line: ProxyPass x/y/z http://localhost:8000/http://localhost:20009/SAMWebCookbookNOvA myApp This works perfectly. If a visitor comes to my site - for example: http://asdf.com/x/y/z the apache server correctly proxies it to http://localhost:8000/myApp The problem now is that if a user clicks on a link in the application, it works, but the URL now shows as http://asdf.com/myApp/default/controller-method/arg which violates what I want which is http://asdf.com/x/y/z/default/controller-method/arg The reason why I'm doing this is because I have an Apache server that proxies to many different apps running on localhost and I need to follow particular naming conventions. How do I go about doing this? Any help would be much appreciated! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: routing issue
Okay thanks Dave I am using uwsgi plus nginx. Peter On Tuesday, 8 April 2014 19:09:13 UTC+1, Dave S wrote: On Tuesday, April 8, 2014 9:51:55 AM UTC-7, peter wrote: I have a web2py driven website. http://162.218.210.94/new_spin2/default/events works every time. However the routed version spinjazz.net/events which points to the same page works 80% of the time, 20% of the time it gets. invalid request. Now I think that this might just be true because of conditions currently in operation about speed of operation. eg it did not seem true yesterday, but is consistently true at the moment. So are there timing issues that can cause routing to go wrong? Is there anything I can do to avoid getting the 'invalid request message'? Thanks Peter Well, doesn't the answer depend on how you're interfacing Web2Py to the internet? Are you using the stock Rocket server, or Apache+wsgi, or nginx, or ? If Apache, the gurus might also want to know how many threads you're setting up, etc. /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Multiple domains, one app
I remember someone doing this a while back and using a {{if domain1 then this.cssurl = url1 else this.cssurl = url2}} basically, returning a different css file for a different domain... if you don't think that just a different css would look all that different, I suggest you take a look here: www.csszengarden.com On Saturday, April 5, 2014 11:56:38 PM UTC-7, Kenneth wrote: Hello, is it possible to build an app that handle multiple domains but totally different layouts. I'm thinking something like this: views/domain1/layout.html default/index.html .. views/domain2/layout.html default/index.html ... I made an table called site that contains domainname and domain_url and by matching domainname and request.env.host_name I get an domain_url from database. In every .html I have changed the {{extend layout.html}} to {{extend domain_url + layout.html}} The same can be done for static folder. I'm I doing this too complicated? Kenneth -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Apache ProxyPass to web2py
you'd need also proxypassreverse.plus rewriting urls. Apache does the best it can, but routes.py is the real solution. On Tuesday, April 8, 2014 9:52:43 PM UTC+2, Michael Gheith wrote: Hello web2py community! I have an Apache server that proxies all incoming requests of the nature x/y/z to my web2py application that is running on localhost using the Rocket web server. I did it with the following line: ProxyPass x/y/z http://localhost:8000/http://localhost:20009/SAMWebCookbookNOvA myApp This works perfectly. If a visitor comes to my site - for example: http://asdf.com/x/y/z the apache server correctly proxies it to http://localhost:8000/myApp The problem now is that if a user clicks on a link in the application, it works, but the URL now shows as http://asdf.com/myApp/default/controller-method/arg which violates what I want which is http://asdf.com/x/y/z/default/controller-method/arg The reason why I'm doing this is because I have an Apache server that proxies to many different apps running on localhost and I need to follow particular naming conventions. How do I go about doing this? Any help would be much appreciated! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Bad Request upload image in iPad/iOS to web2py server
well, i was looking at it, and i see that the 'body' function is basically this: self._body = copystream_progress(self) except IOError: raise HTTP(400, Bad Request - HTTP body is incomplete) and looking at copystream_progress, the only path leading to a 400 error there is a missing content_length header. if all that looks good, make sure your filenames are sent in utf-8 On Friday, April 4, 2014 9:36:38 AM UTC-7, ayresrichard wrote: It is a multipart yes. I was able to use request.body.read() to read the requests' body in other platforms. It looks ok, and everything works. I even changed from using FormData in javascript to writing my custom body and so on. It all works fine except in iOS. There seems to be some kind of problem reading the body. And I can't even know what is there, since the server raises the 400 BAD REQ whenever I try to access it I don't understand very well how xmlhttprequest works and so on, I am only sending text right now, would I be able to solve this problem by changing the content-type header? I tried text/plain but that didn't work as well On Friday, March 28, 2014 2:03:31 AM UTC, Massimo Di Pierro wrote: Is this a normal multipart post request? If not, perhaps you should use request.body.read() and log what is in there. On Thursday, 27 March 2014 07:48:39 UTC-5, ayresrichard wrote: I am developing a web browser application where the user must upload a image file to a web2py server. I am using the traditional way for file input, which, in the iPad, gives the option to either upload an existing picture or take a new one from the camera. var url = http://please-help-me.com;; var file = document.getElementById(file).files[0]; var fd2 = new FormData(); fd2.append(upload, file); fd2.append(id, 123); var reader = new XMLHttpRequest(); reader.open('post',url, true); reader.onreadystatechange = function() { console.log(Status: + reader.status); } reader.send(fd2); This works fine in the desktop browsers, Android browser, but not in the iPad, where it occasionally gives a 400 Bad Request Error. It doesn't return the error every time. Just sporadically. Web2py returns this error message: ERROR:Rocket.Errors.Thread-20:Traceback (most recent call last): File /home/mdipierro/make_web2py/web2py/gluon/rocket.py, line 1337, in run File /home/mdipierro/make_web2py/web2py/gluon/rocket.py, line 1838, in run_a pp File /home/mdipierro/make_web2py/web2py/gluon/main.py, line 651, inapp_with _logging File /home/mdipierro/make_web2py/web2py/gluon/main.py, line 532, inwsgibase File /home/mdipierro/make_web2py/web2py/gluon/globals.py, line 252, in body HTTP: 400 BAD REQUEST Searching in the code, it appears the content of the post message is not valid and the web2py body function has trouble reading it. The error rises when I try to read the request.post_vars data I've tested the code without sending the image (and only sending other data) and it seems to be working every time. Is there a specific parameter I should add to the request? Why does it work sometimes, but not all the time? Thanks -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: database query on nested tables
John Resig wrote a 'prettydate' that is probably what he wants... http://ejohn.org/blog/javascript-pretty-date/ On Wednesday, April 10, 2013 7:31:35 AM UTC-7, Niphlod wrote: I did say see it prettydate as it is takes a date and calculates automatically the timedelta to now. You need to have your own prettydate to be able to pass a timedelta of your own. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Apache ProxyPass to web2py
Niphlod, Can you provide an example with routes.py as it pertains to this scenario? On Tuesday, April 8, 2014 3:14:39 PM UTC-5, Niphlod wrote: you'd need also proxypassreverse.plus rewriting urls. Apache does the best it can, but routes.py is the real solution. On Tuesday, April 8, 2014 9:52:43 PM UTC+2, Michael Gheith wrote: Hello web2py community! I have an Apache server that proxies all incoming requests of the nature x/y/z to my web2py application that is running on localhost using the Rocket web server. I did it with the following line: ProxyPass x/y/z http://localhost:8000/http://localhost:20009/SAMWebCookbookNOvA myApp This works perfectly. If a visitor comes to my site - for example: http://asdf.com/x/y/z the apache server correctly proxies it to http://localhost:8000/myApp The problem now is that if a user clicks on a link in the application, it works, but the URL now shows as http://asdf.com/myApp/default/controller-method/arg which violates what I want which is http://asdf.com/x/y/z/default/controller-method/arg The reason why I'm doing this is because I have an Apache server that proxies to many different apps running on localhost and I need to follow particular naming conventions. How do I go about doing this? Any help would be much appreciated! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: database query on nested tables
On Tuesday, April 8, 2014 2:44:52 PM UTC+2, 黄祥 wrote: hi, consider this : # e.g. 1 work for row in db(db.product).select(): print row.rack.branch # e.g. 2 not work print db(db.product.rack.branch == 1).select() is it possible to have the example 2 work? no, you can't. db.table.field == something is something that can be passed to the underlying db. db.table.field.linked_table is something that web2py does recursively (yep, pretty bad) to pretty print what the database stores as records in separate tables linked by a FK. in your case, you'd need a simple join. e.g. db( (db.table.field == db.ref_table.id) (db.ref_table.value == 'something') ).select(db.table.ALL) @Derek: that does exactly what web2py's prettyprint does. @all: do yourself a favour and start embracing moment.js ^__^ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Apache ProxyPass to web2py
the problem there is that web2py expects /app/controller/function/arg while you require /something/else/entirely/controller/function/arg if routes were not available, you'd need proxypass, proxypassreverse and a bit of apache rewrites. That being said, I tend to stay away from apache and I'm not going to change that in the foreseeable future, to maintain my own mental sanity :-P with routes instead, you'll still need proxypass and proxypassreverse, but as a requirement you must be at a point where your rocket instance responds to /something/else/entirely/controller/function/arg in the exact same way right now is responding to /app/controller/function/arg I'd use path_prefix with /something/else and entirely as the app name with the parametric router before dealing with regex patterns. @jlundell that is the god of rewrites may chime in :D -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: bug when starting external cron job in web2py 2.9.5
Did you try re-compile? On Tuesday, 8 April 2014 08:21:58 UTC-5, Alex wrote: since I have serious problems with internal cron I want to switch to external cron. I created a test controller function which I can call like this: python web2py.py -J -M -S myapp/dev/test_cron in previous web2py versions (2.4.6 to be precise) this call works, but with 2.9.5 I get this error message: IOError: [Errno 2] No such file or directory: 'applications/myapp/compiled/controllers_dev_test_cron.pyc' this file is not found because the compiled file is saved as controllers.dev.test_cron.pyc (instead of controller_dev_test_cron.pyc in previous versions). So I assume this is a bug in web2py when directly calling a controller function from the command line. regards, Alex -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: bug when starting external cron job in web2py 2.9.5
yes, application is recompiled with 2.9.5. everything works (so far), only calling the controller function from command line does not. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] id field is editable through REST PUT request
Our product is using the @request.restful() decorator to specify REST endpoints for our resources. During testing, I noticed that I can specify a PUT request var of id=x where x is some new id and the id of that row will change to x. This is even WITH db.table.id.writable = False. The PUT method is defined as follows: def PUT(table_name, record_id, **vars): return db(db[table_name]._id==record_id).validate_and_update(**vars) So, for example, on a db with db.person.id.writable = False, a request to http://127.0.0.1:8000/appname/default/api/person/1?id=100; will modify the person row with id 1 to be id 100. This seems like a relatively major problem... if a user were to be clever enough to play around with our UI and figure out the REST calls being made, he/she could potentially mess with all the ids and relationships of the resources, at least for that particular account (and any other resources we've exposed). Am I missing something? Does db.person.id.writable = False only apply to SQLFORMs? Is there some other way to prevent modification of the id field? Thanks ahead of time for any help. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: database query on nested tables
now, i know the reason why, thank you so much for your explaination, niphlod. best regards, stifan On Wednesday, April 9, 2014 4:49:26 AM UTC+7, Niphlod wrote: On Tuesday, April 8, 2014 2:44:52 PM UTC+2, 黄祥 wrote: hi, consider this : # e.g. 1 work for row in db(db.product).select(): print row.rack.branch # e.g. 2 not work print db(db.product.rack.branch == 1).select() is it possible to have the example 2 work? no, you can't. db.table.field == something is something that can be passed to the underlying db. db.table.field.linked_table is something that web2py does recursively (yep, pretty bad) to pretty print what the database stores as records in separate tables linked by a FK. in your case, you'd need a simple join. e.g. db( (db.table.field == db.ref_table.id) (db.ref_table.value == 'something') ).select(db.table.ALL) @Derek: that does exactly what web2py's prettyprint does. @all: do yourself a favour and start embracing moment.js ^__^ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Best approach to using the DAL with external data sources that will go into multiple tables?
Assuming each source needs the same data fields, how about just using one table and including an extra field to specify which source each record came from? Or if you really want a separate table for each timeseries, you could look into using table inheritance. http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Table-inheritance A little more about how you are planning to use or display the data might help. 38 separate tables, one table with 38 columns or rows? As a graph with each series being a line? ~Brian -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Pyston
Ha! Well now we know Guido's answer to Armin and the gang at PyPy! -- Joe On Thursday, April 3, 2014 11:41:22 AM UTC-7, Massimo Di Pierro wrote: This is really important! https://tech.dropbox.com/2014/04/introducing-pyston-an-upcoming-jit-based-python-implementation/ Why is this important? because finally a major technology company has committed to improve an already existing language that we love (Python) as opposed to inventing their own (Dart, Go, etc). I trust something good will come out of this. Hopefully sooner rather than later. Massimo -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] SOAP
I would like to use SOAP to communicate with a third-party web service (eg, from Fedex), but the documentation (ie, web2py book) is awfully skimpy. I'd like to see some examples. I'd like to see a complete description of the API. I want to understand the general procedure for making a SOAP request. Can anyone help? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Dynamic, User customisable DAL connection parameters
Hello, I am building a web2py app which is an admin interface for an exisitng application with its own database. I will define all of the other app's tables with migrate=False. I would like the setting of the DAL connection parameters for this database to be a part of the web2py application. Problem is that I will not know the password, or even the user, and these need to be updatable by the end user. So I can't let web2py try to connect until I have these set. Looking for feedback on the following approach. It works (so far) but wondering if there is a simpler approach or a pattern that has already been worked out ? 1) I have defined the DAL and tables for the user's app in a models subfolder, so that the initial web2py connection will not immediately try to connect to this database. 2) I have a 0conn.py model file, something like: CONN_FUNCTION='localconn' if session.localconn: # Good news, I already have the connection details as a session variable. pass elif not session.redir: #redirect to the screen with the form to specify the connection details , and update the session parameters #set redir to True so that it doesn't start an infinite loop of redirects each time the model is called. session.redir = True redirect(URL('LocalTD', 'default', CONN_FUNCTION)) elif session.redir and request.function == CONN_FUNCTION: # This is a proper redirect to the conn setting, let it go pass else: print This should really be a redirect, what's going on ? print I have a session.localtdconn: %s, redir : %s % (session.localtdconn, session.redir) 3) in the standard SQLITE db.py I have defined a connection table that stores all of the connection parameters. The function CONN_FUNCTION (from above) has a form that retrieves this info and allows the user to update it. if the form is accepted, it will also set the session variables. CONN_FUNCTION is called the first time the app is opened to confirm the connection details, update the table if necessary, and sets the session variables. 4) finally my models/local.py model file specifies DAL something like: dbc = DAL('drivername'://DSN=session.localconn['dsn']; \ UID=session.localconn['dbuser']; \ PWD=session.localconn['pwd']; etc. This model file should only be called if the session.localconn variable is already set. Any comments on this apprach ? Thanks Andrew W -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.