[web2py] Re: Request Password not working correct
Thanks Dave, I will take your valuable advice but I still need to debug it. Can you (and someone) please help me about it. Regards, Ramashish On Tuesday, January 6, 2015 1:11:57 AM UTC+5:30, Dave S wrote: On Monday, January 5, 2015 8:49:34 AM UTC-8, Ramashish Gaurav wrote: Hi all, I have deployed my app on internet. At initial stage, every thing was working great. No bugs. When a user would register himself, a confirmation email would be successfully sent to the user's registered email id. Even the 'Lost Password' option was working correct. Now I made some changes in my app few days ago. I cannot remember at which places. That sounds like you don't use source control to keep a record of your previous versions (and of changes between versions). If you don't, may I recommend that you do? One of the things a good source control tool does is provide a way for you to narrow down *when *a bug was introduced, which helps to narrow down *where* it was introduced. If you're not familiar with source control, aka version control, here's a good introduction: URL:http://ericsink.com/vcbe/ (I'm a Mercurial-type; somewhere between an advanced beginner and a power user; I can also use SVN, because I have to at work.) /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: web2py and Sublime Text
Sorry, i delete the repository but until wednesday will return with improvements. -- 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] how to: tumblr login for web2py
Thanks, I added it! On Sunday, January 4, 2015 11:44:19 PM UTC+1, Michele Comitini wrote: Very nice! just one detail to make it easier for the ones that do not have apt-get... sudo apt-get install python-oauth2 can be replaced with: pip install --user python-oauth2 making it portable to any environment where web2py works 2015-01-03 13:44 GMT+01:00 Falko Delarue falko@gmail.com javascript:: This is how you login to your web2py app with Tubmblr Register a Tubmblr app (you will of course need a Tubmblr account) https://www.tumblr.com/oauth/register and configure later at https://www.tumblr.com/settings/apps get the consumer key and secret install the oauth2 lib (instructions only for ubuntu) sudo apt-get install python-oauth2 download the pytumblr lib from (Download ZIP in right menu) https://github.com/tumblr/pytumblr extract only the pytumblr folder to yourapp/modules edit yourapp/modules/pytumblr/__init__.py and add dot . in front of the helpers and request import like this from .helpers import validate_params, validate_blogname from .request import TumblrRequest add the following code to your db.py consumer_key = 'XXX' consumer_secret = 'XX' request_token_url = 'http://www.tumblr.com/oauth/request_token' authorize_url = 'http://www.tumblr.com/oauth/authorize' access_token_url = 'http://www.tumblr.com/oauth/access_token' from gluon.contrib.login_methods.oauth10a_account import OAuthAccount import pytumblr class TumblrOAuth(OAuthAccount): OAuth for Tumblr def get_user(self): if not self.accessToken(): return None client = pytumblr.TumblrRestClient( consumer_key, consumer_secret, self.accessToken().key, self.accessToken().secret, ) info = client.info() if info and ('user' in info): return dict( first_name=info['user']['name'], registration_id='tumblr:%s' % info['user']['name'], ) auth.settings.login_form = TumblrOAuth(globals(), consumer_key, consumer_secret, authorize_url, request_token_url, access_token_url) Replace the consumer key and secret with yours! Tumblr does not provide first or last name or an id thats why only the crude info in the return. I do not really need to create proper users so this is enough for me, you can improve on that. Also this approach will let you log in only with Tumblr, you will have to figure our the rest, this is only a basic tutorial. Did I miss anything? Did you like that? Write a comment! -- 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] Mail don't send without errors
Hello all. I've got a strange problem. With a specific mail configuration I don't have any error but emails are not going out. So if I use this configuration mails are not going out: Model: mail = auth.settings.mailer mail.settings.server = 'zimbra.mydomain.com:25' mail.settings.sender = 'sa...@mydomain.com' mail.settings.login = 'sa...@mydomain.com:password' Controller: email_sent = mail.send(to=['myem...@gmail.com'], subject = subject, reply_to=email, message=message) And email_sent = 1, crazy. And in the same application with another configuration emails are going out. mail = auth.settings.mailer mail.settings.server = 'smtp.anotherdomain.com:587' mail.settings.sender = 'sa...@anotherdomain.com' mail.settings.login = 'user_name:password' Someone knows why or where I can search for debug information's ? Thanks,bye. -- 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] Request Password not working correct
Hi all, I have deployed my app on internet. At initial stage, every thing was working great. No bugs. When a user would register himself, a confirmation email would be successfully sent to the user's registered email id. Even the 'Lost Password' option was working correct. Now I made some changes in my app few days ago. I cannot remember at which places. Now following bug came up. When the user goes for 'Lost Password' option, he is successfully redirected to 'request_reset_password' page. There is a form to accept the users email id. The default title Request reset password which used to appear earlier does not appears now on the 'request_reset_password' page. Neither the value of button Request reset password' appears on it. Instead an empty value is there on the submit button. Now when the user submits his email id, there is a mail generated at my_em...@gmail.com but with no link and no subject i.e. an empty mail. Also the mail generated at my_em...@gmail.com is not sent to user_em...@gmail.com. I don't know what to do now to debug it. I am not finding a place to start with. However the confirmation email sent during registering process is still working right. Only the reset password email is not working. Also : auth.settings.reset_password_requires_verification = True is done in db.py . Please help me debug this error. (If it is internal error and cannot be debugged, then can you please give me an alternative way to implement reset password function). -- 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: web2py RESTful timeout
On Sunday, January 4, 2015 9:04:21 PM UTC-8, Bart wrote: Adding exception handling inside my RESTful api fixed my problem. Sometimes my RESTful posts contained corrupted data and this would cause an exception and hang future posts. Adding try/except solved my issue. It's always good to heard about forward progress! /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: What is represent syntax for external url?
thanks Niphlod, works 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: max value in linked tables
Thanks a lot, i learned something new today :) Obvious solution, once you think of it, and much quicker than building loops. Best regards, Jaap On Monday, December 29, 2014 10:51:01 AM UTC+1, Massimo Di Pierro wrote: db.employee_contract.contract_id == db.contract.id) (db.employee_contract.employee_id == db.employee.id I think you should do it: contracts = ((db.employee_contract.contract_id == db.contract.id) (db.employee_contract.employee_id == db.employee.id)) rows = db(contracts).select(db.employee.ALL, db.contract.ALL, orderby= db.employee.id|~db.contract.start_date, distinct=db.employee.id) On Sunday, 28 December 2014 15:57:10 UTC-6, JaapP wrote: Hi, Any hints about how to tackle the following problem greatly appreciated: given three tables: *employee*: id name ... *contract*: id start_date fte100 ... *employee_contract:* id employee_id contract_id An employee can have one or more contracs; they are linked through the employee_contract table. I would like to find a query that returns the contract details for the latest contract for an employee; i've solved a little step of my puzzle and can retrieve the latest contract by doing something like this: employee_id = 10 contr = db( (db.employee.id == employee_id) (db.employee_contract.contract_id == db.contract.id) (db.employee_contract.employee_id == db.employee.id) ).select(db.employee.ALL, db.contract.start_date.max()) latest_start_date = contr.contract.start_date.max() but i need also the corresponding contract.fte100 field. Can this be done by using the DAL, or should i construct a loop to find the answer? Best regards, Jaap -- 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: Any way for placing many views in one html file?
It has been a while since I did anything with web2py, but I seem to recall that if you didn't have a view for a function it would open up a default view, which is also in a file. (Was it generic.html?) Anyway, the point being you might want to use that for your catch all file instead of creating your own specific file. On Sunday, January 4, 2015 4:59:40 AM UTC-5, Przemysław wrote: Solved. Just to give a tip to another newbie: 1. In mycontroler.py place the code response.view = 'myview.html' to force executing myview.html regardless of a function name. 2. In myview.html use {{if request.function==anyviewname:}} to execute just a block of code designed for a certain view. Or just look inside appadmin.py and appadmin.html of your application to get the idea. Przemek -- 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: web2py and Sublime Text
We back with improvements and better descriptions! http://cassiobotaro.github.io/my_environment/ -- 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: How to display columns of data without abbreviation in the database aministrative interface?
On Sunday, January 4, 2015 12:42:30 AM UTC-8, Przemysław wrote: Thank you very much Dave! The truncate parameter works perfect. Additionally I've just learned how to place many views in one html file what was the subject of my second question on this group. Thanks a lot! PS. Przemek from Gonzaga University is not me - I live in Poland. He the basketball player was playing in Portland over the weekend, with his parents visiting from Poland. You guys do get around ;-) /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] Is the .select(cache.x) cleared automatically upon expiration?
Hi! When caching selects, in memory or disk, are they then cleared automatically when the expiration time is over? Removed and forgotten? Or is there some cleanup script similar to the one for sessions? - Robin -- 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: Any way for placing many views in one html file?
Note that this is a bit inefficient, as web2py will parse the entire view for each page requested. It will help if you compile the views. Anthony On Sunday, January 4, 2015 4:59:40 AM UTC-5, Przemysław wrote: Solved. Just to give a tip to another newbie: 1. In mycontroler.py place the code response.view = 'myview.html' to force executing myview.html regardless of a function name. 2. In myview.html use {{if request.function==anyviewname:}} to execute just a block of code designed for a certain view. Or just look inside appadmin.py and appadmin.html of your application to get the idea. Przemek -- 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: Websocket doesn't work on stable version
are you running the Tornado Websocket server ? El domingo, 4 de enero de 2015 16:09:20 UTC-5, Tito Garrido escribió: Hi Folks, I am using 2.9.11 and when I try to use $.web2py.web2py_websocket('ws:// 127.0.0.1:/realtime/mygroup', function(e){alert(e.data)}) I receive error 403 Forbidden from the server. Chrome: WebSocket connection to 'ws://127.0.0.1:/realtime/mygroup' failed: Error during WebSocket handshake: Unexpected response code: 403 Firefox: Firefox can't establish a connection to the server at ws://127.0.0.1 :/realtime/mygroup. var ws = new WebSocket(url); From python terminal it works: from gluon.contrib.websocket_messaging import websocket_send websocket_send('http://127.0.0.1:', 'Hello World', 'mykey', 'mygroup') '' What am I missing? Regards, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- 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: Web2Py on AWS EC2
maybe the the linux vm has a firewall on port 8000 by default security groups aren't configured for port 8000. if you're using the vanilla amazon ec2 instance, see the related documents on http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html#adding-security-group-rule BTW: with or without the explicit -p 8000 it will only listen to port 8000, so don't even try to reach it from http://xxx.xxx./: you need to use ALWAYS http://xxx.xxx.xxx:8000/ . btw2: if you're not skilled in system administration and you don't want to learn there are far better environments to deploy web2py which will take care of the administrative side of things. If instead you want to learn something on the process, see the bazillions guides around the internet ^_^ On Sunday, January 4, 2015 10:11:01 PM UTC+1, NeoToren wrote: Must be something really simple (and stupid on my behalf) that I am doing or not doing correctly... While in the web2py folder on the AWS instance, I've run web2py by trying both specifying the port and without it: 1. python web2py.py -i 0.0.0.0 -a mypwd 2. python web2py.py -i 0.0.0.0 -a mypwd -p 8000 In both cases it replies with the usual: *web2py Web Framework* *Created by Massimo Di Pierro, Copyright 2007-2015* *Version 2.9.11-stable+timestamp.2014.09.15.23.35.11* *Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), IMAP(imaplib)* *please visit:* * http://127.0.0.1:8000/ http://127.0.0.1:8000/* *use kill -SIGTERM 27150 to shutdown the web2py server* Which I take as the web2py server is up and running Tried to access web2py server at: 1. ec2-xx-xx-xx-xx.compute-1.amazonaws.com javascript: (where the xx are the numbers in the Public DNS as they appear on my instance on EC2 page) 2. ec2-xx-xx-xx-xx.compute-1.amazonaws.com javascript::8000 3. xx.xx.xx.xx/ and with the port specified xx.xx.xx.xx:8000/ the actual IP address numbers... 4. https://ec2-xx-xx-xx-xx.compute-1.amazonaws.com javascript:/admin/default/index with or without port... Just doesn't work. Eventually the browser says it takes too long to load page so page doesn't exist or cannot be accessed. -- 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: Not getting expected results from a query
start with: def cost3(): jnum = request.args(0,cast=int) a = 0 results = db(db.PO.job_id==jnum).select() for row in results: a = a + row.mycost return dict(a=a, howmany=len(results)) so you can check how many rows are you actually selecting :P On Sunday, January 4, 2015 4:17:03 AM UTC+1, Greg White wrote: I am brand new to web2py and know a little python, so I am a definite novice. I am trying to build a purchasing agent app and am getting result 0 from function cost3. I am expecting to get a sum of the values for a specified job number (in cost2) in table PO Field mycost when I specify a job number in function cost2.. but I am not getting a sum of those numbers but am getting 0 instead. Any help would be appreciated, thanks. db db.define_table('jobinfo', Field('jobnumber', 'integer', requires=IS_NOT_EMPTY()), Field('jobname', 'string', requires=IS_NOT_EMPTY()), Field('jobbudget', 'double'), format = '%(jobnumber)s') db.define_table('vendortype', Field('vtype', 'string', requires=IS_NOT_EMPTY()), format = '%(vtype)s') db.define_table('vendorr', Field('company_name',requires=IS_NOT_EMPTY()), Field('address1',requires=IS_NOT_EMPTY()), Field('address2'), Field('city',requires=IS_NOT_EMPTY()), Field('co_state',requires=IS_NOT_EMPTY()), Field('zip',requires=IS_NOT_EMPTY()), Field('vendor_type', db.vendortype), Field('terms'), format = '%(company_name)s') db.define_table('POreq', Field('job_id', db.jobinfo, requires=IS_NOT_EMPTY()), Field('Vendor_id', db.vendorr, requires=IS_NOT_EMPTY()), Field('Qty_1'), Field('Description_1'), Field('Notes_1'), Field('RequiredBy_1','date'), format = '%(Vendor_id)s') db.define_table('PO', Field('job_id', db.jobinfo ), Field('vname',db.vendorr), Field('Qty_1', 'double'), Field('Description_1'), Field('Notes_1'), Field('RequiredBy_1','date'), Field('mycost', 'double'), format = '%(job_id)s') controller def cost2(): form=FORM('Job Number: ', INPUT(_name='jobnumber', requires=IS_INT_IN_RANGE(0,9000)), INPUT(_type='submit')).process() if form.accepted: redirect(URL('cost3',args=form.vars.jobnumber)) return dict(form=form) def cost3(): jnum = request.args(0,cast=int) a = 0 for row in db(db.PO.job_id==jnum).select(): a = a + row.mycost return a -- 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: setup-web2py-nginx-uwsgi-ubuntu.sh
Also!! :) Richard On Sat, Jan 3, 2015 at 11:23 PM, Александр Остыловский ostilov...@gmail.com wrote: Much easier. You must use https (not nttp) and then everything works. понедельник, 29 декабря 2014 г., 21:11:44 UTC+7 пользователь Александр Остыловский написал: Hello! Run on ubuntu 14.04 installation of nginx-uwsgi with a script that comes with web2py directory scripts: sudo ./setup-web2py-nginx-uwsgi-ubuntu.sh During installation, it asked in particular e-mail, password. I go to the browser to 127.0.0.1. web2py says he works (it is clear that even with nginx). But when you try to log into the administrative interface says Admin is disabled, since it is impossible to gain access to the password file -- 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. -- 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: Request Password not working correct
On Monday, January 5, 2015 8:49:34 AM UTC-8, Ramashish Gaurav wrote: Hi all, I have deployed my app on internet. At initial stage, every thing was working great. No bugs. When a user would register himself, a confirmation email would be successfully sent to the user's registered email id. Even the 'Lost Password' option was working correct. Now I made some changes in my app few days ago. I cannot remember at which places. That sounds like you don't use source control to keep a record of your previous versions (and of changes between versions). If you don't, may I recommend that you do? One of the things a good source control tool does is provide a way for you to narrow down *when *a bug was introduced, which helps to narrow down *where* it was introduced. If you're not familiar with source control, aka version control, here's a good introduction: URL:http://ericsink.com/vcbe/ (I'm a Mercurial-type; somewhere between an advanced beginner and a power user; I can also use SVN, because I have to at work.) /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: Struggling with multi user
Once again, thank you. I'll get there in the end. On Sunday, 4 January 2015 02:37:09 UTC, Massimo Di Pierro wrote: I would do: db.define_table( 'shoe', Field('model',db.model), Field('purchased','date'), Field('price','integer'), auth.signature, # include created_by and created_on format=lambda r: '%s %s %s' % (r.model.manufacturer.name ,r.model.model,r.purchased)) along with a common filter as you suggested: db.shoe._common_filter = lambda query: db.shoe.created_by == auth.user_id Massimo On Saturday, 3 January 2015 13:00:24 UTC-6, Gary Cowell wrote: Hello Sorry for the probably obvious questions, but I do search for answers honest :) Anyway, what I want is for my table rows to be user specific. Such that when each user registers, the database looks empty to them, until they start creating rows in their forms. I have added these definitions to each table: db.define_table( 'shoe', Field('model',db.model), Field('purchased','date'), Field('price','integer'), Field('created_on', 'datetime', default=request.now, update=request.now, writable=False), *Field('created_by', 'reference auth_user',* * default=auth.user_id, update=auth.user_id, writable=False),* format=lambda r: '%s %s %s' % (r.model.manufacturer.name ,r.model.model,r.purchased)) So I've added created_by referencing auth_user, and this places the logged in user into the row I could add code to the controller, the simple controller looks like @auth.requires_login() def shoe(): form = SQLFORM(db.shoe) if form.process().accepted: response.flash = 'form accepted' elif form.errors: response.flash = 'form has errors' else: response.flash = 'please fill out the form' return dict(form=form) Perhaps with a SQLFORM.factory somehow? Or is CRUD the way to go? I have no idea about CRUD yet (nor much of an idea about most of this right now, but I'm learning) Or perhaps using common_filter? Somehow like this: table._common_filter = lambda query: db.shoe.created_by == auth.user.id I don't mind really which way this gets done, but if there's a canonical way, or a best practice way, I'd like to learn that, instead of the 'wrong but works' way. Thanks! Gary -- 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: How to display columns of data without abbreviation in the database aministrative interface?
Thank you very much Dave! The truncate parameter works perfect. Additionally I've just learned how to place many views in one html file what was the subject of my second question on this group. Thanks a lot! PS. Przemek from Gonzaga University is not me - I live in Poland. -- 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: web2py RESTful timeout
Adding exception handling inside my RESTful api fixed my problem. Sometimes my RESTful posts contained corrupted data and this would cause an exception and hang future posts. Adding try/except solved my issue. Thanks, Bart On Friday, November 21, 2014 8:36:36 AM UTC-7, Bart wrote: I have a python script that posts data to my web2py/application/projects database using RESTful services. Everything works fine for an hour or two, but then all future posts will timeout. If, using a web browser, I reload the web2py application's main page then the RESTful services start working again for another hour or two. Any ideas why I cant run a script 24/7 to GET/POST data to my web2py application's RESTful services? -- 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] Not getting expected results from a query
I am brand new to web2py and know a little python, so I am a definite novice. I am trying to build a purchasing agent app and am getting result 0 from function cost3. I am expecting to get a sum of the values for a specified job number (in cost2) in table PO Field mycost when I specify a job number in function cost2.. but I am not getting a sum of those numbers but am getting 0 instead. Any help would be appreciated, thanks. db db.define_table('jobinfo', Field('jobnumber', 'integer', requires=IS_NOT_EMPTY()), Field('jobname', 'string', requires=IS_NOT_EMPTY()), Field('jobbudget', 'double'), format = '%(jobnumber)s') db.define_table('vendortype', Field('vtype', 'string', requires=IS_NOT_EMPTY()), format = '%(vtype)s') db.define_table('vendorr', Field('company_name',requires=IS_NOT_EMPTY()), Field('address1',requires=IS_NOT_EMPTY()), Field('address2'), Field('city',requires=IS_NOT_EMPTY()), Field('co_state',requires=IS_NOT_EMPTY()), Field('zip',requires=IS_NOT_EMPTY()), Field('vendor_type', db.vendortype), Field('terms'), format = '%(company_name)s') db.define_table('POreq', Field('job_id', db.jobinfo, requires=IS_NOT_EMPTY()), Field('Vendor_id', db.vendorr, requires=IS_NOT_EMPTY()), Field('Qty_1'), Field('Description_1'), Field('Notes_1'), Field('RequiredBy_1','date'), format = '%(Vendor_id)s') db.define_table('PO', Field('job_id', db.jobinfo ), Field('vname',db.vendorr), Field('Qty_1', 'double'), Field('Description_1'), Field('Notes_1'), Field('RequiredBy_1','date'), Field('mycost', 'double'), format = '%(job_id)s') controller def cost2(): form=FORM('Job Number: ', INPUT(_name='jobnumber', requires=IS_INT_IN_RANGE(0,9000)), INPUT(_type='submit')).process() if form.accepted: redirect(URL('cost3',args=form.vars.jobnumber)) return dict(form=form) def cost3(): jnum = request.args(0,cast=int) a = 0 for row in db(db.PO.job_id==jnum).select(): a = a + row.mycost return a -- 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: Web2Py on AWS EC2
Must be something really simple (and stupid on my behalf) that I am doing or not doing correctly... While in the web2py folder on the AWS instance, I've run web2py by trying both specifying the port and without it: 1. python web2py.py -i 0.0.0.0 -a mypwd 2. python web2py.py -i 0.0.0.0 -a mypwd -p 8000 In both cases it replies with the usual: *web2py Web Framework* *Created by Massimo Di Pierro, Copyright 2007-2015* *Version 2.9.11-stable+timestamp.2014.09.15.23.35.11* *Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), IMAP(imaplib)* *please visit:* * http://127.0.0.1:8000/ http://127.0.0.1:8000/* *use kill -SIGTERM 27150 to shutdown the web2py server* Which I take as the web2py server is up and running Tried to access web2py server at: 1. ec2-xx-xx-xx-xx.compute-1.amazonaws.com ec2-u...@ec2-xx-xx-xx-xx.compute-1.amazonaws.com (where the xx are the numbers in the Public DNS as they appear on my instance on EC2 page) 2. ec2-xx-xx-xx-xx.compute-1.amazonaws.com ec2-u...@ec2-xx-xx-xx-xx.compute-1.amazonaws.com:8000 3. xx.xx.xx.xx/ and with the port specified xx.xx.xx.xx:8000/ the actual IP address numbers... 4. https://ec2-xx-xx-xx-xx.compute-1.amazonaws.com ec2-u...@ec2-xx-xx-xx-xx.compute-1.amazonaws.com/admin/default/index with or without port... Just doesn't work. Eventually the browser says it takes too long to load page so page doesn't exist or cannot be accessed. -- 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: setup-web2py-nginx-uwsgi-ubuntu.sh
Much easier. You must use https (not nttp) and then everything works. понедельник, 29 декабря 2014 г., 21:11:44 UTC+7 пользователь Александр Остыловский написал: Hello! Run on ubuntu 14.04 installation of nginx-uwsgi with a script that comes with web2py directory scripts: sudo ./setup-web2py-nginx-uwsgi-ubuntu.sh During installation, it asked in particular e-mail, password. I go to the browser to 127.0.0.1. web2py says he works (it is clear that even with nginx). But when you try to log into the administrative interface says Admin is disabled, since it is impossible to gain access to the password file -- 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: Any way for placing many views in one html file?
Solved. Just to give a tip to another newbie: 1. In mycontroler.py place the code response.view = 'myview.html' to force executing myview.html regardless of a function name. 2. In myview.html use {{if request.function==anyviewname:}} to execute just a block of code designed for a certain view. Or just look inside appadmin.py and appadmin.html of your application to get the idea. Przemek -- 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: models: markmin.py
what app are you talking about? Please post the files and we can tell you what they do. They do not come with web2py. On Sunday, 4 January 2015 07:25:15 UTC-6, Dmitry Ermolaev wrote: Hi what does markmin.py http://127.0.0.1:8000/admin/default/peek/lite_merch/models/markmin.py?id=models__markmin__py in models? -- 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] setup-web2py-nginx-uwsgi-ubuntu.sh
It was not an email passwd, it was admin password... If you omit it, the installation script may have install web2py anyway, but not setting password for admin interface... If this password is not setted up properly web2py prevent access to admin interface... If you want to correct the situation, try this : sudo -u www-data python -c from gluon.main import save_password; save_password('123456',443) Where 123456 is your password surrounding with single quote. It should create a file named parameters_443.py or parameters_8000.py depending of your configuration... If you don't use HTTPS, change '443' up there by the actual port number you use to access your web2py server instance. Richard On Mon, Dec 29, 2014 at 9:11 AM, Александр Остыловский ostilov...@gmail.com wrote: Hello! Run on ubuntu 14.04 installation of nginx-uwsgi with a script that comes with web2py directory scripts: sudo ./setup-web2py-nginx-uwsgi-ubuntu.sh During installation, it asked in particular e-mail, password. I go to the browser to 127.0.0.1. web2py says he works (it is clear that even with nginx). But when you try to log into the administrative interface says Admin is disabled, since it is impossible to gain access to the password file -- 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. -- 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: Mail don't send without errors
are you sure that the problem is not that the rejection happens after the SMTP accepted the mail ? web2py doesn't do too much magic in terms of return value...it uses sendmail() from smtplib and traps any exception. If you don't see exceptions, smtplib.sendmail isn't raising, so it means that the mail is accepted for at least one recipient. From then on, you should inspect SMTP's server logs. -- 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] What is represent syntax for external url?
What is controller represent syntax for creating a link to an external url? URL is the name of the field that contains the url ( http://www.gov-ideas.com/). When I use this: db.SuperObjectURL.URL.represent = lambda v, r: A(r.URL, _href=URL('URL', args=r.URL)) Instead of getting this: a href=http://www.gov-ideas.com/; Part of the link address includes my local web2py path: http://127.0.0.1:8000/ES1/default/URL/http%3A//gov-ideas.com thanks Alex Glaros -- 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 is represent syntax for external url?
/ironic mode on/ why of all names choosing just something that closely resemble some web2py function? are you asking for troubles?!?! /ironic mode off/ URL() in web2py is a function to create urls (usually related to web2py applications). If you have an url that is complete (such as http://www.gov-ideas.com/) you don't need to pass it to the URL function. tl;dr: use db.SuperObjectURL.URL.represent = lambda v, r: A(r.URL, _href=r.URL) On Monday, January 5, 2015 10:16:22 PM UTC+1, Alex Glaros wrote: What is controller represent syntax for creating a link to an external url? URL is the name of the field that contains the url ( http://www.gov-ideas.com/). When I use this: db.SuperObjectURL.URL.represent = lambda v, r: A(r.URL, _href=URL('URL', args=r.URL)) Instead of getting this: a href=http://www.gov-ideas.com/; Part of the link address includes my local web2py path: http://127.0.0.1:8000/ES1/default/URL/http%3A//gov-ideas.com thanks Alex Glaros -- 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.