[web2py] Re: session security issue?
I see this in 2.9.2 too (Just tested with the latest release) On Monday, March 3, 2014 1:25:14 PM UTC+5:30, Kiran Subbaraman wrote: Hello, I noticed this issue recently related to user session data. In my application I store some user specific session data, so that I do not have to hit the database everytime (now, am also looking at using the cache for that, instead of session). If userA is logged into the application, and then userA auth session expires, a login screen is presented. In case login is performed with userB's credentials, the session data from userA is still available, and is displayed on userB's screen. I have created a minimal app to demonstrate the issue that I see. Also take a look at the screenshots. Notice the session.userdata variable's value. Tested this on web2py 2.8.2, on Windows 8. This is my controller code: @auth.requires_login() def index(): ... if session['userdata'] is None: session.userdata = auth.user.first_name I am suspecting this is an issue / bug. Can anyone confirm? This issue does not arise, if the user explicitly logs out of a session, or the browser window is closed (I have set my browser to clear all cookies data when it is closed) -- Kiran Subbaraman http://subbaraman.wordpress.com/about/ -- 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/groups/opt_out.
[web2py] Best way to use a standalone DAL
I will actually call dal from within some scripts and from the webgui. What would be the best and cleanest way to do that ? -- 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/groups/opt_out.
[web2py] virtual field ordered on grid
hi, just wondering why the virtual field ordered on grid is not follow as defined in the models. e.g. *models/db.py* db.define_table('product', Field('name'), Field('beginning_cost', 'integer'), Field('beginning_quantity', 'integer'), Field.Virtual('beginning_inventory', lambda row: row.product.beginning_cost * row.product.beginning_quantity), Field('final_cost', 'integer'), Field('actual_quantity', 'integer'), Field.Virtual('actual_inventory', lambda row: row.product.final_cost * row.product.actual_quantity), format = '%(name)s') *controllers/default.py* def product(): fields = dict(product = [db.product.id,db.product.name, db.product.beginning_cost, db.product.beginning_quantity, db.product.beginning_inventory, db.product.final_cost, db.product.actual_quantity, db.product.actual_inventory], purchase_detail = None, sale_detail = None) grid = SQLFORM.smartgrid(db.product) #grid = SQLFORM.grid(db.product) return locals() in order to get the same order like on the define table, i must explicit tell it on the fields grid signature. is this normal or i did something wrong? 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/groups/opt_out.
[web2py] sqlform.grid - is there a way to set a column to certain value when entering new rows?
I have a grid and would like to show only rows where mytable.my_column == certain value form = SQLFORM.grid(db.my_table.my_column == my_value) and I would also like that every new row has the same predefined value. Is there a way to say to a grid that every new row should have my_value in my_table.my_colum? -- 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/groups/opt_out.
[web2py] Re: field inheritance
It works fine! Just one thing: label attribute seems to be precalculated when you define the field (sure this is the reason it has not been internationalized), so if you change the name, you'd probably want to change its label too: db.mytable.myfield.clone(name='newname', label='newlabel') Thanks! El viernes, 28 de febrero de 2014 15:32:09 UTC+1, Anthony escribió: db.mytable.myfield.clone(name='newname', ...) The .clone() method makes a copy of the Field object, and if you want to alter any of the attributes, they can be passed as keyword args (e.g., the above example changes the field name to newname). Anthony On Friday, February 28, 2014 4:04:59 AM UTC-5, mcamel wrote: Has field inheritance been implemented?. I'd swear it was, but i cannot find it... Now i use dummy tables for this, but i have to define different dummies to get different combinations of names and amount of fields of these types on each table. Regards. El miércoles, 24 de agosto de 2011 17:55:05 UTC+2, DenesL escribió: @ Andrew: thanks, yes that is the idea. @ Bruno: thank you, but I would like to be able to template also from existing tables (legacy mostly) not just from explicit template definitions, the sample function above does that I believe. -- 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/groups/opt_out.
[web2py] Re: sqlform.grid - is there a way to set a column to certain value when entering new rows?
just a suggestion, why not using default in table field constructor? e.g. db.define_table('person',Field('name',*default='name'*),format='%(name)s') ref: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-representation 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/groups/opt_out.
[web2py] Re: run web2y scheduler instances on 2 or more servers
Wow, what an answer! Niphlod, thanks a lot for such a detailed info with examples - now it is crystal clear for me. Very great help, really appreciate it!!! You answer make me clarify the future architecture for my app. Before I thought to use amazon internal tools for task distribution now I think I can use w2p scheduler at least for the first stage or maybe permanently. I have several additional question if you allow me. Hope it helps to other members of the w2p club. The plan is to start amazon servers (with web2py preinstalled) programmatically when I need it with the purpose to run w2p scheduler on it. Could you give me your point of your on the following questions that I need to address in order to build such a service: 1)Can I set up and cancel workers under web2py programmatically which equivalent to' python web2py.py -K myapp:fast,myapp:fast,myapp:fast'? 2) What is the best way to monitor load of the server to make a decision to start new worker or new server depends on the resources left? Looking forward to your answer. Thank you in advance. On Saturday, March 1, 2014 3:30:32 PM UTC+3, Niphlod wrote: On Friday, February 28, 2014 10:04:59 PM UTC+1, Andrey K wrote: Thank Niphlod for your answer. it is already great if it is possible even theoretically! it does even in the real world :-P Regarding implementation. Correct me please if I am wrong in following understanding - am I right that I need to: 1)copy the whole web2py and myapp with necessary libs to another server . 2)set up db connection in the 2nd box's web2py myapp to remote DB (first server) like: db= DAL('postgres://postgres:a...@196.xx.xx.xx/test', lazy_tables=False, migrate=True, fake_migrate=False) I'd say that migrate must be False here the original one is doing already the migrations. Also, after the scheduler tables have been created, use from gluon.scheduler import Scheduler mysched = Scheduler(db, migrate=False) 3) run web2py scheduler on the second box as: web2py.py -K appname exactly Is that all???It is sounds like magic How the second server job scheduler get understanding of calling task? exactly as the one in the original server. All needed informations are right on the scheduler_* tables, nothing else is required. If it works I wonder how to control what server (not worker) get next task - like what should I put in the model to force job be assigned to the the box I want? The workers will coordinate themselves and pick up a new task whenever it's ready to be processed. The whole point of the scheduler is having a task processed ASAP, no matter who processes it: the first available worker will do the job. Usually given that a task is queued and is ready to be processed, you don't even want to know who processes it, as long as it is processed: that's how scheduler works with default settings. That being said, if you want to send a specific task to a worker that exists only in a specific server, you can do so with group_name(s). The concept is having different group of tasks to be processed from schedulers being able to do so (i.e. one has all the libs, other one has only a few, or first one is more powerful, other one is less powerful, etc) You can then specify that a worker has to process only one group of tasks and the other one only another group of tasks. As specified in the book, the syntax to launch schedulers with one or more group_name is python web2py.py -K myapp:group1:group2,myotherapp:group1 in that case, you'd launch python web2py.py -K myapp:original on the original server and python web2py.py -K myapp:additional on the additional one. You can then queue tasks to be processed from the original box as mysched.queue_task(.., group_name='original') and tasks to be processed from the additional one as mysched.queue_task(.., group_name='additional') PS: all combinations of scheduler and group_names are allowedlet's say the additional box will need to help the original one too , then you'll have - 1 worker from the original box processing original - 1 worker from the additional box processing additional AND original then if you launch python web2py.py -K myapp:original on the first box and python web2py.py -K myapp:original:additional on the additional the workers will coordinate to let BOTH workers process tasks with original group_name and only the additional box to process tasks with the additional group. Another example (more complicated): you have a set of tasks that needs precedence (i.e. near real-time execution) and a set of tasks that can be executed with more relax, and 3 boxesyou can do some serious math :-P box1) python web2py.py -K myapp:fast,myapp:fast,myapp:fast box2) python web2py.py -K myapp:relax box3) python web2py.py -K myapp:fast,myapp:fast,myapp:fast:relax now you have fast) 3 workers from box1, 2.5
[web2py] Re: Date format and date picker
I'm not sure to understand your problem, but just in case it helps: have you tried to use this in your language file: '%Y-%m-%d': '%d/%m/%Y', Default date validator will do inner convertions between both formats, so you'll have no problems with DAL and database backend. Regards. El sábado, 1 de marzo de 2014 17:49:36 UTC+1, Gael Princivalle escribió: Hello all. I'm a little bit disappointed by the date format and datepicker. First my field was like that: Field('concert_date', type='date'), On Firefox no problem. It give me automaticly the possibility to put in the field the local %d/m/%Y format, and this format was accepted by the DAL. When I open this row, date is ok. As Firefox 27 for Windows is incredibly slow, I'm still using Chrome from this morning. With Chrome if I open again this row date it's ok but with the US format %Y-%m-%d. For example 12/03/2014 change in 2014-03-12. It's the default SQL Lite date format, why not. But if I open datepicker, it shows me on the calendar September 4 2017. What I want to do is: Choose with datepicker the date format always like %d/m/%Y. Saving the date in DAL as US format %Y-%m-%d Showing in the row the date format as local (%Y-%m-%d or %d/m/%Y) Can you help me ? Thanks, regards. -- 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/groups/opt_out.
[web2py] Re: SQLFORM.grid pagination and messed up URL
Anthony, Would you mind to make a patch to the manual to clarify this thing?. Actual explanation is quite obscure and i'm not sure to understand completely what it means: the args argument of the grid specifies which request.args should be passed along and ignored by the object Regards. El sábado, 1 de marzo de 2014 02:24:47 UTC+1, Anthony escribió: If the base URL for the grid includes args, you have to tell the grid to preserve those args when it generates its own URLs. For example: grid = SQLFORM.grid(..., args=request.args[:2]) Anthony On Friday, February 28, 2014 8:18:04 PM UTC-5, horridohobbyist wrote: I have a SQLFORM.grid with pagination. It's in a webpage with the following URL: https://mydomain.com/myapp/admin/view_client/auth_user/3 When you go to the next page of the grid, the URL becomes: https://mydomain.com/myapp/admin/view_client?page=2 However, this is patently wrong! The URL should preserve the two arguments (auth_user/3). By removing those two arguments, my app croaks. Is there a sensible workaround? -- 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/groups/opt_out.
[web2py] Re: sqlform.grid - is there a way to set a column to certain value when entering new rows?
It shouldn't always be the same value, but is based on a certain condition. If for instance user chooses to view rows where value is '1', then every new row inserted should also have the value of '1'. On Monday, March 3, 2014 12:29:08 PM UTC+1, 黄祥 wrote: just a suggestion, why not using default in table field constructor? e.g. db.define_table('person',Field('name',*default='name'*),format='%(name)s') ref: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-representation 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/groups/opt_out.
Re: [web2py] pg8000 driver that comes with web2py 2.8.2 is not supporting JSON field type?
I agree with Niphlod. I do not like packages that need to be installed to work and explicit relative imports is better than absolute imports. Yet, this is not the only package we had to tweak to include in contrib. So this may come up again. Any objection to include contrib in sys.path? On Sunday, 2 March 2014 18:29:45 UTC-6, Niphlod wrote: as long as you can use it without installing it in sys.path, then it's fine. If not, it can't be shipped with web2py, just supported as a module. I don't like packages that needs a complete install to work. It's true that we have venvs for quite some time now, but a module with less than 10 files can accomodate for relative imports quite finely without impairing the code-reader in everyone of us :P BTW, search for explicit relative imports in that doc :-P On Sunday, March 2, 2014 7:24:58 PM UTC+1, Tony Locke wrote: Hi, I'm a contributor to pg8000 and if there are any changes you need to get pg8000 working with web2py, let me know. Looking at the absolute import problem, PEP8 seems to think absolute imports are the way to go: http://legacy.python.org/dev/peps/pep-0008/http://www.google.com/url?q=http%3A%2F%2Flegacy.python.org%2Fdev%2Fpeps%2Fpep-0008%2Fsa=Dsntz=1usg=AFQjCNG8T4Krvic_V8TCmT4iog4T5e4pyg (search for 'relative' in the text) but I'm open to persuasion :-) Cheers, Tony. On Saturday, 1 March 2014 11:18:43 UTC, Joe Barnhart wrote: Hi Mariano -- I'd like to encourage you to keep making pg8000 a viable alternative for web2py. I started with it but had to change to psycopg2 because of some issues that postgres handled better under the psy driver. But I think pypy could be the future of python and it won't support a driver like psycopg2 -- but it could support pg8000 since it is all python. It's just good to have an alternative because no driver does it all. -- Joe B. On Tuesday, February 25, 2014 6:55:17 PM UTC-8, Mariano Reingart wrote: Hi Horst: Sadly there have been a lot of changes in pg8000, so it is not backward compatible with the current custom version in web2py. First, you need to delete the pg8000 folder in contrib, and put the new pg8000 folder (the one with __init__.py) directly in the web2py top level folder (at the same level as gluon). Note that the new pg8000 uses absolute imports that will not work if pg8000 is in contrib folder (or it should be added to the PYTHONPATH) Second, you need to apply the attached patch to gluon/dal.py to: * change the import (and add a missing __version__ attribute) * change connection to pass individual parameters (dsn string is not supported anymore) * change after_connection set_client_encoding to execute SQL * change server_version to _server_version I'll propose (again) to the pg8000 group the changes I've introduced for web2py, so the latest version could be used as a direct drop-in replacement for psycopg2 IIRC, at some stage the author gave me commit access, but I didn't have time to pull my changes and missed some discussions about the project internals. Best regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Tue, Feb 25, 2014 at 5:46 PM, Horst Horst spamf...@gmail.comwrote: I've tried the latest pg8000 as a drop-in replacement, but it seems web2py can't import it: type 'exceptions.RuntimeError' Failure to connect, tried 5 times: Traceback (most recent call last): File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 7766, in __init__ File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 2756, in __init__ File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 795, in find_driver RuntimeError: no driver available ('psycopg2', 'pg8000') I didn't step through it in the debugger, but the module's __init__.pyc got compiled, so I know web2py attempted an import. The latest pg8000/__init__.py contains a section which matches the former interface # For compatibility with 1.8 import pg8000 as dbapi DBAPI = dbapi pg8000_dbapi = DBAPI so I'd guess it's a minor problem, nonetheless I'm lost at this point. On Monday, February 24, 2014 9:32:05 PM UTC+1, Mariano Reingart wrote: You could try to update pg8000 from the official: https://github.com/mfenniak/pg8000 Let us know if that works, so we could update the one distributed with web2py The one currently distributed in contrib is an older version with custom patches (as it was not being mantained at the time it was included to web2py), but now the official site has updates that could help you in this case. Best regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Mon, Feb 24, 2014 at 10:18 AM, Horst Horst spamf...@gmail.comwrote: I'm getting a: class 'gluon.contrib.pg8000.errors.NotSupportedError' type oid 114 not mapped to py type I'm wondering what's the best
[web2py] Re: sqlform.grid - is there a way to set a column to certain value when entering new rows?
You can dynamically change the default value of a field at any time: db.my_table.my_column.default = 'my default' Anthony On Monday, March 3, 2014 8:07:57 AM UTC-5, Dragan Matic wrote: It shouldn't always be the same value, but is based on a certain condition. If for instance user chooses to view rows where value is '1', then every new row inserted should also have the value of '1'. On Monday, March 3, 2014 12:29:08 PM UTC+1, 黄祥 wrote: just a suggestion, why not using default in table field constructor? e.g. db.define_table('person',Field('name',*default='name'*),format='%(name)s') ref: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-representation 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/groups/opt_out.
[web2py] Re: session security issue?
I will check and release a patch soon. Please do not discuss possible security issues on this mailing list. Report them to the developers directly. On Monday, 3 March 2014 02:06:05 UTC-6, Kiran Subbaraman wrote: I see this in 2.9.2 too (Just tested with the latest release) On Monday, March 3, 2014 1:25:14 PM UTC+5:30, Kiran Subbaraman wrote: Hello, I noticed this issue recently related to user session data. In my application I store some user specific session data, so that I do not have to hit the database everytime (now, am also looking at using the cache for that, instead of session). If userA is logged into the application, and then userA auth session expires, a login screen is presented. In case login is performed with userB's credentials, the session data from userA is still available, and is displayed on userB's screen. I have created a minimal app to demonstrate the issue that I see. Also take a look at the screenshots. Notice the session.userdata variable's value. Tested this on web2py 2.8.2, on Windows 8. This is my controller code: @auth.requires_login() def index(): ... if session['userdata'] is None: session.userdata = auth.user.first_name I am suspecting this is an issue / bug. Can anyone confirm? This issue does not arise, if the user explicitly logs out of a session, or the browser window is closed (I have set my browser to clear all cookies data when it is closed) -- Kiran Subbaraman http://subbaraman.wordpress.com/about/ -- 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/groups/opt_out.
Re: [web2py] Re: session security issue?
Isn't this why session.renew() was added? On Mon, Mar 3, 2014 at 2:29 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I will check and release a patch soon. Please do not discuss possible security issues on this mailing list. Report them to the developers directly. On Monday, 3 March 2014 02:06:05 UTC-6, Kiran Subbaraman wrote: I see this in 2.9.2 too (Just tested with the latest release) On Monday, March 3, 2014 1:25:14 PM UTC+5:30, Kiran Subbaraman wrote: Hello, I noticed this issue recently related to user session data. In my application I store some user specific session data, so that I do not have to hit the database everytime (now, am also looking at using the cache for that, instead of session). If userA is logged into the application, and then userA auth session expires, a login screen is presented. In case login is performed with userB's credentials, the session data from userA is still available, and is displayed on userB's screen. I have created a minimal app to demonstrate the issue that I see. Also take a look at the screenshots. Notice the session.userdata variable's value. Tested this on web2py 2.8.2, on Windows 8. This is my controller code: @auth.requires_login() def index(): ... if session['userdata'] is None: session.userdata = auth.user.first_name I am suspecting this is an issue / bug. Can anyone confirm? This issue does not arise, if the user explicitly logs out of a session, or the browser window is closed (I have set my browser to clear all cookies data when it is closed) -- Kiran Subbaraman http://subbaraman.wordpress.com/about/ -- 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/groups/opt_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/groups/opt_out.
[web2py] Implementing search function in web2py
Disclaimer: I know this question has been asked a lot, and I am fairly new to programming. I have searched for some time in this forum and in the web on how to create a search option in the index page where people can search for a keyword appearing in the title or the body of a blog post that I created by following Massimo's video tutorial. I need some help here... I'll try to post my models, views and controllers code here. *Models:* db.define_table('blog_post', Field('title',requires=IS_NOT_EMPTY()), Field('body','text',requires=IS_NOT_EMPTY()), auth.signature) # auth.signature does all of the stuff below #Field('created_on','datetime'), #Field('created_by','reference auth_user'), #Field('modified_by','reference auth_user'), #Field('modified_on','datetime')) db.define_table('blog_comment', Field('blog_post','reference blog_post'), Field('body','text',requires=IS_NOT_EMPTY()), auth.signature) *Controller:* import web2py_utils def index(): if len(request.args): page=int(request.args[0]) else: page=0 items_per_page=6 limitby=(page*items_per_page,(page+1)*items_per_page+1) rows = db(db.blog_post).select(db.blog_post.ALL, orderby=~db.blog_post.created_on, limitby=limitby) return dict(rows=rows, page=page,items_per_page=items_per_page) #rows = db(db.blog_post).select(orderby=db.blog_post.title.upper()) #return locals() # # a controller for searching the post body # *View:* {{extend 'layout.html'}} !-- Code below has been commented out-- iSearch Posts/i !--form action= method=getinput name=keywords/input/form-- h2All Posts/h2 table Class=table {{for row in rows:}} table style=width:100% col width=100 col width=250 col width=25 col width=25 tr tda href={{=URL('show', args=row.id)}}{{=row.title}}/a/td td{{=row.body}}/td td{{=row.created_on}}/td td{{=row.created_by.first_name}} {{=row.created_by.last_name}}/td /tr {{pass}} /table Thanks in advance for your 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/groups/opt_out.
Re: [web2py] Re: session security issue?
This is a tricky issue. Consider the case of amazon.com, you can add stuff to cart before you login and after you login it remembers your cart. Even if it logs you out, you can still add items to your cart. In a sense that information leaks (although the term leak is not appropriate here) . web2py works the same. Logically there are two sessions. One is associated to the client (where you would store the cart) and one is associated to the user (contains user specific info). In web2py one is stored in session and one in session.auth. So anything that should be reset on logout should be stores in session.auth and stuff that should not be reset should be in session. Things have changed at one point and we decided that (unless specified otherwise in auth.settings.renew_onlogout) the entire session should be wiped out on logout. The problem is that if the user is automatically logged out, that happens before the flag auth.settings.renew_onlogout is set. We are investigating and will have a solution shortly. Massimo On Monday, 3 March 2014 08:26:09 UTC-6, Marin Pranjić wrote: Isn't this why session.renew() was added? On Mon, Mar 3, 2014 at 2:29 PM, Massimo Di Pierro massimo@gmail.comjavascript: wrote: I will check and release a patch soon. Please do not discuss possible security issues on this mailing list. Report them to the developers directly. On Monday, 3 March 2014 02:06:05 UTC-6, Kiran Subbaraman wrote: I see this in 2.9.2 too (Just tested with the latest release) On Monday, March 3, 2014 1:25:14 PM UTC+5:30, Kiran Subbaraman wrote: Hello, I noticed this issue recently related to user session data. In my application I store some user specific session data, so that I do not have to hit the database everytime (now, am also looking at using the cache for that, instead of session). If userA is logged into the application, and then userA auth session expires, a login screen is presented. In case login is performed with userB's credentials, the session data from userA is still available, and is displayed on userB's screen. I have created a minimal app to demonstrate the issue that I see. Also take a look at the screenshots. Notice the session.userdata variable's value. Tested this on web2py 2.8.2, on Windows 8. This is my controller code: @auth.requires_login() def index(): ... if session['userdata'] is None: session.userdata = auth.user.first_name I am suspecting this is an issue / bug. Can anyone confirm? This issue does not arise, if the user explicitly logs out of a session, or the browser window is closed (I have set my browser to clear all cookies data when it is closed) -- Kiran Subbaraman http://subbaraman.wordpress.com/about/ -- 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/groups/opt_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/groups/opt_out.
Re: [web2py] Re: session security issue?
There is a solution in trunk which consists of ignoring the user preferences (auth.settings.renew_onlogout) and always reset all session variables (not only those associated to the user) when the user is automatically logged out. I believe this is how most users expect this to work. I will post 2.9.3 as soon as other developers had a chance to review it. On Monday, 3 March 2014 08:35:40 UTC-6, Massimo Di Pierro wrote: This is a tricky issue. Consider the case of amazon.com, you can add stuff to cart before you login and after you login it remembers your cart. Even if it logs you out, you can still add items to your cart. In a sense that information leaks (although the term leak is not appropriate here) . web2py works the same. Logically there are two sessions. One is associated to the client (where you would store the cart) and one is associated to the user (contains user specific info). In web2py one is stored in session and one in session.auth. So anything that should be reset on logout should be stores in session.auth and stuff that should not be reset should be in session. Things have changed at one point and we decided that (unless specified otherwise in auth.settings.renew_onlogout) the entire session should be wiped out on logout. The problem is that if the user is automatically logged out, that happens before the flag auth.settings.renew_onlogout is set. We are investigating and will have a solution shortly. Massimo On Monday, 3 March 2014 08:26:09 UTC-6, Marin Pranjić wrote: Isn't this why session.renew() was added? On Mon, Mar 3, 2014 at 2:29 PM, Massimo Di Pierro massimo@gmail.comwrote: I will check and release a patch soon. Please do not discuss possible security issues on this mailing list. Report them to the developers directly. On Monday, 3 March 2014 02:06:05 UTC-6, Kiran Subbaraman wrote: I see this in 2.9.2 too (Just tested with the latest release) On Monday, March 3, 2014 1:25:14 PM UTC+5:30, Kiran Subbaraman wrote: Hello, I noticed this issue recently related to user session data. In my application I store some user specific session data, so that I do not have to hit the database everytime (now, am also looking at using the cache for that, instead of session). If userA is logged into the application, and then userA auth session expires, a login screen is presented. In case login is performed with userB's credentials, the session data from userA is still available, and is displayed on userB's screen. I have created a minimal app to demonstrate the issue that I see. Also take a look at the screenshots. Notice the session.userdata variable's value. Tested this on web2py 2.8.2, on Windows 8. This is my controller code: @auth.requires_login() def index(): ... if session['userdata'] is None: session.userdata = auth.user.first_name I am suspecting this is an issue / bug. Can anyone confirm? This issue does not arise, if the user explicitly logs out of a session, or the browser window is closed (I have set my browser to clear all cookies data when it is closed) -- Kiran Subbaraman http://subbaraman.wordpress.com/about/ -- 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. For more options, visit https://groups.google.com/groups/opt_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/groups/opt_out.
[web2py] web2py-mini-conference, May 4, 2014
We have a date, a location, and a web site: http://www.experts4solutions.com/web2py_conference Please register if you plan to attend. The more the merrier. We are looking for sponsors. 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/groups/opt_out.
[web2py] Re: Best way to use a standalone DAL
Have you checked this out? http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Using-DAL-without-define-tables -Jim On Monday, March 3, 2014 2:58:39 AM UTC-6, Gwayne aka Mike Veltman wrote: I will actually call dal from within some scripts and from the webgui. What would be the best and cleanest way to do that ? -- 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/groups/opt_out.
[web2py] Re: SQLFORM.grid pagination and messed up URL
OK, I've tried to clarify a bit. Anthony On Monday, March 3, 2014 7:31:42 AM UTC-5, mcamel wrote: Anthony, Would you mind to make a patch to the manual to clarify this thing?. Actual explanation is quite obscure and i'm not sure to understand completely what it means: the args argument of the grid specifies which request.args should be passed along and ignored by the object Regards. El sábado, 1 de marzo de 2014 02:24:47 UTC+1, Anthony escribió: If the base URL for the grid includes args, you have to tell the grid to preserve those args when it generates its own URLs. For example: grid = SQLFORM.grid(..., args=request.args[:2]) Anthony On Friday, February 28, 2014 8:18:04 PM UTC-5, horridohobbyist wrote: I have a SQLFORM.grid with pagination. It's in a webpage with the following URL: https://mydomain.com/myapp/admin/view_client/auth_user/3 When you go to the next page of the grid, the URL becomes: https://mydomain.com/myapp/admin/view_client?page=2 However, this is patently wrong! The URL should preserve the two arguments (auth_user/3). By removing those two arguments, my app croaks. Is there a sensible workaround? -- 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/groups/opt_out.
[web2py] Re: Best way to use a standalone DAL
In a script, you can just import it like any other Python module. Not sure what you mean by calling it from the webgui. Anthony On Monday, March 3, 2014 3:58:39 AM UTC-5, Gwayne aka Mike Veltman wrote: I will actually call dal from within some scripts and from the webgui. What would be the best and cleanest way to do that ? -- 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/groups/opt_out.
[web2py] using requests library ques
Hi, I need some help with implementing requests library. What I did: I have cloned the requests library to my app modules app. (didn't install anything) I tried these both options I found, one at a time: requests = local_import('requests') from modules import requests And in both cases I got: ImportError: No module named modules 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/groups/opt_out.
[web2py] Re: using requests library ques
Try just doing: import requests Anthony On Monday, March 3, 2014 11:15:33 AM UTC-5, Avi A wrote: Hi, I need some help with implementing requests library. What I did: I have cloned the requests library to my app modules app. (didn't install anything) I tried these both options I found, one at a time: requests = local_import('requests') from modules import requests And in both cases I got: ImportError: No module named modules 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/groups/opt_out.
[web2py] Re: using requests library ques
Lol, that works. thanks. On Monday, March 3, 2014 6:20:55 PM UTC+2, Anthony wrote: Try just doing: import requests Anthony On Monday, March 3, 2014 11:15:33 AM UTC-5, Avi A wrote: Hi, I need some help with implementing requests library. What I did: I have cloned the requests library to my app modules app. (didn't install anything) I tried these both options I found, one at a time: requests = local_import('requests') from modules import requests And in both cases I got: ImportError: No module named modules 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/groups/opt_out.
Re: [web2py] Re: session security issue?
This is now posted in web2py 2.9.3-stable On Monday, 3 March 2014 09:30:28 UTC-6, Massimo Di Pierro wrote: There is a solution in trunk which consists of ignoring the user preferences (auth.settings.renew_onlogout) and always reset all session variables (not only those associated to the user) when the user is automatically logged out. I believe this is how most users expect this to work. I will post 2.9.3 as soon as other developers had a chance to review it. On Monday, 3 March 2014 08:35:40 UTC-6, Massimo Di Pierro wrote: This is a tricky issue. Consider the case of amazon.com, you can add stuff to cart before you login and after you login it remembers your cart. Even if it logs you out, you can still add items to your cart. In a sense that information leaks (although the term leak is not appropriate here) . web2py works the same. Logically there are two sessions. One is associated to the client (where you would store the cart) and one is associated to the user (contains user specific info). In web2py one is stored in session and one in session.auth. So anything that should be reset on logout should be stores in session.auth and stuff that should not be reset should be in session. Things have changed at one point and we decided that (unless specified otherwise in auth.settings.renew_onlogout) the entire session should be wiped out on logout. The problem is that if the user is automatically logged out, that happens before the flag auth.settings.renew_onlogout is set. We are investigating and will have a solution shortly. Massimo On Monday, 3 March 2014 08:26:09 UTC-6, Marin Pranjić wrote: Isn't this why session.renew() was added? On Mon, Mar 3, 2014 at 2:29 PM, Massimo Di Pierro massimo@gmail.com wrote: I will check and release a patch soon. Please do not discuss possible security issues on this mailing list. Report them to the developers directly. On Monday, 3 March 2014 02:06:05 UTC-6, Kiran Subbaraman wrote: I see this in 2.9.2 too (Just tested with the latest release) On Monday, March 3, 2014 1:25:14 PM UTC+5:30, Kiran Subbaraman wrote: Hello, I noticed this issue recently related to user session data. In my application I store some user specific session data, so that I do not have to hit the database everytime (now, am also looking at using the cache for that, instead of session). If userA is logged into the application, and then userA auth session expires, a login screen is presented. In case login is performed with userB's credentials, the session data from userA is still available, and is displayed on userB's screen. I have created a minimal app to demonstrate the issue that I see. Also take a look at the screenshots. Notice the session.userdata variable's value. Tested this on web2py 2.8.2, on Windows 8. This is my controller code: @auth.requires_login() def index(): ... if session['userdata'] is None: session.userdata = auth.user.first_name I am suspecting this is an issue / bug. Can anyone confirm? This issue does not arise, if the user explicitly logs out of a session, or the browser window is closed (I have set my browser to clear all cookies data when it is closed) -- Kiran Subbaraman http://subbaraman.wordpress.com/about/ -- 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. For more options, visit https://groups.google.com/groups/opt_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/groups/opt_out.
Re: [web2py] web2py 2.9.2 is OUT
fixed in web2py 2.9.3 On Sunday, 2 March 2014 20:59:51 UTC-6, Ovidio Marinho wrote: Ops, Button Administrative interface ins welcome.w2p, not work!!! button id=w2padmin-btn class=btn btn-primary btn-lg btn-block i class=glyphicon glyphicon-cog/i {{=T(Administrative Interface)}}/button In the previous version is working well: {{block right_sidebar}} {{=A(T(Administrative Interface), _href=URL('admin','default','index'), _class='btn', _style='margin-top: 1em;')}} Missing Link?? Ovidio Marinho Falcao Neto ITJP.NET.BR ovid...@gmail.com javascript: itjp@gmail.com javascript: Brasil 2014-03-02 21:31 GMT-03:00 Massimo Di Pierro massimo@gmail.comjavascript: : web2py 2.9.2 is out! Changelog: - jquery 1.11 - codemirror 3.21, thanks Paolo Valleri - fixed a security issue with sessions in database - fixed security issue with redirect after expired login, thanks André Kablu - cleaner DAL and rname integration, thanks niphlod and Michele - added mongodb and imap tests for dal, thanks Alan - NoSQL dal tests, thanks Alan - better docstrings, thanks Niphlod - allow URL(...,language=...) with parametric router, thanks Jonathan - allow non-expiration of gae-memcache, thanks crimsoncantab - MARKMIN(...,_class='...'), thanks Luca - better transliteration in building slugs - autolink emails - new Janrain API, thanks PeterQ2 - enable admin app for GAE (experimental), thanks Alan - many bug fixes - invalidate function in web2py.js, thanks Paolo - DAL(...,adapter_args=dict(engine='MyISAM')) - todolist panel in admin editor, thanks Paolo Valleri - enable killing processed in windows, thanks Yair Thanks to all those who have contributed! 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+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_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/groups/opt_out.
[web2py] web2py 2.9.3 is OUT - INPORTANT SECURITY WARNING
web2py 2.9.3 is OUT. As you can see from the changelog we fixed three issues with security of sessions. One of those issues is pretty serious (if you use sessions in DB). So, if you use sessions in DB (or GAE) you should upgrade immediately. Changelog: - jquery 1.11 - codemirror 3.21, thanks Paolo Valleri - fixed security issue with sessions in database, thanks Nathan Humphreys - fixed security issue with persistant data in session, thanks Kiran - fixed security issue with redirect after expired login, thanks André Kablu - cleaner DAL and rname integration, thanks niphlod and Michele - added mongodb and imap tests for dal, thanks Alan - NoSQL dal tests, thanks Alan - better docstrings, thanks Niphlod - allow URL(...,language=...) with parametric router, thanks Jonathan - allow non-expiration of gae-memcache, thanks crimsoncantab - MARKMIN(...,_class='...'), thanks Luca - better transliteration in building slugs - autolink emails - new Janrain API, thanks PeterQ2 - enable admin app for GAE (experimental), thanks Alan - many bug fixes - invalidate function in web2py.js, thanks Paolo - DAL(...,adapter_args=dict(engine='MyISAM')) - todolist panel in admin editor, thanks Paolo Valleri - enable killing processed in windows, thanks Yair -- 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/groups/opt_out.
[web2py] ticket2db is not working
Hello, according to the documentation, I am trying to upload the error tickets in my database (MySQL) with this script: nohup python web2py.py -S myapp -M -R scripts/tickets2db.py But I always obtain this error: Created by Massimo Di Pierro, Copyright 2007-2014 Version 2.8.2-stable+timestamp.2013.11.28.07.51.37 Database drivers available: SQLite(sqlite3), MySQL(pymysql), MySQL(MySQLdb), PostgreSQL(pg8000), IMAP(imaplib) Traceback (most recent call last): File /srv/http/batisense/gluon/shell.py, line 266, in run execfile(startfile, _env) File scripts/tickets2db.py, line 27, in module db=tk_db, tablename=ts.tablename, app=request.application) File /srv/http/batisense/gluon/restricted.py, line 88, in _get_table db.Field('created_datetime', 'datetime')) File /srv/http/batisense/gluon/dal.py, line 8139, in define_table table = self.lazy_define_table(tablename,*fields,**args) File /srv/http/batisense/gluon/dal.py, line 8176, in lazy_define_table polymodel=polymodel) File /srv/http/batisense/gluon/dal.py, line 1058, in create_table self.create_sequence_and_triggers(query,table) File /srv/http/batisense/gluon/dal.py, line 1899, in create_sequence_and_triggers self.execute(query) File /srv/http/batisense/gluon/dal.py, line 1916, in execute return self.log_execute(*a, **b) File /srv/http/batisense/gluon/dal.py, line 1910, in log_execute ret = self.cursor.execute(command, *a[1:], **b) File /usr/lib/python2.7/dist-packages/MySQLdb/cursors.py, line 174, in execute self.errorhandler(self, exc, value) File /usr/lib/python2.7/dist-packages/MySQLdb/connections.py, line 36, in defaulterrorhandler raise errorclass, errorvalue OperationalError: (1050, Table 'web2py_ticket_api' already exists) I can modify it with fake_migrate or migrate_enabled in the DAL, but I thought that script should run fine out of the box. -- 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/groups/opt_out.
Re: [web2py] web2py-mini-conference, May 4, 2014
Cool, I wish I could attend. It'll be fun, I know. On 3 March 2014 16:36, Massimo Di Pierro massimo.dipie...@gmail.com wrote: We have a date, a location, and a web site: http://www.experts4solutions.com/web2py_conference Please register if you plan to attend. The more the merrier. We are looking for sponsors. 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/groups/opt_out. -- google.com/+ChukwudiNwachukwu -- 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/groups/opt_out.
[web2py] Re: web2py-mini-conference, May 4, 2014
Pizza...Pasta...Desserts. Is that the menu, or just subliminal messaging? ;-) On Monday, March 3, 2014 10:36:29 AM UTC-5, Massimo Di Pierro wrote: We have a date, a location, and a web site: http://www.experts4solutions.com/web2py_conference Please register if you plan to attend. The more the merrier. We are looking for sponsors. 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/groups/opt_out.
[web2py] Re: sqlform.grid - is there a way to set a column to certain value when entering new rows?
I did not know that. Thanks. On Monday, March 3, 2014 2:24:49 PM UTC+1, Anthony wrote: You can dynamically change the default value of a field at any time: db.my_table.my_column.default = 'my default' Anthony On Monday, March 3, 2014 8:07:57 AM UTC-5, Dragan Matic wrote: It shouldn't always be the same value, but is based on a certain condition. If for instance user chooses to view rows where value is '1', then every new row inserted should also have the value of '1'. On Monday, March 3, 2014 12:29:08 PM UTC+1, 黄祥 wrote: just a suggestion, why not using default in table field constructor? e.g. db.define_table('person',Field('name',*default='name'*),format='%(name)s') ref: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-representation 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/groups/opt_out.
[web2py] Re: web2py-mini-conference, May 4, 2014
Subliminal messages. Now they are gone. Or perhaps there are more somewhere else. On Monday, 3 March 2014 11:00:01 UTC-6, Anthony wrote: Pizza...Pasta...Desserts. Is that the menu, or just subliminal messaging? ;-) On Monday, March 3, 2014 10:36:29 AM UTC-5, Massimo Di Pierro wrote: We have a date, a location, and a web site: http://www.experts4solutions.com/web2py_conference Please register if you plan to attend. The more the merrier. We are looking for sponsors. 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/groups/opt_out.
[web2py] Re: web2py 2.9.3 is OUT - INPORTANT SECURITY WARNING
can't start web2py windows binary on new version. the command prompt is appear and suddenly gone, and i can't access the web2py admin interface too. 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/groups/opt_out.
Re: [web2py] help with jsonrpc
On Saturday, March 1, 2014 4:34:42 PM UTC-8, Trevor Overman wrote: Finally got things working. For anyone out there reading this, I fixed the problem by utilizing urlfetch in GAE. Works with curl, or works with your Android app? In either case, thanks for the update! /dps @service.jsonrpc def test_add(a,b): number_sum = a+b db.testing.insert(number_sum=number_sum) return a+b def test(): from gluon.contrib.simplejsonrpc import ServerProxy from google.appengine.api import urlfetch URL = http://www.conex.us/conexus/default/call/jsonrpc; urlfetch.set_default_fetch_deadline(60) service = ServerProxy(URL, verbose=True) test = service.test_add(1, 2) return test Anyway, thanks for the 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/groups/opt_out.
[web2py] virtual field ordered on grid
Virtual fields are placed after real fields by default on the grids because they are not sortable (can't click on the field names at the top of the grid to sort) -- 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/groups/opt_out.
[web2py] MySQL and OperationalError: (2006, 'MySQL server has gone away')
Hello, I have a low volume application running on a shared host. All seems ok except I am getting a lot - 260 in a week - of OperationalError's like this: Traceback (most recent call last): File /home/tgaa/web2py/gluon/main.py, line 543, in wsgibase BaseAdapter.close_all_instances('rollback') File /home/tgaa/web2py/gluon/dal.py, line 599, in close_all_instances db._adapter.close(action) File /home/tgaa/web2py/gluon/dal.py, line 579, in close getattr(self, action)() File /home/tgaa/web2py/gluon/dal.py, line 1872, in rollback return self.connection.rollback() OperationalError: (2006, 'MySQL server has gone away') I'm using the default pymysql with a connection pool of 0, because when I ran with a connection pool of 5 I was getting hundreds of these errors per day. I thought with a connection pool of 0, web2py would attempt to make a new connection each time. I know that the ISP has set the wait_timeout value in MySQL to 45 seconds, but I am getting the ticket much more quickly than that. I have tried to wrap my DB call in a try: except: OperationalError block to at least try to catch the error and put out something sensible when the database isn't there, but that doesn't work. My questions are: - how do I investigate why web2py is losing its database connection - what can I do when that happens to protect the user from the error ticket. Thanks for any assistance. -- 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/groups/opt_out.
[web2py] Re: Bootstrap3 package - help to test
Just set it up on my system. Found that the web2py logo was not showing up correctly in the corner. It had wrong top padding and a blue instead of white color when loading the default page. To fix this problem - you can go to the models/menu.py, and change the following from: response.logo = A(B('web',SPAN(2),'py'),XML('trade;nbsp;'), _class=brand,_href=http://www.web2py.com/;) to this: response.logo = A(B('web',SPAN(2),'py'),XML('trade;nbsp;'), _class=navbar-brand,_href=http://www.web2py.com/;) -- 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/groups/opt_out.
[web2py] Re: ticket2db is not working
do you have .table files inside the databases/ folder ? On Monday, March 3, 2014 5:27:10 PM UTC+1, Rémy Reche wrote: Hello, according to the documentation, I am trying to upload the error tickets in my database (MySQL) with this script: nohup python web2py.py -S myapp -M -R scripts/tickets2db.py But I always obtain this error: Created by Massimo Di Pierro, Copyright 2007-2014 Version 2.8.2-stable+timestamp.2013.11.28.07.51.37 Database drivers available: SQLite(sqlite3), MySQL(pymysql), MySQL(MySQLdb), PostgreSQL(pg8000), IMAP(imaplib) Traceback (most recent call last): File /srv/http/batisense/gluon/shell.py, line 266, in run execfile(startfile, _env) File scripts/tickets2db.py, line 27, in module db=tk_db, tablename=ts.tablename, app=request.application) File /srv/http/batisense/gluon/restricted.py, line 88, in _get_table db.Field('created_datetime', 'datetime')) File /srv/http/batisense/gluon/dal.py, line 8139, in define_table table = self.lazy_define_table(tablename,*fields,**args) File /srv/http/batisense/gluon/dal.py, line 8176, in lazy_define_table polymodel=polymodel) File /srv/http/batisense/gluon/dal.py, line 1058, in create_table self.create_sequence_and_triggers(query,table) File /srv/http/batisense/gluon/dal.py, line 1899, in create_sequence_and_triggers self.execute(query) File /srv/http/batisense/gluon/dal.py, line 1916, in execute return self.log_execute(*a, **b) File /srv/http/batisense/gluon/dal.py, line 1910, in log_execute ret = self.cursor.execute(command, *a[1:], **b) File /usr/lib/python2.7/dist-packages/MySQLdb/cursors.py, line 174, in execute self.errorhandler(self, exc, value) File /usr/lib/python2.7/dist-packages/MySQLdb/connections.py, line 36, in defaulterrorhandler raise errorclass, errorvalue OperationalError: (1050, Table 'web2py_ticket_api' already exists) I can modify it with fake_migrate or migrate_enabled in the DAL, but I thought that script should run fine out of the box. -- 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/groups/opt_out.
Re: [web2py] pg8000 driver that comes with web2py 2.8.2 is not supporting JSON field type?
just be sure that the same sys.path is then in scheduler, shell, tests, and so on ^_^ BTW: from gluon.contrib import something should be the recommended way to import something from contrib let's not forget all the hassle we've been into dealing with from gluon import module vs import module and be smart about it ^___^ BTW2: Isn't including contrib in sys.path just the same thing as shipping pg8000 and all the nifty importers in site-packages ?!?!? On Monday, March 3, 2014 2:23:59 PM UTC+1, Massimo Di Pierro wrote: I agree with Niphlod. I do not like packages that need to be installed to work and explicit relative imports is better than absolute imports. Yet, this is not the only package we had to tweak to include in contrib. So this may come up again. Any objection to include contrib in sys.path? On Sunday, 2 March 2014 18:29:45 UTC-6, Niphlod wrote: as long as you can use it without installing it in sys.path, then it's fine. If not, it can't be shipped with web2py, just supported as a module. I don't like packages that needs a complete install to work. It's true that we have venvs for quite some time now, but a module with less than 10 files can accomodate for relative imports quite finely without impairing the code-reader in everyone of us :P BTW, search for explicit relative imports in that doc :-P On Sunday, March 2, 2014 7:24:58 PM UTC+1, Tony Locke wrote: Hi, I'm a contributor to pg8000 and if there are any changes you need to get pg8000 working with web2py, let me know. Looking at the absolute import problem, PEP8 seems to think absolute imports are the way to go: http://legacy.python.org/dev/peps/pep-0008/http://www.google.com/url?q=http%3A%2F%2Flegacy.python.org%2Fdev%2Fpeps%2Fpep-0008%2Fsa=Dsntz=1usg=AFQjCNG8T4Krvic_V8TCmT4iog4T5e4pyg (search for 'relative' in the text) but I'm open to persuasion :-) Cheers, Tony. On Saturday, 1 March 2014 11:18:43 UTC, Joe Barnhart wrote: Hi Mariano -- I'd like to encourage you to keep making pg8000 a viable alternative for web2py. I started with it but had to change to psycopg2 because of some issues that postgres handled better under the psy driver. But I think pypy could be the future of python and it won't support a driver like psycopg2 -- but it could support pg8000 since it is all python. It's just good to have an alternative because no driver does it all. -- Joe B. On Tuesday, February 25, 2014 6:55:17 PM UTC-8, Mariano Reingart wrote: Hi Horst: Sadly there have been a lot of changes in pg8000, so it is not backward compatible with the current custom version in web2py. First, you need to delete the pg8000 folder in contrib, and put the new pg8000 folder (the one with __init__.py) directly in the web2py top level folder (at the same level as gluon). Note that the new pg8000 uses absolute imports that will not work if pg8000 is in contrib folder (or it should be added to the PYTHONPATH) Second, you need to apply the attached patch to gluon/dal.py to: * change the import (and add a missing __version__ attribute) * change connection to pass individual parameters (dsn string is not supported anymore) * change after_connection set_client_encoding to execute SQL * change server_version to _server_version I'll propose (again) to the pg8000 group the changes I've introduced for web2py, so the latest version could be used as a direct drop-in replacement for psycopg2 IIRC, at some stage the author gave me commit access, but I didn't have time to pull my changes and missed some discussions about the project internals. Best regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Tue, Feb 25, 2014 at 5:46 PM, Horst Horst spamf...@gmail.comwrote: I've tried the latest pg8000 as a drop-in replacement, but it seems web2py can't import it: type 'exceptions.RuntimeError' Failure to connect, tried 5 times: Traceback (most recent call last): File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 7766, in __init__ File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 2756, in __init__ File /Users/sfx/dev/mdb/web2py.app/Contents/Resources/gluon/dal.py, line 795, in find_driver RuntimeError: no driver available ('psycopg2', 'pg8000') I didn't step through it in the debugger, but the module's __init__.pyc got compiled, so I know web2py attempted an import. The latest pg8000/__init__.py contains a section which matches the former interface # For compatibility with 1.8 import pg8000 as dbapi DBAPI = dbapi pg8000_dbapi = DBAPI so I'd guess it's a minor problem, nonetheless I'm lost at this point. On Monday, February 24, 2014 9:32:05 PM UTC+1, Mariano Reingart wrote: You could try to update pg8000 from the official: https://github.com/mfenniak/pg8000 Let us know if that works, so we could update the one distributed with web2py The one
Re: [web2py] pg8000 driver that comes with web2py 2.8.2 is not supporting JSON field type?
Including contrib in sys.path would be interesting but there could be collisions (for example, in this case, witch pg8000 will be imported: the one installed or the one in gluon.contrib?) Tony: there are other changes needed for web2py (see the diff for web2py DAL I've attached earlier), the most important are: * missing __version__ attribute (now it is on setup.py, web2py need it to differentiate drivers capabilities) * connect doesn't suppor dsn string anymore (you need to pass keyword parameters) * set_client_encoding is not present anymore (you need to execute SQL SET ...) * server_version attribute has a leading underscore (_server_version), this is need to detect server capabilities like JSON Also, for the pg8000 driver currently in web2py, I'd applied many bugfixes reported in github / launchpad for the original project (mainly data types, unicode, importing, etc.) Also, I'd improved the psycopg2 compatibility (i.e. set_client_encoding, autocommit, set_isolation_level), implementing the simple query protocol (the one that uses psycopg2, and to avoid overhead of non-prepared statements) and two-phase commit support. The last would be important for web2py distributed_transaction_commit, but currently gluon.dal is sending raw SQL PREPARE TRANSACTION / COMMIT PREPARED / ROLLBACK PREPARED without using dbapi proposed methods TPC Connection Methods (tpc_begin, tpc_prepare, tpc_commit, tpc_rollback, tpc_recover) You can see the detail of the changes applied to the web2py contrib pg8000 here: https://code.google.com/p/pg8000/source/list https://github.com/reingart/pg8000/commits/master If this kind of changes could be accepted (psycopg2 compatibility, simple query protocol, dbapi 2.0 two-pass commit, etc.), I could help to make the pull requests (note that some could depend on each other). Sorry I couldn't keep track of pg8000 due lack of time, so I don't know what direction the project has taken. Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Mon, Mar 3, 2014 at 10:23 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I agree with Niphlod. I do not like packages that need to be installed to work and explicit relative imports is better than absolute imports. Yet, this is not the only package we had to tweak to include in contrib. So this may come up again. Any objection to include contrib in sys.path? On Sunday, 2 March 2014 18:29:45 UTC-6, Niphlod wrote: as long as you can use it without installing it in sys.path, then it's fine. If not, it can't be shipped with web2py, just supported as a module. I don't like packages that needs a complete install to work. It's true that we have venvs for quite some time now, but a module with less than 10 files can accomodate for relative imports quite finely without impairing the code-reader in everyone of us :P BTW, search for explicit relative imports in that doc :-P On Sunday, March 2, 2014 7:24:58 PM UTC+1, Tony Locke wrote: Hi, I'm a contributor to pg8000 and if there are any changes you need to get pg8000 working with web2py, let me know. Looking at the absolute import problem, PEP8 seems to think absolute imports are the way to go: http://legacy.python.org/dev/peps/pep-0008/http://www.google.com/url?q=http%3A%2F%2Flegacy.python.org%2Fdev%2Fpeps%2Fpep-0008%2Fsa=Dsntz=1usg=AFQjCNG8T4Krvic_V8TCmT4iog4T5e4pyg (search for 'relative' in the text) but I'm open to persuasion :-) Cheers, Tony. On Saturday, 1 March 2014 11:18:43 UTC, Joe Barnhart wrote: Hi Mariano -- I'd like to encourage you to keep making pg8000 a viable alternative for web2py. I started with it but had to change to psycopg2 because of some issues that postgres handled better under the psy driver. But I think pypy could be the future of python and it won't support a driver like psycopg2 -- but it could support pg8000 since it is all python. It's just good to have an alternative because no driver does it all. -- Joe B. On Tuesday, February 25, 2014 6:55:17 PM UTC-8, Mariano Reingart wrote: Hi Horst: Sadly there have been a lot of changes in pg8000, so it is not backward compatible with the current custom version in web2py. First, you need to delete the pg8000 folder in contrib, and put the new pg8000 folder (the one with __init__.py) directly in the web2py top level folder (at the same level as gluon). Note that the new pg8000 uses absolute imports that will not work if pg8000 is in contrib folder (or it should be added to the PYTHONPATH) Second, you need to apply the attached patch to gluon/dal.py to: * change the import (and add a missing __version__ attribute) * change connection to pass individual parameters (dsn string is not supported anymore) * change after_connection set_client_encoding to execute SQL * change server_version to _server_version I'll propose (again) to the pg8000 group the changes I've introduced for web2py, so the latest version could be
[web2py] Re: run web2y scheduler instances on 2 or more servers
On Monday, March 3, 2014 1:10:08 PM UTC+1, Andrey K wrote: Wow, what an answer! Niphlod, thanks a lot for such a detailed info with examples - now it is crystal clear for me. Very great help, really appreciate it!!! You answer make me clarify the future architecture for my app. Before I thought to use amazon internal tools for task distribution now I think I can use w2p scheduler at least for the first stage or maybe permanently. I have several additional question if you allow me. Hope it helps to other members of the w2p club. The plan is to start amazon servers (with web2py preinstalled) programmatically when I need it with the purpose to run w2p scheduler on it. Could you give me your point of your on the following questions that I need to address in order to build such a service: 1)Can I set up and cancel workers under web2py programmatically which equivalent to' python web2py.py -K myapp:fast,myapp:fast,myapp:fast'? you can put them to sleep, terminate or kill them (read the book or use w2p_scheduler_tests to get comfortable with the terms) but there's no included way to start them on demand. That job is left to various pieces of software that are built from the ground-up to manage external processesupstart, systemd, circus, gaffer, supervisord, foreman, etc are all good matches but each one with a particular design in mind and totally outside the scope of web2py. Coordinating processes among a set of servers just needs a more complicated solution than web2py itself. 2) What is the best way to monitor load of the server to make a decision to start new worker or new server depends on the resources left? depends of what you mean by load. Just looking at your question, I see that you never had to manage such architecture :-P..usually you don't want to monitor the load of the server to ADD additional workers... you want to monitor the load of the server to KILL additional workers or ADD servers to process the jobs, watching at the load of the infrastructure. Again usually - because basically every app has its own priorities - you'd want to set an estimate (KPI) on how much the queue can grow before jobs are actually processed, and if the queue is growing faster than the processed items, start either a new worker or a new virtual machine. 3)Is it possible to set up folder on dedicated server for web2py file upload and make it accessible to all web2py instances = job workers linux has all kinds of support for that: either an smb share or an nfs share is the simplest thing to do. a Ceph cluster is probably more complicated, but again we're outside of the scope of web2py -- 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/groups/opt_out.
[web2py] Re: virtual field ordered on grid
yes, got it, but the virtual field is not in correct order yet. like in example above the result i got from the grid is (bold are virtual field) : id | name | beginning_cost | beginning_quantity | final_cost | actual_quantity | *actual_inventory *| *beginning_inventory* my expectation is (because i define virtual field *beginning_inventory *first and then *actual_inventory*): id | name | beginning_cost | beginning_quantity | final_cost | actual_quantity | *beginning_inventory *| *actual_inventory* 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/groups/opt_out.
Re: [web2py] pg8000 driver that comes with web2py 2.8.2 is not supporting JSON field type?
On Monday, 3 March 2014 14:26:15 UTC-6, Mariano Reingart wrote: Including contrib in sys.path would be interesting but there could be collisions (for example, in this case, witch pg8000 will be imported: the one installed or the one in gluon.contrib?) That depends on the order in sys.path. We always put gluon first. gluon.contrib could be second. Anyway, I agree that unless your other issues are addressed we will stick with your fork. Massimo Tony: there are other changes needed for web2py (see the diff for web2py DAL I've attached earlier), the most important are: * missing __version__ attribute (now it is on setup.py, web2py need it to differentiate drivers capabilities) * connect doesn't suppor dsn string anymore (you need to pass keyword parameters) * set_client_encoding is not present anymore (you need to execute SQL SET ...) * server_version attribute has a leading underscore (_server_version), this is need to detect server capabilities like JSON Also, for the pg8000 driver currently in web2py, I'd applied many bugfixes reported in github / launchpad for the original project (mainly data types, unicode, importing, etc.) Also, I'd improved the psycopg2 compatibility (i.e. set_client_encoding, autocommit, set_isolation_level), implementing the simple query protocol (the one that uses psycopg2, and to avoid overhead of non-prepared statements) and two-phase commit support. The last would be important for web2py distributed_transaction_commit, but currently gluon.dal is sending raw SQL PREPARE TRANSACTION / COMMIT PREPARED / ROLLBACK PREPARED without using dbapi proposed methods TPC Connection Methods (tpc_begin, tpc_prepare, tpc_commit, tpc_rollback, tpc_recover) You can see the detail of the changes applied to the web2py contrib pg8000 here: https://code.google.com/p/pg8000/source/list https://github.com/reingart/pg8000/commits/master If this kind of changes could be accepted (psycopg2 compatibility, simple query protocol, dbapi 2.0 two-pass commit, etc.), I could help to make the pull requests (note that some could depend on each other). Sorry I couldn't keep track of pg8000 due lack of time, so I don't know what direction the project has taken. Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Mon, Mar 3, 2014 at 10:23 AM, Massimo Di Pierro massimo@gmail.comjavascript: wrote: I agree with Niphlod. I do not like packages that need to be installed to work and explicit relative imports is better than absolute imports. Yet, this is not the only package we had to tweak to include in contrib. So this may come up again. Any objection to include contrib in sys.path? On Sunday, 2 March 2014 18:29:45 UTC-6, Niphlod wrote: as long as you can use it without installing it in sys.path, then it's fine. If not, it can't be shipped with web2py, just supported as a module. I don't like packages that needs a complete install to work. It's true that we have venvs for quite some time now, but a module with less than 10 files can accomodate for relative imports quite finely without impairing the code-reader in everyone of us :P BTW, search for explicit relative imports in that doc :-P On Sunday, March 2, 2014 7:24:58 PM UTC+1, Tony Locke wrote: Hi, I'm a contributor to pg8000 and if there are any changes you need to get pg8000 working with web2py, let me know. Looking at the absolute import problem, PEP8 seems to think absolute imports are the way to go: http://legacy.python.org/dev/peps/pep-0008/http://www.google.com/url?q=http%3A%2F%2Flegacy.python.org%2Fdev%2Fpeps%2Fpep-0008%2Fsa=Dsntz=1usg=AFQjCNG8T4Krvic_V8TCmT4iog4T5e4pyg (search for 'relative' in the text) but I'm open to persuasion :-) Cheers, Tony. On Saturday, 1 March 2014 11:18:43 UTC, Joe Barnhart wrote: Hi Mariano -- I'd like to encourage you to keep making pg8000 a viable alternative for web2py. I started with it but had to change to psycopg2 because of some issues that postgres handled better under the psy driver. But I think pypy could be the future of python and it won't support a driver like psycopg2 -- but it could support pg8000 since it is all python. It's just good to have an alternative because no driver does it all. -- Joe B. On Tuesday, February 25, 2014 6:55:17 PM UTC-8, Mariano Reingart wrote: Hi Horst: Sadly there have been a lot of changes in pg8000, so it is not backward compatible with the current custom version in web2py. First, you need to delete the pg8000 folder in contrib, and put the new pg8000 folder (the one with __init__.py) directly in the web2py top level folder (at the same level as gluon). Note that the new pg8000 uses absolute imports that will not work if pg8000 is in contrib folder (or it should be added to the PYTHONPATH) Second, you need to apply the attached patch to gluon/dal.py to: * change the
[web2py] Re: virtual field ordered on grid
I don't think the table stores information about the order of definition of virtual fields, so they will probably be displayed in arbitrary order unless you provide the fields argument. Anthony On Monday, March 3, 2014 3:42:59 PM UTC-5, 黄祥 wrote: yes, got it, but the virtual field is not in correct order yet. like in example above the result i got from the grid is (bold are virtual field) : id | name | beginning_cost | beginning_quantity | final_cost | actual_quantity | *actual_inventory *| *beginning_inventory* my expectation is (because i define virtual field *beginning_inventory *first and then *actual_inventory*): id | name | beginning_cost | beginning_quantity | final_cost | actual_quantity | *beginning_inventory *| *actual_inventory* 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/groups/opt_out.
[web2py] Re: current trunk using memdb results in crash
This error persists in the current stable version 2.9.3: If you want to reproduce it just uncomment the three memcache session lines: from gluon.contrib.memdb import MEMDB from google.appengine.api.memcache import Client session.connect(request, response, db = MEMDB(Client())) and the whole application will crash: TypeError: __call__() got an unexpected keyword argument 'unique_key' -- 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/groups/opt_out.
[web2py] Re: current trunk using memdb results in crash
Its worse. If the memcache lines are commented out and the alternative line to connect and put tickets and sessions in the database, it still fails with both GAE SDK and production, this time with error ProtocolBufferEncodeError: int64 too big when executing session.connect(request, response, db=db) So 2.9.3 wont work with GAE at all! On Monday, March 3, 2014 5:01:34 PM UTC-5, Sebastian Cambeo wrote: This error persists in the current stable version 2.9.3: If you want to reproduce it just take the welcome app and uncomment the three memcache session lines: from gluon.contrib.memdb import MEMDB from google.appengine.api.memcache import Client session.connect(request, response, db = MEMDB(Client())) and the whole application will crash: TypeError: __call__() got an unexpected keyword argument 'unique_key' -- 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/groups/opt_out.
Re: [web2py] Re: session security issue?
Massimo, Point noted; will henceforth report to dev-list, if I come across such issues. Thanks for fixing this one. Kiran Subbaraman http://subbaraman.wordpress.com/about/ On Mon, 03-03-2014 6:59 PM, Massimo Di Pierro wrote: I will check and release a patch soon. Please do not discuss possible security issues on this mailing list. Report them to the developers directly. On Monday, 3 March 2014 02:06:05 UTC-6, Kiran Subbaraman wrote: I see this in 2.9.2 too (Just tested with the latest release) On Monday, March 3, 2014 1:25:14 PM UTC+5:30, Kiran Subbaraman wrote: Hello, I noticed this issue recently related to user session data. In my application I store some user specific session data, so that I do not have to hit the database everytime (now, am also looking at using the cache for that, instead of session). If userA is logged into the application, and then userA auth session expires, a login screen is presented. In case login is performed with userB's credentials, the session data from userA is still available, and is displayed on userB's screen. I have created a minimal app to demonstrate the issue that I see. Also take a look at the screenshots. Notice the session.userdata variable's value. Tested this on web2py 2.8.2, on Windows 8. This is my controller code: @auth.requires_login() def index(): ... if session['userdata'] is None: session.userdata = auth.user.first_name I am suspecting this is an issue / bug. Can anyone confirm? This issue does not arise, if the user explicitly logs out of a session, or the browser window is closed (I have set my browser to clear all cookies data when it is closed) -- Kiran Subbaraman http://subbaraman.wordpress.com/about/ http://subbaraman.wordpress.com/about/ -- 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/groups/opt_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/groups/opt_out.
[web2py] Web2Py and custom modules (strange behavior and ValueError)
Hi everyone, I'm trying to work with modules in Web2Py to define my objects/classes. First i used to use the models folder for this so i don't have to restart my project over and over again. From a first point of view it's working and i can import my objects by adding an import statement to my controllers. However; I do get some strange behaviors: First of all; I added the: from gluon.custom_import import track_changes; track_changes(True) statement before importing my modules, but is still need to restart Web2Py for every change in development mode. I don't know what I'm doing wrong here? Second; after i submit a SQLFORM with data and store the data in the DB i normally do an automatic redirect to the index-page to show the inserted data. The problem that i have is that Web2Py crashes on a ValueError: type 'exceptions.ValueError' SELECT [...] When i execute the SQL-statement in my MySQL-client i do get the results that Web2Py should give me, so i don't know what is going wrong... Now i have to stop Web2Py, start it again and refresh the page in order to see my new data. I also get this ValueError on inserting data into the DB from a Modal posted via AJAX. When i turn on the debugger and watch the process step by step it just breaks on a very normal insert statement. The Exception gives me the following output: Error on inserting Overtime!: INSERT INTO overtime(startDate,employee_id, endDate,description) VALUES ('2014-03-02 00:00:00',114,'2014-03-21 00:00:00' ,'dfgfdfdgfdgfdg'); I can put this SQL-statement manually to the MySQL-client and insert the data without any problems. I'm wondering if I'm doing something wrong with using modules for my objects. Maybe i forgot something? I hope someone can help me out on this! I'm using the latest stable: 2.9.3-stable+timestamp.2014.03.03.16.38.00 ( http://www.web2py.com/init/default/downloadLGPLv3 Licensehttp://www.gnu.org/licenses/lgpl.html ) Thanks in advance! Remco -- 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/groups/opt_out.
[web2py] Re: Web2Py and custom modules (strange behavior and ValueError)
from gluon.custom_import import track_changes; track_changes(True) statement before importing my modules, but is still need to restart Web2Py for every change in development mode. I don't know what I'm doing wrong here? This is reportedly not working any more, though hasn't been investigated or fixed yet. As for the rest, it's hard to say without seeing some code. Anthony -- 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/groups/opt_out.
Re: [web2py] Re: session security issue?
On Monday, March 3, 2014 6:41:52 PM UTC-5, Kiran Subbaraman wrote: Massimo, Point noted; will henceforth report to dev-list, if I come across such issues. Better to email Massimo or another dev directly rather than post on any public list. Thanks. Anthony -- 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/groups/opt_out.
Re: [web2py] Re: session security issue?
Thanks Anthony. Will bear that in mind. Kiran Subbaraman http://subbaraman.wordpress.com/about/ On Tue, 04-03-2014 6:34 AM, Anthony wrote: On Monday, March 3, 2014 6:41:52 PM UTC-5, Kiran Subbaraman wrote: Massimo, Point noted; will henceforth report to dev-list, if I come across such issues. Better to email Massimo or another dev directly rather than post on any public list. Thanks. Anthony -- 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/groups/opt_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/groups/opt_out.
[web2py] auth.define_tables(...signature=False): what is signature?
Hi. What does the signature parameter do in auth.define_tables? -- 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/groups/opt_out.
[web2py] Re: Best way to use a standalone DAL
O well the situation is as follows, I have a database and created a web2py webinterface with it. But I also have create some commandline tools that reverence the database. So I wondered if there was a easy way to include dal in the scripts and talk to the database. So webgui is the webinterface of the deployment application. Jim I want to use the database so I guess I need the define tables I tried to to it as explained in the ebook but I got a error (with mongodb) Btw is the path_to_application_databases relative to web2py path or absolute ? On Tuesday, 4 March 2014 00:03:10 UTC+8, Anthony wrote: In a script, you can just import it like any other Python module. Not sure what you mean by calling it from the webgui. Anthony On Monday, March 3, 2014 3:58:39 AM UTC-5, Gwayne aka Mike Veltman wrote: I will actually call dal from within some scripts and from the webgui. What would be the best and cleanest way to do that ? -- 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/groups/opt_out.
Re: [web2py] Re: Scheduler: new plugin cs_plugin_monitor
similar thing http://www.jetbrains.com/pycharm/webhelp/remote-debugging.html On Saturday, March 16, 2013 7:25:14 PM UTC+3, Niphlod wrote: a little offtopic but http://pydev.org/manual_adv_remote_debugger.html -- 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/groups/opt_out.
[web2py] Voting system without users.
I was thinking of a voting system without users, but I wanted to get your opinions on what would be the best practice with this. In melodigram.com I have grams that each have their one unique id's and urls. They will be voted on by anyone. I imagine something like this: gram_id = request.args(0) if session.__dict__[gram_id]: return dict(success = False) session.__dict__[gram_id] = True return dict(success = success) What do you think? Good idea? BR, Jason Brower -- 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/groups/opt_out.