[web2py] Re: uuid - Postgresql-type
You can start using a string with length 36. If you don't use functions on that column you can change the type in postgres to uuid and leave the model a string length=36 and still continue to use the DAL without problems.
[web2py] COL and COLGROUP
Hi, It is not possible to write something like TABLE(COL(...)). I think 'COL' and 'COLGROUP' are missing in variable __all__ at the beginning of gluon/html.py Regards, Martin
Re: [web2py] iconset
famfam and tango are the best open source icon set. I found this also: http://openiconlibrary.sourceforge.net/gallery2/?./Icons/actions 2011/8/24 Tito Garrido titogarr...@gmail.com http://www.famfamfam.com/lab/icons/silk/ famfamfam :-) free and nice! On Wed, Aug 24, 2011 at 10:24 PM, pbreit pbreitenb...@gmail.com wrote: I'm torn. JQuery UI is the obvious choice since we are using JQuery but I really dislike its aesthetics. -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- http://martin.tecnodoc.com.ar
[web2py] Re: Allowing provisional login with email only
Anthony, this is exactly the culture I am questionning. Why force everyone to register because a small number of people are concerned about someone else pretending to be them to see their choice in a cart (slightly paranoid I would say). They are welcome to have their concern, they can register. I guess I should have a message when asking for their email, saying that if they want full security then register or login. Peter On Aug 25, 2:13 am, pbreit pbreitenb...@gmail.com wrote: I was actually referring to the situation where in the future you link any prior orders to a newly created account based on email address. It sounded like you might have been considering that. But from a conservative info privacy standpoint, Anthony's concern might be an issue as well.
[web2py] web2py.fedora.sh
Hi, I found web2py.fedora.sh script have couple of problems in start() and stop(). So here's explanation and my solutions. If these fixes looks good, I can write a clean fix, test and send you a patch, could be tested only on RHEL6. (A) when calling daemon() shell-function, it is called as background. daemon() executes web2py.py as forground process inside of the function, and doesn't return until web2py.py terminates. So it shows [ OK ] (of startup) at termination! current call flow web2py.fedra.sh - daemon - web2py.py As far as I looked into the /etc/init.d/functions, the daemon() function expects the service (web2py.py in this case) to daemonize itself. So my solution would be: new call flow web2py.fedra.sh - daemon - web2py-daemon.sh # new script to invoke web2py.py in background - web2py.py Or add something like --daemon option to web2py.py. Or, perhaps little bit tricky sub-shell like 'bash -c ( web2py.py )' could be used...? (B) when stop()ing the web2py service, it sends TERM signal, but not wait for it's actual termination. Actually, there's killproc() shell function (counter part of daemon() function) Usage: killproc [-p pidfile] [ -d delay] {program} [-signal] diff -r 3f8ce51b069e start-stop-web2py --- a/start-stop-web2py Thu Aug 25 09:40:24 2011 +0900 +++ b/start-stop-web2py Thu Aug 25 10:26:11 2011 +0900 @@ -66,14 +66,7 @@ stop() { echo -n $Shutting down $DESC ($NAME): -if [ -r $PIDFILE ]; then -pid=`cat $PIDFILE` -kill -TERM $pid -RETVAL=$? -else -RETVAL=1 -fi -[ $RETVAL -eq 0 ] success || failure +killproc -p $PIDFILE -d 3 $NAME echo if [ $RETVAL -eq 0 ]; then is_production rm -f /var/lock/subsys/$NAME -- R.Kato
[web2py] Re: Memory problems on Webfaction
This is great Vasile! Will try it and report back. On Aug 24, 4:55 pm, Vasile Ermicioi elff...@gmail.com wrote: [web2py] wgethttp://www.web2py.com/examples/static/web2py_src.zip unzip web2py_src.zip python2.7 web2py.py #seems needed before using it [uwsgi] wgethttp://projects.unbit.it/downloads/uwsgi-0.9.8.3.tar.gz tar xvzf uwsgi-0.9.8.3.tar.gz cd uwsgi-0.9.8.3 /home/yourname/bin/python2.7 uwsgiconfig.py --build mv uwsgi /home/yourname/bin uwsgi --protocol=http --socket 127.0.0.1:your_custom_port_number --pythonpath /home/yourname/web2py --module wsgihandler -d /home/yourname/tmp/uwsgi.log -t 20 --async 24 --ugreen --limit-as 64 -r --no-orphans -M -p 1 --touch-reload /home/yourname/tmp/uwsgireload.txt --reload-on-rss 50 touch /home/yourname/tmp/uwsgireload.txt [utils] ps -u fermer -o rss,command notes/comments: - --protocol=http means that you don't need another webserver - it is still nginx + uwsgi because you have webfaction nginx instance in front - I use touch /home/yourname/tmp/uwsgireload.txt to reload uwsgi server, it is useful when I change routes.py file, or adding some modules in site-packages folder - -M -p 1 will generate 2 processes, a master process and a slave one an example of website powered by web2py+uwsgi+webfaction(nginx) ishttp://fermer.md/(hosted in Amsterdam) for Johann: you need to check uwsgi documentation to configure itself these paramaters --async 24 - number of green threads --ugreen --limit-as 64 - memory limit per process !!! -p 1 - number of processes, total memory that is allowed to be consumed is = number of processes * limit-as for Massimo: - Robert is working on uwsgi - pypy integration, please make web2py pypy compatible, - please add my website (fermer.md) to web2py powered websites and please add me to web2py professional website, or tell me what to do to achieve that thank you :)
[web2py] New 'represent' syntax
Please help me to understand how to use the new syntax. How do I have to change the following code to work? def rp(author): an = db(db.akb_reprint.uuid==author).select(db.akb_reprint.rp_author) if len(an): a_name = an.first()['rp_author'] else: a_name = 'No rp_author' return a_name db.akb_articles.rp_author.represent = lambda x,record: rp(x),record How do I define and use 'record' in this case? The ticket says: db.akb_articles.rp_author.represent = lambda x,record: rp(x),record NameError: name 'record' is not defined Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
Re: [web2py] Re: How to use SQLFORM.grid
On 24 August 2011 18:33, Massimo Di Pierro massimo.dipie...@gmail.comwrote: I think you want: def journal_grid(): query = db.akb_journal.publisher == db.akb_publisher.uuid fields = [db.akb_journal.title,db.akb_journal.standard_name, db.akb_journal.issn, db.akb_journal.abbrev_iso, db.akb_publisher.publisher, db.akb_journal.subject] form = SQLFORM.grid(query, fields, deletable= False) return dict(form = form) or def journal_grid(): form = SQLFORM.smartgrid(db.akb_journal, deletable= False) return dict(form = form) Thanks, but now I get another problem. And it does not help if I include the id field in the field list: File /home/js/web2py/applications/akb/controllers/default.py http://localhost:8000/admin/default/edit/akb/controllers/default.py, line 96, in journal_grid form = SQLFORM.grid(query, fields, deletable= False) File /home/js/web2py/gluon/sqlhtml.py, line 1480, in grid id = row[field_id] File /home/js/web2py/gluon/dal.py, line 3817, in __getitem__ return dict.__getitem__(self, key) KeyError: 'id' Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Re: Get rid of a label in web2py SQLFORM
Check trunk On Aug 25, 12:48 am, Jason Brower encomp...@gmail.com wrote: I have a label I want to get ride of but this doesn't work... Field('email', 'string', label=None), no this... Field('email', 'string', label=), Any other ideas? -- BR, Jason Brower
[web2py] Re: COL and COLGROUP
In trunk On Aug 25, 3:52 am, Martin Weissenboeck mweis...@gmail.com wrote: Hi, It is not possible to write something like TABLE(COL(...)). I think 'COL' and 'COLGROUP' are missing in variable __all__ at the beginning of gluon/html.py Regards, Martin
[web2py] Re: New 'represent' syntax
You just change this: def rp(author): an = db(db.akb_reprint.uuid==author).select(db.akb_reprint.rp_author) if len(an): a_name = an.first()['rp_author'] else: a_name = 'No rp_author' return a_name into this: def rp(author,record): an = db(db.akb_reprint.uuid==author).select(db.akb_reprint.rp_author) if len(an): a_name = an.first()['rp_author'] else: a_name = 'No rp_author' return a_name or def rp(author,record): row = db(db.akb_reprint.uuid==author).select(db.akb_reprint.rp_author).first() return row and row.rp_author or 'No author' and use it as db.akb_articles.rp_author.represent = rp In this case you would not need record. On Aug 25, 6:39 am, Johann Spies johann.sp...@gmail.com wrote: Please help me to understand how to use the new syntax. How do I have to change the following code to work? def rp(author): an = db(db.akb_reprint.uuid==author).select(db.akb_reprint.rp_author) if len(an): a_name = an.first()['rp_author'] else: a_name = 'No rp_author' return a_name db.akb_articles.rp_author.represent = lambda x,record: rp(x),record How do I define and use 'record' in this case? The ticket says: db.akb_articles.rp_author.represent = lambda x,record: rp(x),record NameError: name 'record' is not defined Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Lazy virtual fields - strange result!
I wanted to learn more about lazy virtual fields and therefore I have repeated the example from the book: def vfields(): db.define_table('item', Field('unit_price','double'), Field('quantity','integer')) db(db.item.id0).delete() class MyVirtualFields: def lazy_total_price(self): return lambda self=self: self.item.unit_price*self.item.quantity db.item.virtualfields.append (MyVirtualFields()) db.item.bulk_insert([{'unit_price':12.00, 'quantity': 15}, {'unit_price':10.00, 'quantity': 99}, {'unit_price':120.00, 'quantity': 2},]) res = [] for r in db(db.item.id0).select(): res.append([r.unit_price, r.quantity, r.lazy_total_price()]) return dict(res=res) The expected output is: [[12.0, 15, 180.0], [10.0, 99, 990.0], [120.0, 2, 240.0]] But I got * [[12.0, 15, *240.0]*, [10.0, 99, *240.0*], [120.0, 2, 240.0]]* * * *Three times the same result. * I have read the book and my program over and over again - but I cannot see any error.* * Does somebody have an idea? Martin
[web2py] Re: Lazy virtual fields - strange result!
We are moving away from this because of many problems. Try this instead. It is still experimental but may go into stable soon. def vfields(): db.define_table('item', Field('unit_price','double'), Field('quantity','integer')) db(db.item.id0).delete() db.item.lazy_total_price=Field.lazy(lambda self:self.item.unit_price*self.item.quantity) db.item.bulk_insert([{'unit_price':12.00, 'quantity': 15}, {'unit_price':10.00, 'quantity': 99}, {'unit_price':120.00, 'quantity': 2},]) res = [] for r in db(db.item.id0).select(): res.append([r.unit_price, r.quantity, r.lazy_total_price()]) return dict(res=res) On Aug 25, 7:50 am, Martin Weissenboeck mweis...@gmail.com wrote: I wanted to learn more about lazy virtual fields and therefore I have repeated the example from the book: def vfields(): db.define_table('item', Field('unit_price','double'), Field('quantity','integer')) db(db.item.id0).delete() class MyVirtualFields: def lazy_total_price(self): return lambda self=self: self.item.unit_price*self.item.quantity db.item.virtualfields.append (MyVirtualFields()) db.item.bulk_insert([{'unit_price':12.00, 'quantity': 15}, {'unit_price':10.00, 'quantity': 99}, {'unit_price':120.00, 'quantity': 2},]) res = [] for r in db(db.item.id0).select(): res.append([r.unit_price, r.quantity, r.lazy_total_price()]) return dict(res=res) The expected output is: [[12.0, 15, 180.0], [10.0, 99, 990.0], [120.0, 2, 240.0]] But I got * [[12.0, 15, *240.0]*, [10.0, 99, *240.0*], [120.0, 2, 240.0]]* * * *Three times the same result. * I have read the book and my program over and over again - but I cannot see any error.* * Does somebody have an idea? Martin
Re: [web2py] CRUD update in modal iframe
Anthony and Bruno Thank you for your replies. I tried nyroModal but get the same results as with FancyBox (which I've been using). I am going to work up a simple app that shows my problem. Either that will show me where my problem lies or provide something simple for you to see the behavior I'm dealing with. Thanks again for the input. -Jim On 8/24/2011 6:13 PM, Bruno Rocha wrote: Your modal uses Iframe? nyroModal needs target='_blank' to open in iframe and work as you want. Other modal plugins has other ways for doing it. For redirect in parent window. You ll need to execute a javascript inside modal. window.parent.location = '' http://zerp.ly/rochacbruno Em 24/08/2011 17:55, Jim Steil j...@qlf.com mailto:j...@qlf.com escreveu: Hi I have a crud.update that I'm displaying in a modal iFrame. This is working fine for me except when there is an error in the form and crud redisplays with the error message. This is opening outside the iFrame when I want it to load inside the iFrame. But, on submit, the next url should load outside the iFrame. Make any sense? Any advice on where to look to get this working the way I want? -Jim
[web2py] Re: Allowing provisional login with email only
I agree, but I think the solution is use of session and/or cookies if you want to persist some user state -- that should achieve what you want without exposing private information. If you want an easy login experience, you might also consider something like Janrain or your own OpenID login. Anthony On Thursday, August 25, 2011 7:04:46 AM UTC-4, peter wrote: Anthony, this is exactly the culture I am questionning. Why force everyone to register because a small number of people are concerned about someone else pretending to be them to see their choice in a cart (slightly paranoid I would say). They are welcome to have their concern, they can register. I guess I should have a message when asking for their email, saying that if they want full security then register or login. Peter On Aug 25, 2:13 am, pbreit pbreit...@gmail.com wrote: I was actually referring to the situation where in the future you link any prior orders to a newly created account based on email address. It sounded like you might have been considering that. But from a conservative info privacy standpoint, Anthony's concern might be an issue as well.
[web2py] new feature in trunk: auth.settings.login_after_registration
Some times I need the following: I want people to register and be able to play with some parts of the app but not everything until they verify their email. yet I do not want them to have to wait for the email in oder to se the system. Now (in trunk) you can do: auth.settings.registration_requires_verification = True auth.settings.login_after_registration = True and block some actions with @auth.requires(auth.user and not auth.user.registration_key) The user will login, receive an email and be able to use the app (before verifying registration, except the decorated actions), until the session expires. After the user clicks on the email link, the user will be able to login again with full access.
[web2py] Re: Problem creating forms inside a form.accepts
Thanks for the help. Here is the complete function defined in the controller: -- code for controller starts -- @auth.requires_login() def new_sale(): response.title=New sale if not session.cart: session.cart={} if not session.cart_qty: session.cart_qty={} if not session.qty_forms: session.qty_forms={} form = FORM(INPUT(_name=search, requires=IS_NOT_EMPTY()), INPUT(_type=submit, _value=Search),_name=form_search) if form.accepts(request.vars,session,formname=form_search): rows=db(db.products.barcode==request.vars.search).select() if len(rows) == 1: product = rows.first() if product.id in session.cart: session.cart_qty[product.id]+=1 session.qty_forms[product.id][0] ['_value']=session.cart_qty[product.id] else: session.cart[product.id]=product session.cart_qty[product.id]=1 qty_form=FORM(INPUT( _name=qty, _value=1), INPUT(_type=hidden, _name=prod_id,_value=product.id), INPUT(_type=submit,_value=T(Update),_style=display:none;), _name=formqty+str(product.id)) if qty_form.accepts(request.vars, session,formname=formqty+str(product.id)): session.cart_qty[request.vars.prod_id]+=1 temp_qty = session.cart_qty[request.vars.prod_id] session.qty_forms[request.vars.prod_id][0]['_value'] = temp_qty session.qty_forms[product.id]=qty_form return dict(form=form) -- code for controller ends -- Now this is the view code: -- code for view starts -- {{extend 'layout.html'}} h1Venta/h1 div id=buscar_codigo {{=form}} /div {{if len(session.cart)0:}} table class=data_table thead tr th scope=col class=a10pcCantidad/th th scope=col class=a10pcCodigo/th th scope=col class=a50pcProducto/th th scope=col class=a10pcPrecio/th th scope=col class=a10pcSub-Total/th th scope=col class=a10pcQuitar/th /tr /thead tbody {{i=0}} {{total=0}} {{for id, product in session.cart.iteritems():}} {{if i%2==1:}} tr class=impar {{else:}} tr {{pass}} !--So I basically read all the products in the cart (a dictionary) Each product must have a quantity form so the user can modify the amount of products sold.-- td{{=session.qty_forms[id]}}/td td{{=session.cart[id].codigo_de_barras}}/td td{{=session.cart[id].nombre}}/td td{{=session.cart[id].precio_de_venta}}/td td{{=session.cart[id].precio_de_venta*session.cart_qty[id]}}/td td/td /tr {{i+=1}} {{total +=session.cart[id].precio_de_venta*session.cart_qty[id]}} {{pass}} tfoot tr class=total_row th align=right colspan=3 class=totalstrongTotal/ strong/td th colspan=3 class=totalstrong{{=total}}/strong/ td /tr /tfoot /tbody /table {{pass}} -- code for view ends -- Hopefully this time indentation wont break. Any way as I already said the forms display correctly is just that the accept code doesn't. And my forms all have different names. Hope some one can give a hand. Thanks.
[web2py] Re: Upload Install packed application on FluxFlex - Error500
I have the same problem trying to upload from admin app. I just followed the vimeo video by Massimo and everything worked fine until i tried to upload. It would help if there were some server output to check what is going when uploading but i don't see how this could be done with flux administrative panel. On 24 ago, 18:34, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I emailed the author of the installation script. It just got updated. Perhaps there is a bug? massimo On Aug 24, 4:26 pm, Valter Foresto valter.fore...@gmail.com wrote: I tryed to Upload Install some simple packed applications onFluxFlexbut I get always Error 500 from the Server. I attached here the file with the Error 500 message send by theFluxFlex Server. Are there anybody experienced the same problem ? - Valter Error500.JPG 58KViewDownload
Re: [web2py] Re: Upload Install packed application on FluxFlex - Error500
The Error is caused POST size restriction, maybe. I tried to upload a file which is about 128KB but could not upload. 2011/8/25 Massimo Di Pierro massimo.dipie...@gmail.com: I emailed the author of the installation script. It just got updated. Perhaps there is a bug? massimo On Aug 24, 4:26 pm, Valter Foresto valter.fore...@gmail.com wrote: I tryed to Upload Install some simple packed applications on FluxFlex but I get always Error 500 from the Server. I attached here the file with the Error 500 message send by the FluxFlex Server. Are there anybody experienced the same problem ? - Valter Error500.JPG 58KViewDownload
Re: [web2py] Re: Upload Install packed application on FluxFlex - Error500
Is there a way to update web2py on fluxflex? On Thu, Aug 25, 2011 at 10:52 AM, Yota Ichino www.i...@gmail.com wrote: The Error is caused POST size restriction, maybe. I tried to upload a file which is about 128KB but could not upload. 2011/8/25 Massimo Di Pierro massimo.dipie...@gmail.com: I emailed the author of the installation script. It just got updated. Perhaps there is a bug? massimo On Aug 24, 4:26 pm, Valter Foresto valter.fore...@gmail.com wrote: I tryed to Upload Install some simple packed applications on FluxFlex but I get always Error 500 from the Server. I attached here the file with the Error 500 message send by the FluxFlex Server. Are there anybody experienced the same problem ? - Valter Error500.JPG 58KViewDownload -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___
[web2py] Re: fluxflex
That's a good merge. By the way, is it possible to completely remove the old master branch stuff? (This is actually a question for git.) Current repo still contains many web2py files in its history. This makes it a little bit unnecessary slow when cloning the repo. Regards, Ray On Aug 25, 2:36 am, Yota Ichino www.i...@gmail.com wrote: I merged get_new_stable branch into master branch. 2011/8/24 Yota Ichino www.i...@gmail.com: Iceberg, Massimo Di Pierro, Your idea is great. These influence me and I rewrite .flx file. It is created on same github project with branch get_new_stable. https://github.com/nus/web2py-for-fluxflex/tree/get_new_stable We can import this branch by using Github import menu. The branch doing: 1. get new stable file from web2py.com. 2. unzip 3. deploying This idea's strong point: - User can get new stable file everytime. Iceberg, How to write .flx file is inhttp://jp.doc.fluxflex.com/and other library code. 2011/8/23 Massimo Di Pierro massimo.dipie...@gmail.com: I think there should be a recommended way to created branded versions of web2py. I would recommend: - getting the latest official stable - unzip - add your own init app, with landing branded page etc, linking admin. - have a standard mechanism to add a brand logo to admin as well - rezip and distribute we could create a hook (div) for the admin logo, a sample branded init, and a script to create this. Massimo On Aug 22, 2:24 am, Iceberg iceb...@21cn.com wrote: Omi Chiba, Thanks VERY MUCH for your effort on building the web2py installation package (a.k.a. library on fluxflex). Deploying web2py on a hosting server has never been so easy! (I start crying for the hours I spent in setting up my first web2py instance on my previous hosting provider.) One thing though. Your web2py library is a forked (and tailored) version of official web2py 1.98.2. This way it will soon be outdated when web2py trunk grows into 1.99, 1.100, etc.. So I see the only practical way is: 1. modify your .flx file (in order to get rid of the public_html directory, shall we?) 2. and commit it into the trunk. 3. and then someone of us (if not Massimo) maintain an identical clone (rather than a fork) of web2py on github, until fluxflex will support google code as app backend someday. (Will they?) Later we will figure out a way to upload (perhaps download too?) each web2py app, one by one. By the way, how did you find out how to write the .flx file? I did not see any documentation section on fluxflex site. Hope to know more so that we can tweak more. Regards, Ray On Aug 21, 8:37 pm, Omi Chiba ochib...@gmail.com wrote: Ichino who is a member of web2py Japan created a library on fluxflex and it works great ! http://www.fluxflex.com/library/47 1. Sign up fluxflex 2. Create new project (e.g. ochiba) 3. Install the library (It will be done in one second!) 4. Access to your project with HTTPS not HTTP (e.g.https://ochiba.fluxflex.com) 5. Access Administrative Interface with /admin (e.g.https://ochiba.fluxflex.com/admin ) 5. Admin password is the same as your MySQL database on fluxflex project. Enjoy :)
[web2py] Re: Problem with Oracle access and web2py database administration
I am using this this version... changeset: 2295:7c7f7d5ac882 date:Wed Aug 24 16:25:41 2011 -0500 I am able to reproduce the problem by creating a simple, default app and replacing the DAL line with... from gluon.custom_import import track_changes track_changes() from connect_string import account db = DAL('oracle://' + account, check_reserved=['oracle']) (where the 'account' variable has my login, password, and tns name). From the app admin page, visit the database administration page, and select (for example) db.auth_user. The flash response gives the Invalid Query error message. The auth tables all get created and other database queries (from within the app) seem to work... SQL select * from cat; TABLE_NAME TABLE_TYPE -- --- AUTH_CAS TABLE AUTH_CAS_SEQUENCE SEQUENCE AUTH_EVENT TABLE AUTH_EVENT_SEQUENCE SEQUENCE AUTH_GROUP TABLE AUTH_GROUP_SEQUENCE SEQUENCE AUTH_MEMBERSHIPTABLE AUTH_MEMBERSHIP_SEQUENCE SEQUENCE AUTH_PERMISSIONTABLE AUTH_PERMISSION_SEQUENCE SEQUENCE AUTH_USER TABLE TABLE_NAME TABLE_TYPE -- --- AUTH_USER_SEQUENCE SEQUENCE
[web2py] Re: Re : Re: fluxflex
On Aug 24, 10:25 pm, Ray (a.k.a. Iceberg) iceb...@21cn.com wrote: Another big issue. How to upgrade to the latest web2py (when available)? Every time I do a git import in fluxflex panel, with or WITHOUT checking Run initialize scripts for setting up the project, ends up with my whole web2py project being completely reset. My manually uploaded web2py apps and their data will be lost. I've read the doc [1] by the help of Google Translate, but still can not figure out how to trigger the deploy-only mode. By the way, problems raised on Fluxflex's support forum [2] never got answered. Not a good service standard I expected. (Shrug.) [1] http://jp.doc.fluxflex.com/settoappumodotodepuroimodo [2] http://getsatisfaction.com/fluxflex On Aug 24, 10:53 pm, JmiXIII sylvn.p...@gmail.com wrote: Hello, Does'nt it work with the upgrade button of the admin page ? Hi JimXIII, Thanks for reminding me about the web2py's builtin ugrade button. It should work, unless there will be so weird post limit prevent us to do so. (http://groups.google.com/group/web2py/browse_frm/thread/ 8ccb23cb0fad2e04) Things might become more complicated if our project on fluxflex autoscale-able (https://www.fluxflex.com/about#auto-scaling). Does the upgrade on one cluster automatically broadcast to other clusters? We will see. Meanwhile, I still consider fluxflex support for web2py is limited. Regards, Ray
[web2py] Re: Upload Install packed application on FluxFlex - Error500
Hi Tito, there is an ongoing discussion here. http://groups.google.com/group/web2py/msg/aa293a99cda711e9 Regards, Ray On Aug 25, 10:21 pm, Tito Garrido titogarr...@gmail.com wrote: Is there a way to update web2py on fluxflex? On Thu, Aug 25, 2011 at 10:52 AM, Yota Ichino www.i...@gmail.com wrote: The Error is caused POST size restriction, maybe. I tried to upload a file which is about 128KB but could not upload. 2011/8/25 Massimo Di Pierro massimo.dipie...@gmail.com: I emailed the author of the installation script. It just got updated. Perhaps there is a bug? massimo On Aug 24, 4:26 pm, Valter Foresto valter.fore...@gmail.com wrote: I tryed to Upload Install some simple packed applications on FluxFlex but I get always Error 500 from the Server. I attached here the file with the Error 500 message send by the FluxFlex Server. Are there anybody experienced the same problem ? - Valter Error500.JPG 58KViewDownload -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___
Re: [web2py] Re: fluxflex
What is get_new_stable? Could you explain how to upgrade web2py-for-fluxflex? On Thu, Aug 25, 2011 at 11:22 AM, Ray (a.k.a. Iceberg) iceb...@21cn.comwrote: That's a good merge. By the way, is it possible to completely remove the old master branch stuff? (This is actually a question for git.) Current repo still contains many web2py files in its history. This makes it a little bit unnecessary slow when cloning the repo. Regards, Ray On Aug 25, 2:36 am, Yota Ichino www.i...@gmail.com wrote: I merged get_new_stable branch into master branch. 2011/8/24 Yota Ichino www.i...@gmail.com: Iceberg, Massimo Di Pierro, Your idea is great. These influence me and I rewrite .flx file. It is created on same github project with branch get_new_stable. https://github.com/nus/web2py-for-fluxflex/tree/get_new_stable We can import this branch by using Github import menu. The branch doing: 1. get new stable file from web2py.com. 2. unzip 3. deploying This idea's strong point: - User can get new stable file everytime. Iceberg, How to write .flx file is inhttp://jp.doc.fluxflex.com/and other library code. 2011/8/23 Massimo Di Pierro massimo.dipie...@gmail.com: I think there should be a recommended way to created branded versions of web2py. I would recommend: - getting the latest official stable - unzip - add your own init app, with landing branded page etc, linking admin. - have a standard mechanism to add a brand logo to admin as well - rezip and distribute we could create a hook (div) for the admin logo, a sample branded init, and a script to create this. Massimo On Aug 22, 2:24 am, Iceberg iceb...@21cn.com wrote: Omi Chiba, Thanks VERY MUCH for your effort on building the web2py installation package (a.k.a. library on fluxflex). Deploying web2py on a hosting server has never been so easy! (I start crying for the hours I spent in setting up my first web2py instance on my previous hosting provider.) One thing though. Your web2py library is a forked (and tailored) version of official web2py 1.98.2. This way it will soon be outdated when web2py trunk grows into 1.99, 1.100, etc.. So I see the only practical way is: 1. modify your .flx file (in order to get rid of the public_html directory, shall we?) 2. and commit it into the trunk. 3. and then someone of us (if not Massimo) maintain an identical clone (rather than a fork) of web2py on github, until fluxflex will support google code as app backend someday. (Will they?) Later we will figure out a way to upload (perhaps download too?) each web2py app, one by one. By the way, how did you find out how to write the .flx file? I did not see any documentation section on fluxflex site. Hope to know more so that we can tweak more. Regards, Ray On Aug 21, 8:37 pm, Omi Chiba ochib...@gmail.com wrote: Ichino who is a member of web2py Japan created a library on fluxflex and it works great ! http://www.fluxflex.com/library/47 1. Sign up fluxflex 2. Create new project (e.g. ochiba) 3. Install the library (It will be done in one second!) 4. Access to your project with HTTPS not HTTP (e.g. https://ochiba.fluxflex.com) 5. Access Administrative Interface with /admin (e.g. https://ochiba.fluxflex.com/admin ) 5. Admin password is the same as your MySQL database on fluxflex project. Enjoy :) -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___
Re : Re: [web2py] Re: fluxflex
As far as I understand : get_new_stable is a git branch of the git web2py-for-fluxflex which allow to import the last stable vesrion of web2py. Yet if you do so you will lost your previously installed app. I think you should prefer the builtin upgrade button of the admin web2py, but I haven't tried since my project are already running the last stable version. I've always used upgrade builtin button and it always worked on localhost.
[web2py] Re: Understanding Rocket Threads
Hi G, I saw similar behaviors in some of my lightweight app, which also uses sqlite and rocket. I need not solve that problem at that time (it was really a little app for a small group). But I can provide some information to you this time. When you try to isolate the sqlite, using no auth and randomly generating data are not enough. You would better completely take out this line: db = DAL('sqlite://storage.sqlite') that means completely avoid db definition and db opening. That is because, in web2py, even a sqlite db open attempt will open the db in exclusive mode, hence blocking other requests to the same app. (That was true, I don't know whether that was changed since then. Massimo can confirm that.) Regards, Ray On Aug 25, 6:37 am, G glenn.calt...@gmail.com wrote: Thank you for the suggestion. I made a test application that used no database accesses (no auth and randomly generated data). It showed the same behavior, so I do not think it is the culprit. In addition, since the application is monitor only, the real application only reads from the database, which I hope would not impose a transaction lock. G On Aug 24, 3:20 pm, ron_m ron.mco...@gmail.com wrote: You also need to consider the database type used by the application for the model. The SQLite database has a transaction lock which will cause the application to look like it is single threaded if the database is held in a transaction pending state while the background work is performed.
Re: [web2py] CRUD update in modal iframe
Ok, found what was causing the problem. On my page that I'm loading in my modal window I was specifying a different view. This view had: base target=_top ...in the head section. This caused all submits/re-displays to go to the parent to display. If I take it out it works as expected. However, now (as Bruno mentioned) when I submit my form the next url is loaded in the modal as well. I'm using CRUD in my modal window, how/where do I specify the window.parent.location='next url' as Bruno mentioned? Thanks again. -Jim On 8/25/2011 8:18 AM, Jim Steil wrote: Anthony and Bruno Thank you for your replies. I tried nyroModal but get the same results as with FancyBox (which I've been using). I am going to work up a simple app that shows my problem. Either that will show me where my problem lies or provide something simple for you to see the behavior I'm dealing with. Thanks again for the input. -Jim On 8/24/2011 6:13 PM, Bruno Rocha wrote: Your modal uses Iframe? nyroModal needs target='_blank' to open in iframe and work as you want. Other modal plugins has other ways for doing it. For redirect in parent window. You ll need to execute a javascript inside modal. window.parent.location = '' http://zerp.ly/rochacbruno Em 24/08/2011 17:55, Jim Steil j...@qlf.com mailto:j...@qlf.com escreveu: Hi I have a crud.update that I'm displaying in a modal iFrame. This is working fine for me except when there is an error in the form and crud redisplays with the error message. This is opening outside the iFrame when I want it to load inside the iFrame. But, on submit, the next url should load outside the iFrame. Make any sense? Any advice on where to look to get this working the way I want? -Jim
Re: [web2py] Re: Lazy virtual fields - strange result!
Thank you. Which version of web2py? 1.98.2 does not know Field.lazy 2011/8/25 Massimo Di Pierro massimo.dipie...@gmail.com We are moving away from this because of many problems. Try this instead. It is still experimental but may go into stable soon. def vfields(): db.define_table('item', Field('unit_price','double'), Field('quantity','integer')) db(db.item.id0).delete() db.item.lazy_total_price=Field.lazy(lambda self:self.item.unit_price*self.item.quantity) db.item.bulk_insert([{'unit_price':12.00, 'quantity': 15}, {'unit_price':10.00, 'quantity': 99}, {'unit_price':120.00, 'quantity': 2},]) res = [] for r in db(db.item.id0).select(): res.append([r.unit_price, r.quantity, r.lazy_total_price()]) return dict(res=res) On Aug 25, 7:50 am, Martin Weissenboeck mweis...@gmail.com wrote: I wanted to learn more about lazy virtual fields and therefore I have repeated the example from the book: def vfields(): db.define_table('item', Field('unit_price','double'), Field('quantity','integer')) db(db.item.id0).delete() class MyVirtualFields: def lazy_total_price(self): return lambda self=self: self.item.unit_price*self.item.quantity db.item.virtualfields.append (MyVirtualFields()) db.item.bulk_insert([{'unit_price':12.00, 'quantity': 15}, {'unit_price':10.00, 'quantity': 99}, {'unit_price':120.00, 'quantity': 2},]) res = [] for r in db(db.item.id0).select(): res.append([r.unit_price, r.quantity, r.lazy_total_price()]) return dict(res=res) The expected output is: [[12.0, 15, 180.0], [10.0, 99, 990.0], [120.0, 2, 240.0]] But I got * [[12.0, 15, *240.0]*, [10.0, 99, *240.0*], [120.0, 2, 240.0]]* * * *Three times the same result. * I have read the book and my program over and over again - but I cannot see any error.* * Does somebody have an idea? Martin
[web2py] OWASP Top 10 web app vuln # 10
Hey, I know this has been discussed before, but this issued is now in the OWASP top ten web application vulnerabilities https://www.owasp.org/index.php/Top_10_2010-A10 . The vulnerability is the feature ?_next=SITE. One way this good be exploited according to the vulnerability is a attacker gives out a link to the login page of your site a uniformed user attempts to login which on success gets redirected to the phishing site. On said site the attacker makes it look the same and shows the form error invalid credentials the user attempts to login again and gets redirected to the valid site. Now the attacker has the users credentials and a way into the site. A suggested solution is on default to only allow _next to redirect to a site within the application and have a config file or variable which contains a whitelist of sites that are allowed to be redirected to. -Eric This communication, including any attachments, does not necessarily represent official policy of Seccuris Inc. Please see http://www.seccuris.com/Contact-PrivacyPolicy.htm for further details about Seccuris Inc.'s Privacy Policy. If you have received this communication in error, please notify Seccuris Inc. at i...@seccuris.com or at 1-866-644-8442.
Re: [web2py] Re: fluxflex
You're right, Iceberg. Uh..., there is a issue. I don't know how to delete history in git. Could you tell me it? 2011/8/25 Ray (a.k.a. Iceberg) iceb...@21cn.com: That's a good merge. By the way, is it possible to completely remove the old master branch stuff? (This is actually a question for git.) Current repo still contains many web2py files in its history. This makes it a little bit unnecessary slow when cloning the repo. Regards, Ray On Aug 25, 2:36 am, Yota Ichino www.i...@gmail.com wrote: I merged get_new_stable branch into master branch. 2011/8/24 Yota Ichino www.i...@gmail.com: Iceberg, Massimo Di Pierro, Your idea is great. These influence me and I rewrite .flx file. It is created on same github project with branch get_new_stable. https://github.com/nus/web2py-for-fluxflex/tree/get_new_stable We can import this branch by using Github import menu. The branch doing: 1. get new stable file from web2py.com. 2. unzip 3. deploying This idea's strong point: - User can get new stable file everytime. Iceberg, How to write .flx file is inhttp://jp.doc.fluxflex.com/and other library code. 2011/8/23 Massimo Di Pierro massimo.dipie...@gmail.com: I think there should be a recommended way to created branded versions of web2py. I would recommend: - getting the latest official stable - unzip - add your own init app, with landing branded page etc, linking admin. - have a standard mechanism to add a brand logo to admin as well - rezip and distribute we could create a hook (div) for the admin logo, a sample branded init, and a script to create this. Massimo On Aug 22, 2:24 am, Iceberg iceb...@21cn.com wrote: Omi Chiba, Thanks VERY MUCH for your effort on building the web2py installation package (a.k.a. library on fluxflex). Deploying web2py on a hosting server has never been so easy! (I start crying for the hours I spent in setting up my first web2py instance on my previous hosting provider.) One thing though. Your web2py library is a forked (and tailored) version of official web2py 1.98.2. This way it will soon be outdated when web2py trunk grows into 1.99, 1.100, etc.. So I see the only practical way is: 1. modify your .flx file (in order to get rid of the public_html directory, shall we?) 2. and commit it into the trunk. 3. and then someone of us (if not Massimo) maintain an identical clone (rather than a fork) of web2py on github, until fluxflex will support google code as app backend someday. (Will they?) Later we will figure out a way to upload (perhaps download too?) each web2py app, one by one. By the way, how did you find out how to write the .flx file? I did not see any documentation section on fluxflex site. Hope to know more so that we can tweak more. Regards, Ray On Aug 21, 8:37 pm, Omi Chiba ochib...@gmail.com wrote: Ichino who is a member of web2py Japan created a library on fluxflex and it works great ! http://www.fluxflex.com/library/47 1. Sign up fluxflex 2. Create new project (e.g. ochiba) 3. Install the library (It will be done in one second!) 4. Access to your project with HTTPS not HTTP (e.g.https://ochiba.fluxflex.com) 5. Access Administrative Interface with /admin (e.g.https://ochiba.fluxflex.com/admin ) 5. Admin password is the same as your MySQL database on fluxflex project. Enjoy :)
[web2py] Passing web2py command line parameters when using apache/mod_wsgi
How to I pass command line parameters to web2py when I'm not starting web2py from the command line. I'm using apache and mod_wsgi. I've looked closely at the documentation, and there's a section on how to pass parameters when it's running as a windows service, but the documentation is clear that this only works when it's running as a windows service. I've found an external site that mentions that it's possible to pass command line parameters when using mod_wsgi, but it doesn't explain how. Also, is there a way to check my web2py parameters when I'm running it on apache? Thank you in advance. Eric
[web2py] Re: fluxflex
Hi Yota, Thanks for your time. Hopefully these can help. [1] http://stackoverflow.com/questions/872565/how-do-i-remove-sensitive-files-from-gits-history [2] http://help.github.com/remove-sensitive-data/ Regards, Ray On Aug 26, 12:05 am, Yota Ichino www.i...@gmail.com wrote: You're right, Iceberg. Uh..., there is a issue. I don't know how to delete history in git. Could you tell me it? 2011/8/25 Ray (a.k.a. Iceberg) iceb...@21cn.com: That's a good merge. By the way, is it possible to completely remove the old master branch stuff? (This is actually a question for git.) Current repo still contains many web2py files in its history. This makes it a little bit unnecessary slow when cloning the repo. Regards, Ray On Aug 25, 2:36 am, Yota Ichino www.i...@gmail.com wrote: I merged get_new_stable branch into master branch.
Re: [web2py] Re: fluxflex
Thank you for helping. I'll read. 2011/8/26 Ray (a.k.a. Iceberg) iceb...@21cn.com: Hi Yota, Thanks for your time. Hopefully these can help. [1] http://stackoverflow.com/questions/872565/how-do-i-remove-sensitive-files-from-gits-history [2] http://help.github.com/remove-sensitive-data/ Regards, Ray On Aug 26, 12:05 am, Yota Ichino www.i...@gmail.com wrote: You're right, Iceberg. Uh..., there is a issue. I don't know how to delete history in git. Could you tell me it? 2011/8/25 Ray (a.k.a. Iceberg) iceb...@21cn.com: That's a good merge. By the way, is it possible to completely remove the old master branch stuff? (This is actually a question for git.) Current repo still contains many web2py files in its history. This makes it a little bit unnecessary slow when cloning the repo. Regards, Ray On Aug 25, 2:36 am, Yota Ichino www.i...@gmail.com wrote: I merged get_new_stable branch into master branch.
Re: [web2py] IMPORTANT on cron jobs, scheduled jobs and delayed jobs
I have a doubt, suppose I have a task I have to run every day, the task take one hour to complete and suppose I scheduled to start at 5am every day. The first time it's run at 5am, the next day it's run at 5am or at 6am? because I put period=86400sec and the prior task take 1 hour to complete. 2011/8/8 Massimo Di Pierro massimo.dipie...@gmail.com ## preambole I have been working on porting django-celery to web2py-celery. http://code.google.com/p/web2py-celery There are a few issues to resolve and I am working on it. Yet I found it to be overkill for most users. It has lots of dependencies (for example RabbitMQ) and it is not easy to manage. If you do not need a huge number of worker nodes there may be a better solution. So I added this to trunk: gluon/scheduler.py This email is a request for comments as I think this should replace te current cron mechanism. ## What is it? It is a lightweight replacement for celery that uses the database instead of queues to schedule tasks and uses the default web2py admin interface to allow you to schedule tasks. It consists of a single file and has no dependencies. ## How does it work? For any existing app Create File: app/models/scheduler.py == from gluon.scheduler import Scheduler def demo1(*args,**vars): print 'you passed args=%s and vars=%s' % (args, vars) return 'done!' def demo2(): 1/0 scheduler = Scheduler(db,dict(demo1=demo1,demo2=demo2)) = Create File: app/modules/scheduler.py == scheduler.worker_loop() = ## run worker nodes with: python web2py.py -S app -M -N -R applications/app/modules/ scheduler.py ## schedule jobs using http://127.0.0.1:8000/scheduler/appadmin/insert/db/task_scheduled ## monitor scheduled jobs http://127.0.0.1:8000/scheduler/appadmin/select/db?query=db.task_scheduled.id%3E0 ## view completed jobs http://127.0.0.1:8000/scheduler/appadmin/select/db?query=db.task_run.id%3E0 Compared to celery it lacks the ability to bind tasks and workers , remotely interrupt tasks and set timeout, yet these features can be added easily and I will so eventually. Please let me know what you think. Massimo -- http://martin.tecnodoc.com.ar
[web2py] Changed field name in table def, database OK, but getting key error
I'm using postgresql. I had to change a field name in my table def, which are in the web2py models. The database changed accordingly, but now I get a key error when I try to insert a new record using appadmin. I made sure appadmin.py is the latest and greatest. Still getting key error. I don't dare drop the db since each time I've done that before I've not been able to get it running again, no matter how many variations of migrate and fake_migrate I tried. So end up having to re-create the app, and then copy in the files, which takes a long time. I love web2py but database issues are driving me nuts. Can someone please help me? My app is so close to finished. Here's the traceback Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 192, in restricted exec ccode in environment File /home/www-data/web2py/applications/baristacode/controllers/ appadmin.py, line 411, in module File /home/www-data/web2py/gluon/globals.py, line 145, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/baristacode/controllers/ appadmin.py, line 126, in insert form = SQLFORM(db[table], ignore_rw=ignore_rw) File /home/www-data/web2py/gluon/sqlhtml.py, line 830, in __init__ inp = self.widgets.options.widget(field, default) File /home/www-data/web2py/gluon/sqlhtml.py, line 218, in widget options = requires[0].options() File /home/www-data/web2py/gluon/validators.py, line 438, in options self.build_set() File /home/www-data/web2py/gluon/validators.py, line 421, in build_set fields = [self.dbset.db[self.ktable][k] for k in self.fields] File /home/www-data/web2py/gluon/dal.py, line 4675, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'name_string' By the way, I changed the field name from name_string to name. Somewhere, name_string is still cached. I just can't figure out where. I've cleared the caches, restarted, etc etc. Thanks in advance for your help. Eric
[web2py] Re: Problem with Oracle access and web2py database administration
Can you add {{=response.toolbar()}} somewhere in your layout.html and see what is the invalid query generated by appadmin? On Aug 25, 9:23 am, Tim Korb jtk...@gmail.com wrote: I am using this this version... changeset: 2295:7c7f7d5ac882 date: Wed Aug 24 16:25:41 2011 -0500 I am able to reproduce the problem by creating a simple, default app and replacing the DAL line with... from gluon.custom_import import track_changes track_changes() from connect_string import account db = DAL('oracle://' + account, check_reserved=['oracle']) (where the 'account' variable has my login, password, and tns name). From the app admin page, visit the database administration page, and select (for example) db.auth_user. The flash response gives the Invalid Query error message. The auth tables all get created and other database queries (from within the app) seem to work... SQL select * from cat; TABLE_NAME TABLE_TYPE -- --- AUTH_CAS TABLE AUTH_CAS_SEQUENCE SEQUENCE AUTH_EVENT TABLE AUTH_EVENT_SEQUENCE SEQUENCE AUTH_GROUP TABLE AUTH_GROUP_SEQUENCE SEQUENCE AUTH_MEMBERSHIP TABLE AUTH_MEMBERSHIP_SEQUENCE SEQUENCE AUTH_PERMISSION TABLE AUTH_PERMISSION_SEQUENCE SEQUENCE AUTH_USER TABLE TABLE_NAME TABLE_TYPE -- --- AUTH_USER_SEQUENCE SEQUENCE
[web2py] Re: OWASP Top 10 web app vuln # 10
We do not allow redirection outside the app, unless there is a bug. Did you check this? On Aug 25, 10:59 am, Eric Enns ee...@seccuris.com wrote: Hey, I know this has been discussed before, but this issued is now in the OWASP top ten web application vulnerabilitieshttps://www.owasp.org/index.php/Top_10_2010-A10. The vulnerability is the feature ?_next=SITE. One way this good be exploited according to the vulnerability is a attacker gives out a link to the login page of your site a uniformed user attempts to login which on success gets redirected to the phishing site. On said site the attacker makes it look the same and shows the form error invalid credentials the user attempts to login again and gets redirected to the valid site. Now the attacker has the users credentials and a way into the site. A suggested solution is on default to only allow _next to redirect to a site within the application and have a config file or variable which contains a whitelist of sites that are allowed to be redirected to. -Eric This communication, including any attachments, does not necessarily represent official policy of Seccuris Inc. Please seehttp://www.seccuris.com/Contact-PrivacyPolicy.htm for further details about Seccuris Inc.'s Privacy Policy. If you have received this communication in error, please notify Seccuris Inc. at i...@seccuris.com or at 1-866-644-8442.
[web2py] Re: Lazy virtual fields - strange result!
The nightly build or trunk. On Aug 25, 10:24 am, Martin Weissenboeck mweis...@gmail.com wrote: Thank you. Which version of web2py? 1.98.2 does not know Field.lazy 2011/8/25 Massimo Di Pierro massimo.dipie...@gmail.com We are moving away from this because of many problems. Try this instead. It is still experimental but may go into stable soon. def vfields(): db.define_table('item', Field('unit_price','double'), Field('quantity','integer')) db(db.item.id0).delete() db.item.lazy_total_price=Field.lazy(lambda self:self.item.unit_price*self.item.quantity) db.item.bulk_insert([{'unit_price':12.00, 'quantity': 15}, {'unit_price':10.00, 'quantity': 99}, {'unit_price':120.00, 'quantity': 2},]) res = [] for r in db(db.item.id0).select(): res.append([r.unit_price, r.quantity, r.lazy_total_price()]) return dict(res=res) On Aug 25, 7:50 am, Martin Weissenboeck mweis...@gmail.com wrote: I wanted to learn more about lazy virtual fields and therefore I have repeated the example from the book: def vfields(): db.define_table('item', Field('unit_price','double'), Field('quantity','integer')) db(db.item.id0).delete() class MyVirtualFields: def lazy_total_price(self): return lambda self=self: self.item.unit_price*self.item.quantity db.item.virtualfields.append (MyVirtualFields()) db.item.bulk_insert([{'unit_price':12.00, 'quantity': 15}, {'unit_price':10.00, 'quantity': 99}, {'unit_price':120.00, 'quantity': 2},]) res = [] for r in db(db.item.id0).select(): res.append([r.unit_price, r.quantity, r.lazy_total_price()]) return dict(res=res) The expected output is: [[12.0, 15, 180.0], [10.0, 99, 990.0], [120.0, 2, 240.0]] But I got * [[12.0, 15, *240.0]*, [10.0, 99, *240.0*], [120.0, 2, 240.0]]* * * *Three times the same result. * I have read the book and my program over and over again - but I cannot see any error.* * Does somebody have an idea? Martin
[web2py] Re: Understanding Rocket Threads
I tried session.forget() but found that forms submitted by ajax in components don't seem to work without a session, so that won't work in my case. I also tried removing the SQLite db, it may have helped some but I'm still testing. Thanks again for the suggestions On Aug 24, 4:18 pm, Michele Comitini michele.comit...@gmail.com wrote: Try session.forget() and see what happens mic 2011/8/25 G glenn.calt...@gmail.com: Thank you for the suggestion. I made a test application that used no database accesses (no auth and randomly generated data). It showed the same behavior, so I do not think it is the culprit. In addition, since the application is monitor only, the real application only reads from the database, which I hope would not impose a transaction lock. G On Aug 24, 3:20 pm, ron_m ron.mco...@gmail.com wrote: You also need to consider the database type used by the application for the model. The SQLite database has a transaction lock which will cause the application to look like it is single threaded if the database is held in a transaction pending state while the background work is performed.
[web2py] Re: IMPORTANT on cron jobs, scheduled jobs and delayed jobs
At 5am. This is the formula: next_run_time = task.last_run_time + timedelta(seconds=task.period) On Aug 25, 12:29 pm, Martín Mulone mulone.mar...@gmail.com wrote: I have a doubt, suppose I have a task I have to run every day, the task take one hour to complete and suppose I scheduled to start at 5am every day. The first time it's run at 5am, the next day it's run at 5am or at 6am? because I put period=86400sec and the prior task take 1 hour to complete. 2011/8/8 Massimo Di Pierro massimo.dipie...@gmail.com ## preambole I have been working on porting django-celery to web2py-celery. http://code.google.com/p/web2py-celery There are a few issues to resolve and I am working on it. Yet I found it to be overkill for most users. It has lots of dependencies (for example RabbitMQ) and it is not easy to manage. If you do not need a huge number of worker nodes there may be a better solution. So I added this to trunk: gluon/scheduler.py This email is a request for comments as I think this should replace te current cron mechanism. ## What is it? It is a lightweight replacement for celery that uses the database instead of queues to schedule tasks and uses the default web2py admin interface to allow you to schedule tasks. It consists of a single file and has no dependencies. ## How does it work? For any existing app Create File: app/models/scheduler.py == from gluon.scheduler import Scheduler def demo1(*args,**vars): print 'you passed args=%s and vars=%s' % (args, vars) return 'done!' def demo2(): 1/0 scheduler = Scheduler(db,dict(demo1=demo1,demo2=demo2)) = Create File: app/modules/scheduler.py == scheduler.worker_loop() = ## run worker nodes with: python web2py.py -S app -M -N -R applications/app/modules/ scheduler.py ## schedule jobs using http://127.0.0.1:8000/scheduler/appadmin/insert/db/task_scheduled ## monitor scheduled jobs http://127.0.0.1:8000/scheduler/appadmin/select/db?query=db.task_sche... ## view completed jobs http://127.0.0.1:8000/scheduler/appadmin/select/db?query=db.task_run Compared to celery it lacks the ability to bind tasks and workers , remotely interrupt tasks and set timeout, yet these features can be added easily and I will so eventually. Please let me know what you think. Massimo -- http://martin.tecnodoc.com.ar
[web2py] Re: OWASP Top 10 web app vuln # 10
On Thursday, August 25, 2011 2:12:37 PM UTC-4, Massimo Di Pierro wrote: We do not allow redirection outside the app, unless there is a bug. Yes, looks like we do. In Auth.login(): if next == DEFAULT: next = request.get_vars._next \ or request.post_vars._next \ or self.settings.login_next [snip] redirect(next) So, the login action will redirect to whatever URL is in the _next variable of the query string. Just tried it and was able to redirect to an external URL. Anthony
[web2py] Re: Understanding Rocket Threads
If you don't explicitly forget the session, the session file will lock on each request, so subsequent requests will be blocked. Maybe you could forget the session on requests that don't need it and just keep it for requests that do need it (i.e., form submissions). Note, to immediately unlock the session file, you need to do session.forget(response), not just session.forget(). Anthony On Thursday, August 25, 2011 2:14:54 PM UTC-4, G wrote: I tried session.forget() but found that forms submitted by ajax in components don't seem to work without a session, so that won't work in my case. I also tried removing the SQLite db, it may have helped some but I'm still testing. Thanks again for the suggestions On Aug 24, 4:18 pm, Michele Comitini michele@gmail.com wrote: Try session.forget() and see what happens mic 2011/8/25 G glenn@gmail.com: Thank you for the suggestion. I made a test application that used no database accesses (no auth and randomly generated data). It showed the same behavior, so I do not think it is the culprit. In addition, since the application is monitor only, the real application only reads from the database, which I hope would not impose a transaction lock. G On Aug 24, 3:20 pm, ron_m ron.m...@gmail.com wrote: You also need to consider the database type used by the application for the model. The SQLite database has a transaction lock which will cause the application to look like it is single threaded if the database is held in a transaction pending state while the background work is performed.
[web2py] Re: OWASP Top 10 web app vuln # 10
OK. I need to check when and why this got broken. This will be fixed by the next stable version. Please open a ticket so it is tracked. On Aug 25, 1:35 pm, Anthony abasta...@gmail.com wrote: On Thursday, August 25, 2011 2:12:37 PM UTC-4, Massimo Di Pierro wrote: We do not allow redirection outside the app, unless there is a bug. Yes, looks like we do. In Auth.login(): if next == DEFAULT: next = request.get_vars._next \ or request.post_vars._next \ or self.settings.login_next [snip] redirect(next) So, the login action will redirect to whatever URL is in the _next variable of the query string. Just tried it and was able to redirect to an external URL. Anthony
Re: [web2py] Changed field name in table def, database OK, but getting key error
Hello Eric, I would help, but I have no clue... Do you alternate between SQLite and Postgres? If yes, web2py always try to recreate the auth(s) tables that is a problem I often have... To solve it you must define the auth(s) tables in the db.py and set them to migrate=false... so web2py stop to trigger their creation each time... Richard On Thu, Aug 25, 2011 at 1:53 PM, Eric Scott erictransla...@gmail.comwrote: I'm using postgresql. I had to change a field name in my table def, which are in the web2py models. The database changed accordingly, but now I get a key error when I try to insert a new record using appadmin. I made sure appadmin.py is the latest and greatest. Still getting key error. I don't dare drop the db since each time I've done that before I've not been able to get it running again, no matter how many variations of migrate and fake_migrate I tried. So end up having to re-create the app, and then copy in the files, which takes a long time. I love web2py but database issues are driving me nuts. Can someone please help me? My app is so close to finished. Here's the traceback Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 192, in restricted exec ccode in environment File /home/www-data/web2py/applications/baristacode/controllers/ appadmin.py, line 411, in module File /home/www-data/web2py/gluon/globals.py, line 145, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/baristacode/controllers/ appadmin.py, line 126, in insert form = SQLFORM(db[table], ignore_rw=ignore_rw) File /home/www-data/web2py/gluon/sqlhtml.py, line 830, in __init__ inp = self.widgets.options.widget(field, default) File /home/www-data/web2py/gluon/sqlhtml.py, line 218, in widget options = requires[0].options() File /home/www-data/web2py/gluon/validators.py, line 438, in options self.build_set() File /home/www-data/web2py/gluon/validators.py, line 421, in build_set fields = [self.dbset.db[self.ktable][k] for k in self.fields] File /home/www-data/web2py/gluon/dal.py, line 4675, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'name_string' By the way, I changed the field name from name_string to name. Somewhere, name_string is still cached. I just can't figure out where. I've cleared the caches, restarted, etc etc. Thanks in advance for your help. Eric
[web2py] Re: OWASP Top 10 web app vuln # 10
OK. Issue created as requested http://code.google.com/p/web2py/issues/detail?id=388
[web2py] Re: Changed field name in table def, database OK, but getting key error
Did you try grep (http://en.wikipedia.org/wiki/Grep)? On Aug 25, 12:53 pm, Eric Scott erictransla...@gmail.com wrote: I'm using postgresql. I had to change a field name in my table def, which are in the web2py models. The database changed accordingly, but now I get a key error when I try to insert a new record using appadmin. I made sure appadmin.py is the latest and greatest. Still getting key error. I don't dare drop the db since each time I've done that before I've not been able to get it running again, no matter how many variations of migrate and fake_migrate I tried. So end up having to re-create the app, and then copy in the files, which takes a long time. I love web2py but database issues are driving me nuts. Can someone please help me? My app is so close to finished. Here's the traceback Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 192, in restricted exec ccode in environment File /home/www-data/web2py/applications/baristacode/controllers/ appadmin.py, line 411, in module File /home/www-data/web2py/gluon/globals.py, line 145, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/baristacode/controllers/ appadmin.py, line 126, in insert form = SQLFORM(db[table], ignore_rw=ignore_rw) File /home/www-data/web2py/gluon/sqlhtml.py, line 830, in __init__ inp = self.widgets.options.widget(field, default) File /home/www-data/web2py/gluon/sqlhtml.py, line 218, in widget options = requires[0].options() File /home/www-data/web2py/gluon/validators.py, line 438, in options self.build_set() File /home/www-data/web2py/gluon/validators.py, line 421, in build_set fields = [self.dbset.db[self.ktable][k] for k in self.fields] File /home/www-data/web2py/gluon/dal.py, line 4675, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'name_string' By the way, I changed the field name from name_string to name. Somewhere, name_string is still cached. I just can't figure out where. I've cleared the caches, restarted, etc etc. Thanks in advance for your help. Eric
Re: [web2py] Re: Changed field name in table def, database OK, but getting key error
Wrong thread?? On Thu, Aug 25, 2011 at 3:06 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Did you try grep (http://en.wikipedia.org/wiki/Grep)? On Aug 25, 12:53 pm, Eric Scott erictransla...@gmail.com wrote: I'm using postgresql. I had to change a field name in my table def, which are in the web2py models. The database changed accordingly, but now I get a key error when I try to insert a new record using appadmin. I made sure appadmin.py is the latest and greatest. Still getting key error. I don't dare drop the db since each time I've done that before I've not been able to get it running again, no matter how many variations of migrate and fake_migrate I tried. So end up having to re-create the app, and then copy in the files, which takes a long time. I love web2py but database issues are driving me nuts. Can someone please help me? My app is so close to finished. Here's the traceback Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 192, in restricted exec ccode in environment File /home/www-data/web2py/applications/baristacode/controllers/ appadmin.py, line 411, in module File /home/www-data/web2py/gluon/globals.py, line 145, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/baristacode/controllers/ appadmin.py, line 126, in insert form = SQLFORM(db[table], ignore_rw=ignore_rw) File /home/www-data/web2py/gluon/sqlhtml.py, line 830, in __init__ inp = self.widgets.options.widget(field, default) File /home/www-data/web2py/gluon/sqlhtml.py, line 218, in widget options = requires[0].options() File /home/www-data/web2py/gluon/validators.py, line 438, in options self.build_set() File /home/www-data/web2py/gluon/validators.py, line 421, in build_set fields = [self.dbset.db[self.ktable][k] for k in self.fields] File /home/www-data/web2py/gluon/dal.py, line 4675, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'name_string' By the way, I changed the field name from name_string to name. Somewhere, name_string is still cached. I just can't figure out where. I've cleared the caches, restarted, etc etc. Thanks in advance for your help. Eric
Re: [web2py] Re: fluxflex
Ray, I made it! I made repository light. Git filter-branch option is powerful. 2011/8/26 Ray (a.k.a. Iceberg) iceb...@21cn.com: Hi Yota, Thanks for your time. Hopefully these can help. [1] http://stackoverflow.com/questions/872565/how-do-i-remove-sensitive-files-from-gits-history [2] http://help.github.com/remove-sensitive-data/ Regards, Ray On Aug 26, 12:05 am, Yota Ichino www.i...@gmail.com wrote: You're right, Iceberg. Uh..., there is a issue. I don't know how to delete history in git. Could you tell me it? 2011/8/25 Ray (a.k.a. Iceberg) iceb...@21cn.com: That's a good merge. By the way, is it possible to completely remove the old master branch stuff? (This is actually a question for git.) Current repo still contains many web2py files in its history. This makes it a little bit unnecessary slow when cloning the repo. Regards, Ray On Aug 25, 2:36 am, Yota Ichino www.i...@gmail.com wrote: I merged get_new_stable branch into master branch.
[web2py] Re: Understanding Rocket Threads
Hi, Can you explain this a bit more? Is the idea to call session.forget(response) in my main controller, but not in the components that have forms in them? I had previously put the session.forget() line in the model file so it was always executed. Thanks On Aug 25, 11:42 am, Anthony abasta...@gmail.com wrote: If you don't explicitly forget the session, the session file will lock on each request, so subsequent requests will be blocked. Maybe you could forget the session on requests that don't need it and just keep it for requests that do need it (i.e., form submissions). Note, to immediately unlock the session file, you need to do session.forget(response), not just session.forget(). Anthony On Thursday, August 25, 2011 2:14:54 PM UTC-4, G wrote: I tried session.forget() but found that forms submitted by ajax in components don't seem to work without a session, so that won't work in my case. I also tried removing the SQLite db, it may have helped some but I'm still testing. Thanks again for the suggestions On Aug 24, 4:18 pm, Michele Comitini michele@gmail.com wrote: Try session.forget() and see what happens mic 2011/8/25 G glenn@gmail.com: Thank you for the suggestion. I made a test application that used no database accesses (no auth and randomly generated data). It showed the same behavior, so I do not think it is the culprit. In addition, since the application is monitor only, the real application only reads from the database, which I hope would not impose a transaction lock. G On Aug 24, 3:20 pm, ron_m ron.m...@gmail.com wrote: You also need to consider the database type used by the application for the model. The SQLite database has a transaction lock which will cause the application to look like it is single threaded if the database is held in a transaction pending state while the background work is performed.
[web2py] Re: Allowing provisional login with email only
Perhaps. But I would certainly advise respecting your users.
[web2py] Re: Understanding Rocket Threads
On Thursday, August 25, 2011 3:28:38 PM UTC-4, G wrote: Hi, Can you explain this a bit more? Is the idea to call session.forget(response) in my main controller, but not in the components that have forms in them? I had previously put the session.forget() line in the model file so it was always executed. Yes, you can put session.forget(response) anywhere (model, controller outside a function, controller inside a function). If you put it in a model file, you could make it conditional: session_actions = ['component_with_form1','component_with_form2',...] if not request.function in session_actions: session.forget(response) Anthony
Re: [web2py] Re: Changed field name in table def, database OK, but getting key error
Maybe he means use grep to see if 'name_string' is still somewhere in the application code. On Thursday, August 25, 2011 3:12:58 PM UTC-4, Richard wrote: Wrong thread?? On Thu, Aug 25, 2011 at 3:06 PM, Massimo Di Pierro massimo@gmail.comwrote: Did you try grep (http://en.wikipedia.org/wiki/Grep)? On Aug 25, 12:53 pm, Eric Scott erictra...@gmail.com wrote: I'm using postgresql. I had to change a field name in my table def, which are in the web2py models. The database changed accordingly, but now I get a key error when I try to insert a new record using appadmin. I made sure appadmin.py is the latest and greatest. Still getting key error. I don't dare drop the db since each time I've done that before I've not been able to get it running again, no matter how many variations of migrate and fake_migrate I tried. So end up having to re-create the app, and then copy in the files, which takes a long time. I love web2py but database issues are driving me nuts. Can someone please help me? My app is so close to finished. Here's the traceback Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 192, in restricted exec ccode in environment File /home/www-data/web2py/applications/baristacode/controllers/ appadmin.py, line 411, in module File /home/www-data/web2py/gluon/globals.py, line 145, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/baristacode/controllers/ appadmin.py, line 126, in insert form = SQLFORM(db[table], ignore_rw=ignore_rw) File /home/www-data/web2py/gluon/sqlhtml.py, line 830, in __init__ inp = self.widgets.options.widget(field, default) File /home/www-data/web2py/gluon/sqlhtml.py, line 218, in widget options = requires[0].options() File /home/www-data/web2py/gluon/validators.py, line 438, in options self.build_set() File /home/www-data/web2py/gluon/validators.py, line 421, in build_set fields = [self.dbset.db[self.ktable][k] for k in self.fields] File /home/www-data/web2py/gluon/dal.py, line 4675, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'name_string' By the way, I changed the field name from name_string to name. Somewhere, name_string is still cached. I just can't figure out where. I've cleared the caches, restarted, etc etc. Thanks in advance for your help. Eric
Re: [web2py] CRUD update in modal iframe
It would appear that I can supply an 'onaccept' argument on a crud.create that is a function or list of functions to be executed after the record is updated. Is there a way I could use this to change the 'target' on the form submission in the event of a successful update? Again, any help would really be appreciated. I'm pulling my hair out on this one... -Jim On 8/25/2011 10:10 AM, Jim Steil wrote: Ok, found what was causing the problem. On my page that I'm loading in my modal window I was specifying a different view. This view had: base target=_top ...in the head section. This caused all submits/re-displays to go to the parent to display. If I take it out it works as expected. However, now (as Bruno mentioned) when I submit my form the next url is loaded in the modal as well. I'm using CRUD in my modal window, how/where do I specify the window.parent.location='next url' as Bruno mentioned? Thanks again. -Jim On 8/25/2011 8:18 AM, Jim Steil wrote: Anthony and Bruno Thank you for your replies. I tried nyroModal but get the same results as with FancyBox (which I've been using). I am going to work up a simple app that shows my problem. Either that will show me where my problem lies or provide something simple for you to see the behavior I'm dealing with. Thanks again for the input. -Jim On 8/24/2011 6:13 PM, Bruno Rocha wrote: Your modal uses Iframe? nyroModal needs target='_blank' to open in iframe and work as you want. Other modal plugins has other ways for doing it. For redirect in parent window. You ll need to execute a javascript inside modal. window.parent.location = '' http://zerp.ly/rochacbruno Em 24/08/2011 17:55, Jim Steil j...@qlf.com mailto:j...@qlf.com escreveu: Hi I have a crud.update that I'm displaying in a modal iFrame. This is working fine for me except when there is an error in the form and crud redisplays with the error message. This is opening outside the iFrame when I want it to load inside the iFrame. But, on submit, the next url should load outside the iFrame. Make any sense? Any advice on where to look to get this working the way I want? -Jim
[web2py] Re: OWASP Top 10 web app vuln # 10
Please check trunk.
[web2py] Re: OWASP Top 10 web app vuln # 10
Syntax error: *or request.post_vars._next**:* Drop the colon at the end of that line. Actually, it's now short enough to get it all on one line: next = request.get_vars._next or request.post_vars._next Also, why isn't it just: next = request.vars._next Anthony On Thursday, August 25, 2011 6:57:22 PM UTC-4, Massimo Di Pierro wrote: Please check trunk.
[web2py] Re: Problem with Oracle access and web2py database administration
I did this, but am not sure what I'm looking for. This appears... function: select and last_query: db.auth_user.id0 for example, and lots of other settings, etc. But I don't see anything that looks like an actual SQL query. So, working with one of my colleagues, we added tracing to dal.py and got this SQL out... ('SELECT count(*) FROM auth_user WHERE (auth_user.id 0', []) We dug further into expand, thinking that was where the parenthesis was being omitted, but got lost in the layers. Hope this helps!
[web2py] routes.py
I'd like to have three types of routings: a) web2py.main_domain.comdefaults to init, but you can choose the application with web2py.main_domain.com b) testing.main_domain.com leads to application: testing c) development.main_domain.comleads to application: testing, controller:ticket and function: create_new is this possible? In the controller code, where do I see what domain is used to access the controller? If user goes to my application with user.domain.com where do I see the user.domain.com? Kenneth
[web2py] Re: routes.py
On Thursday, August 25, 2011 7:48:42 PM UTC-4, Kenneth wrote: In the controller code, where do I see what domain is used to access the controller? If user goes to my application with user.domain.com where do I see the user.domain.com? request.env.http_host Anthony
Re: [web2py] Re: Memory problems on Webfaction
On Wednesday, August 24, 2011 11:55:20 AM UTC-4, elffikk wrote: - please add my website (fermer.md) to web2py powered websites Done.
[web2py] Re: Changed field name in table def, database OK, but getting key error [SOLVED]
Perfect! This thread solved at least one major headache, and perhaps another even greater headache. Massimo, I'm embarrassed I had not tried grep. It worked. I found the string in the db_wizard_populate.py file. I used the wizard to quickly recreate my app's database structure when I couldn't get the migrate to work. And speaking of problems migrating, Richard may have provided me with the missing info I needed for migration. I knew that it was the auth tables that were problematic, but I was so busy trying to mix up migrate and fake_migrate True settings that I never thought to set them to migrate=False. I'll try that next time and see if it works. If that is a known issue, it would be nice to mention it in the next ed. of the book, next to the mysql migrate issues. Thanks to both of you. Now if I could only figure out how to set web2py command line parameters when using apache/mod_wsgi... Eric On Aug 25, 3:03 pm, Richard Vézina ml.richard.vez...@gmail.com wrote: Hello Eric, I would help, but I have no clue... Do you alternate between SQLite and Postgres? If yes, web2py always try to recreate the auth(s) tables that is a problem I often have... To solve it you must define the auth(s) tables in the db.py and set them to migrate=false... so web2py stop to trigger their creation each time... Richard On Thu, Aug 25, 2011 at 1:53 PM, Eric Scott erictransla...@gmail.comwrote: I'm using postgresql. I had to change a field name in my table def, which are in the web2py models. The database changed accordingly, but now I get a key error when I try to insert a new record using appadmin. I made sure appadmin.py is the latest and greatest. Still getting key error. I don't dare drop the db since each time I've done that before I've not been able to get it running again, no matter how many variations of migrate and fake_migrate I tried. So end up having to re-create the app, and then copy in the files, which takes a long time. I love web2py but database issues are driving me nuts. Can someone please help me? My app is so close to finished. Here's the traceback Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 192, in restricted exec ccode in environment File /home/www-data/web2py/applications/baristacode/controllers/ appadmin.py, line 411, in module File /home/www-data/web2py/gluon/globals.py, line 145, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/baristacode/controllers/ appadmin.py, line 126, in insert form = SQLFORM(db[table], ignore_rw=ignore_rw) File /home/www-data/web2py/gluon/sqlhtml.py, line 830, in __init__ inp = self.widgets.options.widget(field, default) File /home/www-data/web2py/gluon/sqlhtml.py, line 218, in widget options = requires[0].options() File /home/www-data/web2py/gluon/validators.py, line 438, in options self.build_set() File /home/www-data/web2py/gluon/validators.py, line 421, in build_set fields = [self.dbset.db[self.ktable][k] for k in self.fields] File /home/www-data/web2py/gluon/dal.py, line 4675, in __getitem__ return dict.__getitem__(self, str(key)) KeyError: 'name_string' By the way, I changed the field name from name_string to name. Somewhere, name_string is still cached. I just can't figure out where. I've cleared the caches, restarted, etc etc. Thanks in advance for your help. Eric
[web2py] Re: Problem creating forms inside a form.accepts
Thanks for the tip. That was exactly the problem. I have found I fix, it's not yet fully working but it's a work in progress. What I'm doing is running a loop of all available forms in the dictionary and trying to accept the request.vars for each of them. It's not very efficent though, so if anyone has a better idea I would really like to hear it. Thanks a lot Anthony. On 25 ago, 09:09, Anthony abasta...@gmail.com wrote: If I follow correctly, when someone submits a qty_form, the search form is not also being submitted, but because the qty_form.accepts is inside the form.accepts, it will never get to qty_form.accepts, because form.accepts will evaluate to False when a qty_form is submitted (I think). Even if form.accepts passed, though, it wouldn't fetch any product id because request.vars.search will be empty, so you still wouldn't get to qty_form.accepts. Anthony On Thursday, August 25, 2011 9:50:04 AM UTC-4, Francisco wrote: Thanks for the help. Here is the complete function defined in the controller: -- code for controller starts -- @auth.requires_login() def new_sale(): response.title=New sale if not session.cart: session.cart={} if not session.cart_qty: session.cart_qty={} if not session.qty_forms: session.qty_forms={} form = FORM(INPUT(_name=search, requires=IS_NOT_EMPTY()), INPUT(_type=submit, _value=Search),_name=form_search) if form.accepts(request.vars,session,formname=form_search): rows=db(db.products.barcode==request.vars.search).select() if len(rows) == 1: product = rows.first() if product.id in session.cart: session.cart_qty[product.id]+=1 session.qty_forms[product.id][0] ['_value']=session.cart_qty[product.id] else: session.cart[product.id]=product session.cart_qty[product.id]=1 qty_form=FORM(INPUT( _name=qty, _value=1), INPUT(_type=hidden, _name=prod_id,_value=product.id), INPUT(_type=submit,_value=T(Update),_style=display:none;), _name=formqty+str(product.id)) if qty_form.accepts(request.vars, session,formname=formqty+str(product.id)): session.cart_qty[request.vars.prod_id]+=1 temp_qty = session.cart_qty[request.vars.prod_id] session.qty_forms[request.vars.prod_id][0]['_value'] = temp_qty session.qty_forms[product.id]=qty_form return dict(form=form) -- code for controller ends -- Now this is the view code: -- code for view starts -- {{extend 'layout.html'}} h1Venta/h1 div id=buscar_codigo {{=form}} /div {{if len(session.cart)0:}} table class=data_table thead tr th scope=col class=a10pcCantidad/th th scope=col class=a10pcCodigo/th th scope=col class=a50pcProducto/th th scope=col class=a10pcPrecio/th th scope=col class=a10pcSub-Total/th th scope=col class=a10pcQuitar/th /tr /thead tbody {{i=0}} {{total=0}} {{for id, product in session.cart.iteritems():}} {{if i%2==1:}} tr class=impar {{else:}} tr {{pass}} !--So I basically read all the products in the cart (a dictionary) Each product must have a quantity form so the user can modify the amount of products sold.-- td{{=session.qty_forms[id]}}/td td{{=session.cart[id].codigo_de_barras}}/td td{{=session.cart[id].nombre}}/td td{{=session.cart[id].precio_de_venta}}/td td{{=session.cart[id].precio_de_venta*session.cart_qty[id]}}/td td/td /tr {{i+=1}} {{total +=session.cart[id].precio_de_venta*session.cart_qty[id]}} {{pass}} tfoot tr class=total_row th align=right colspan=3 class=totalstrongTotal/ strong/td th colspan=3 class=totalstrong{{=total}}/strong/ td /tr /tfoot /tbody /table {{pass}} -- code for view ends -- Hopefully this time indentation wont break. Any way as I already said the forms display correctly is just that the accept code doesn't. And my forms all have different names. Hope some one can give a hand. Thanks.
[web2py] Re: Passing web2py command line parameters when using apache/mod_wsgi
No one is passing the -N or -J parameter for external cron jobs in web2py who is also using apache/mod_wsgi? On Aug 25, 12:20 pm, Eric Scott erictransla...@gmail.com wrote: How to I pass command line parameters to web2py when I'm not starting web2py from the command line. I'm using apache and mod_wsgi. I've looked closely at the documentation, and there's a section on how to pass parameters when it's running as a windows service, but the documentation is clear that this only works when it's running as a windows service. I've found an external site that mentions that it's possible to pass command line parameters when using mod_wsgi, but it doesn't explain how. Also, is there a way to check my web2py parameters when I'm running it on apache? Thank you in advance. Eric
Re: [web2py] routes.py
On Aug 25, 2011, at 4:48 PM, Kenneth Lundström wrote: I'd like to have three types of routings: a) web2py.main_domain.comdefaults to init, but you can choose the application with web2py.main_domain.com b) testing.main_domain.com leads to application: testing c) development.main_domain.comleads to application: testing, controller:ticket and function: create_new is this possible? Not quite. The parametric router will come close, with something like this in the BASE router: default_application = init, domains = { testing.main_domain.com : testing, development.main_domain.com : testing/ticket, }, ...I think, but it does not yet support per-controller default functions. I have a patch for per-controller default functions in the works, but it's not quite ready.
[web2py] GAE deployment problem
So I've created a basic website that works on the web2py server, so I wanted to test it on the GAE, these are my steps so far: 1. read: http://web2py.com/book/default/chapter/11#Google-App-Engine 2. copied the app.example.yaml into my app.yaml and changed the id to the same id I used to create my app on GAE 3. Added the existing folder directory to GAE launcher 4. Run it, and it spits this out in the log: *** Running dev_appserver with the following flags: --admin_console_server= --port=8080 Python command: /usr/bin/python2.6 Warning: You are using a Python runtime (2.6) that is more recent than the production runtime environment (2.5). Your application may use features that are not available in the production environment and may not work correctly when deployed to production. WARNING 2011-08-26 03:22:33,391 datastore_file_stub.py:512] Could not read datastore data from /var/folders/t3/ yh6qg8x93q989_mdzgh9frd8gn/T/dev_appserver.datastore INFO 2011-08-26 03:22:33,392 rdbms_sqlite.py:58] Connecting to SQLite database '' with file '/var/folders/t3/ yh6qg8x93q989_mdzgh9frd8gn/T/dev_appserver.rdbms' WARNING 2011-08-26 03:22:33,396 dev_appserver.py:4748] Could not initialize images API; you are likely missing the Python PIL module. ImportError: No module named _imaging INFO 2011-08-26 03:22:33,405 dev_appserver_multiprocess.py:637] Running application selfemployedlist on port 8080: http://localhost:8080 5. clicked the browse button in GAE launcher and it spits back this: https://gist.github.com/1172615 6. deploy it to GAE and it prints this in the GAE launcher log: INFO 2011-08-26 03:24:12,743 dev_appserver_main.py:667] Server interrupted by user, terminating *** Running appfg.py with the following flags: --no_cookies --email=jcug...@gmail.com --passin update Application: selfemployedlist; version: 1 Host: appengine.google.com Starting update of app: selfemployedlist, version: 1 Scanning files on local disk. Cloning 30 static files. Cloning 135 application files. Cloned 100 files. Uploading 18 files and blobs. Uploaded 18 files and blobs Compilation starting. Compilation completed. Starting deployment. Checking if deployment succeeded. Will check again in 1 seconds. Checking if deployment succeeded. Will check again in 2 seconds. Checking if deployment succeeded. Will check again in 4 seconds. Checking if deployment succeeded. Deployment successful. Checking if updated app version is serving. Completed update of app: selfemployedlist, version: 1 Password for jcug...@gmail.com: If deploy fails you might need to 'rollback' manually. The Make Symlinks... menu option can help with command-line work. *** appcfg.py has finished with exit code 0 *** 7. Then view the version I just uploaded on GAE and it shows me this in the browser: Error: Server Error The server encountered an error and could not complete your request. If the problem persists, please report your problem and mention this error message and the query that caused it.
[web2py] Database performance
Hi, I'm new to web2py - first of all, thanks for such an excellent framework. It's certainly a breath of fresh air after writing J2EE webapps. Anyway, I'm building an application, part of which plots large datasets (using the JS Highstocks library). I've defined a table like this: db.define_table('Underway_Data', Field('UTCtime', 'datetime'), Field('waterTemp', 'double'), Field('waterTempQC', 'integer'), Field('latitude', 'double'), Field('latitudeQC', 'integer'), Field('longitude', 'double'), Field('longitudeQC', 'integer')) and populated it with data, about 175k rows (postgres on ubuntu, web2py is residing on the same server and setup using the 'one step production deployment' script) Running the database query: {{resolution=5}} {{query = (db.Underway_Data.id%resolution==0)}} {{dataSet = db(query)}} {{tic = time.clock()}} {{rows = dataSet.select()}} {{toc = time.clock()}} will take about 4.5 seconds (the resolution variable subsamples the data for performance reasons). While it is a fair amount of data to be pushing around, 4.5 seconds seems slow to me. I wrote a simple benchmark in pure python: import psycopg2, time tic = time.clock() conn = psycopg2.connect(host=ubuntu-geospatial-server user=postgres password= dbname=geospatial) cur = conn.cursor() cur.execute(SELECT Underway_Data.id, Underway_Data.UTCtime, Underway_Data.waterTemp, Underway_Data.waterTempQC, Underway_Data.latitude, Underway_Data.latitudeQC, Underway_Data.longitude, Underway_Data.longitudeQC FROM Underway_Data WHERE ((Underway_Data.id % 5) = 0);) rows = cur.fetchall() toc = time.clock() print toc-tic cur.close() conn.close() which runs in ~0.13 seconds. (the query I use is the output of db(query)._select() ) Am I missing something here? Is there anything I can do to increase performance? Regards, Hugh.
[web2py] Re: OWASP Top 10 web app vuln # 10
Because there have been situations when there was a _next both in post and get thus creating a list. On Aug 25, 6:29 pm, Anthony abasta...@gmail.com wrote: Syntax error: *or request.post_vars._next**:* Drop the colon at the end of that line. Actually, it's now short enough to get it all on one line: next = request.get_vars._next or request.post_vars._next Also, why isn't it just: next = request.vars._next Anthony On Thursday, August 25, 2011 6:57:22 PM UTC-4, Massimo Di Pierro wrote: Please check trunk.
[web2py] Re: Problem with Oracle access and web2py database administration
I think I fixed it. All but oracle expect SQL to be ; terminated. web2py adds the ; and removes it for Oracle. Because of a type it was not adding it so it was removing the last char thinking it was a ;. On Aug 25, 6:40 pm, Tim Korb jtk...@gmail.com wrote: I did this, but am not sure what I'm looking for. This appears... function: select and last_query: db.auth_user.id0 for example, and lots of other settings, etc. But I don't see anything that looks like an actual SQL query. So, working with one of my colleagues, we added tracing to dal.py and got this SQL out... ('SELECT count(*) FROM auth_user WHERE (auth_user.id 0', []) We dug further into expand, thinking that was where the parenthesis was being omitted, but got lost in the layers. Hope this helps!
[web2py] Re: GAE deployment problem
Check the GAE logs on the dashboard. On Aug 25, 10:32 pm, Jarrod Cugley jcug...@gmail.com wrote: So I've created a basic website that works on the web2py server, so I wanted to test it on the GAE, these are my steps so far: 1. read:http://web2py.com/book/default/chapter/11#Google-App-Engine 2. copied the app.example.yaml into my app.yaml and changed the id to the same id I used to create my app on GAE 3. Added the existing folder directory to GAE launcher 4. Run it, and it spits this out in the log: *** Running dev_appserver with the following flags: --admin_console_server= --port=8080 Python command: /usr/bin/python2.6 Warning: You are using a Python runtime (2.6) that is more recent than the production runtime environment (2.5). Your application may use features that are not available in the production environment and may not work correctly when deployed to production. WARNING 2011-08-26 03:22:33,391 datastore_file_stub.py:512] Could not read datastore data from /var/folders/t3/ yh6qg8x93q989_mdzgh9frd8gn/T/dev_appserver.datastore INFO 2011-08-26 03:22:33,392 rdbms_sqlite.py:58] Connecting to SQLite database '' with file '/var/folders/t3/ yh6qg8x93q989_mdzgh9frd8gn/T/dev_appserver.rdbms' WARNING 2011-08-26 03:22:33,396 dev_appserver.py:4748] Could not initialize images API; you are likely missing the Python PIL module. ImportError: No module named _imaging INFO 2011-08-26 03:22:33,405 dev_appserver_multiprocess.py:637] Running application selfemployedlist on port 8080:http://localhost:8080 5. clicked the browse button in GAE launcher and it spits back this:https://gist.github.com/1172615 6. deploy it to GAE and it prints this in the GAE launcher log: INFO 2011-08-26 03:24:12,743 dev_appserver_main.py:667] Server interrupted by user, terminating *** Running appfg.py with the following flags: --no_cookies --email=jcug...@gmail.com --passin update Application: selfemployedlist; version: 1 Host: appengine.google.com Starting update of app: selfemployedlist, version: 1 Scanning files on local disk. Cloning 30 static files. Cloning 135 application files. Cloned 100 files. Uploading 18 files and blobs. Uploaded 18 files and blobs Compilation starting. Compilation completed. Starting deployment. Checking if deployment succeeded. Will check again in 1 seconds. Checking if deployment succeeded. Will check again in 2 seconds. Checking if deployment succeeded. Will check again in 4 seconds. Checking if deployment succeeded. Deployment successful. Checking if updated app version is serving. Completed update of app: selfemployedlist, version: 1 Password for jcug...@gmail.com: If deploy fails you might need to 'rollback' manually. The Make Symlinks... menu option can help with command-line work. *** appcfg.py has finished with exit code 0 *** 7. Then view the version I just uploaded on GAE and it shows me this in the browser: Error: Server Error The server encountered an error and could not complete your request. If the problem persists, please report your problem and mention this error message and the query that caused it.
[web2py] Re: GAE deployment problem
Oh I didn't know GAE had logs too whoops. It gives me the warning: File referenced by handler not found: gaehandler.py Any idea what that means? On Aug 26, 1:58 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Check the GAE logs on the dashboard. On Aug 25, 10:32 pm, Jarrod Cugley jcug...@gmail.com wrote: So I've created a basic website that works on the web2py server, so I wanted to test it on the GAE, these are my steps so far: 1. read:http://web2py.com/book/default/chapter/11#Google-App-Engine 2. copied the app.example.yaml into my app.yaml and changed the id to the same id I used to create my app on GAE 3. Added the existing folder directory to GAE launcher 4. Run it, and it spits this out in the log: *** Running dev_appserver with the following flags: --admin_console_server= --port=8080 Python command: /usr/bin/python2.6 Warning: You are using a Python runtime (2.6) that is more recent than the production runtime environment (2.5). Your application may use features that are not available in the production environment and may not work correctly when deployed to production. WARNING 2011-08-26 03:22:33,391 datastore_file_stub.py:512] Could not read datastore data from /var/folders/t3/ yh6qg8x93q989_mdzgh9frd8gn/T/dev_appserver.datastore INFO 2011-08-26 03:22:33,392 rdbms_sqlite.py:58] Connecting to SQLite database '' with file '/var/folders/t3/ yh6qg8x93q989_mdzgh9frd8gn/T/dev_appserver.rdbms' WARNING 2011-08-26 03:22:33,396 dev_appserver.py:4748] Could not initialize images API; you are likely missing the Python PIL module. ImportError: No module named _imaging INFO 2011-08-26 03:22:33,405 dev_appserver_multiprocess.py:637] Running application selfemployedlist on port 8080:http://localhost:8080 5. clicked the browse button in GAE launcher and it spits back this:https://gist.github.com/1172615 6. deploy it to GAE and it prints this in the GAE launcher log: INFO 2011-08-26 03:24:12,743 dev_appserver_main.py:667] Server interrupted by user, terminating *** Running appfg.py with the following flags: --no_cookies --email=jcug...@gmail.com --passin update Application: selfemployedlist; version: 1 Host: appengine.google.com Starting update of app: selfemployedlist, version: 1 Scanning files on local disk. Cloning 30 static files. Cloning 135 application files. Cloned 100 files. Uploading 18 files and blobs. Uploaded 18 files and blobs Compilation starting. Compilation completed. Starting deployment. Checking if deployment succeeded. Will check again in 1 seconds. Checking if deployment succeeded. Will check again in 2 seconds. Checking if deployment succeeded. Will check again in 4 seconds. Checking if deployment succeeded. Deployment successful. Checking if updated app version is serving. Completed update of app: selfemployedlist, version: 1 Password for jcug...@gmail.com: If deploy fails you might need to 'rollback' manually. The Make Symlinks... menu option can help with command-line work. *** appcfg.py has finished with exit code 0 *** 7. Then view the version I just uploaded on GAE and it shows me this in the browser: Error: Server Error The server encountered an error and could not complete your request. If the problem persists, please report your problem and mention this error message and the query that caused it.
[web2py] Re: Database performance
Try by replacing {{rows = dataSet.select()}} with {{rows = db.executesql(dataSet._select())}} and tell me what get. Anyway, your raw sql select is only feting a third of the rows that that web2py is fetching. web2py is also doing a lot of extra work converting the list of records from tuples to dictionaries. On Aug 25, 9:48 pm, HughBarker hbar...@gmail.com wrote: Hi, I'm new to web2py - first of all, thanks for such an excellent framework. It's certainly a breath of fresh air after writing J2EE webapps. Anyway, I'm building an application, part of which plots large datasets (using the JS Highstocks library). I've defined a table like this: db.define_table('Underway_Data', Field('UTCtime', 'datetime'), Field('waterTemp', 'double'), Field('waterTempQC', 'integer'), Field('latitude', 'double'), Field('latitudeQC', 'integer'), Field('longitude', 'double'), Field('longitudeQC', 'integer')) and populated it with data, about 175k rows (postgres on ubuntu, web2py is residing on the same server and setup using the 'one step production deployment' script) Running the database query: {{resolution=5}} {{query = (db.Underway_Data.id%resolution==0)}} {{dataSet = db(query)}} {{tic = time.clock()}} {{rows = dataSet.select()}} {{toc = time.clock()}} will take about 4.5 seconds (the resolution variable subsamples the data for performance reasons). While it is a fair amount of data to be pushing around, 4.5 seconds seems slow to me. I wrote a simple benchmark in pure python: import psycopg2, time tic = time.clock() conn = psycopg2.connect(host=ubuntu-geospatial-server user=postgres password= dbname=geospatial) cur = conn.cursor() cur.execute(SELECT Underway_Data.id, Underway_Data.UTCtime, Underway_Data.waterTemp, Underway_Data.waterTempQC, Underway_Data.latitude, Underway_Data.latitudeQC, Underway_Data.longitude, Underway_Data.longitudeQC FROM Underway_Data WHERE ((Underway_Data.id % 5) = 0);) rows = cur.fetchall() toc = time.clock() print toc-tic cur.close() conn.close() which runs in ~0.13 seconds. (the query I use is the output of db(query)._select() ) Am I missing something here? Is there anything I can do to increase performance? Regards, Hugh.
Re: [web2py] Re: CAS Auth redirect loop
I ran in the same problem, I figured out that using custom auth tables in provider app make the client app to run in infinite loop. I also tried to include 'username' field to the custom Auth table but did not solve the problem. My custom Auth Table https://gist.github.com/1172687 ( I tried with username = True, but did not works) *then in the client app i have* auth = Auth(db,hmac_key=Auth.get_or_create_key(),cas_provider=' http://0.0.0.0:8000/tutor/default/user/cas') from gluon.contrib.login_methods.cas_auth import CasAuth auth.settings.login_form=CasAuth(globals(), urlbase = http://0.0.0.0:8000/tutor/default/user/cas;, actions=['login', 'validate', 'logout']) I got this as url: http://0.0.0.0:8000/tutor/default/user/cas/login?service=http://0.0.0.0:8000/client/default/user/login and the browser error: This webpage has a redirect loop The webpage at * http://0.0.0.0:8000/tutor/default/user/cas/login?service=http://0.0.0.0:8000/client/default/user/login * has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer. It is strange because I already use CAS in another apps, but this apps has default auth table and runs very well, I also created an adapter to bring groups and permissions from provider to client and stores in a kind of cache. The problem seems to be when using custom auth tables. Any clue?
Re: [web2py] routes.py
On 26.8.2011 5:21, Jonathan Lundell wrote: On Aug 25, 2011, at 4:48 PM, Kenneth Lundström wrote: I'd like to have three types of routings: a) web2py.main_domain.comdefaults to init, but you can choose the application with web2py.main_domain.com b) testing.main_domain.com leads to application: testing c) development.main_domain.comleads to application: testing, controller:ticket and function: create_new is this possible? Not quite. The parametric router will come close, with something like this in the BASE router: default_application = init, domains = { testing.main_domain.com : testing, development.main_domain.com : testing/ticket, }, ...I think, but it does not yet support per-controller default functions. Thanks Jonathan and Anthony. So to get as near as possible at the moment I could do: development.main_domain.com : testing/ticket_create_new, then create a new controller called ticket_create_new with a index function that does what my testing/ticket/create_new would have done? Kenneth I have a patch for per-controller default functions in the works, but it's not quite ready.
Re: [web2py] Re: CAS Auth redirect loop
Yes, I even created a custom table by copying the exact auth_user table from Auth.define_tables, and it still generated the redirect loop, so it doesn't appear to have anything to do with the particular fields or definition of the auth_user table -- just the fact that it is defined outside of define_tables(). It wasn't clear what was causing the loop in that case. Anthony On Friday, August 26, 2011 12:22:20 AM UTC-4, rochacbruno wrote: I ran in the same problem, I figured out that using custom auth tables in provider app make the client app to run in infinite loop. I also tried to include 'username' field to the custom Auth table but did not solve the problem. My custom Auth Table https://gist.github.com/1172687 ( I tried with username = True, but did not works) *then in the client app i have* auth = Auth(db,hmac_key=Auth.get_or_create_key(),cas_provider=' http://0.0.0.0:8000/tutor/default/user/cas') from gluon.contrib.login_methods.cas_auth import CasAuth auth.settings.login_form=CasAuth(globals(), urlbase = http://0.0.0.0:8000/tutor/default/user/cas;, actions=['login', 'validate', 'logout']) I got this as url: http://0.0.0.0:8000/tutor/default/user/cas/login?service=http://0.0.0.0:8000/client/default/user/login and the browser error: This webpage has a redirect loop The webpage at * http://0.0.0.0:8000/tutor/default/user/cas/login?service=http://0.0.0.0:8000/client/default/user/login * has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer. It is strange because I already use CAS in another apps, but this apps has default auth table and runs very well, I also created an adapter to bring groups and permissions from provider to client and stores in a kind of cache. The problem seems to be when using custom auth tables. Any clue?
[web2py] Re: OWASP Top 10 web app vuln # 10
Got it. On Thursday, August 25, 2011 11:45:59 PM UTC-4, Massimo Di Pierro wrote: Because there have been situations when there was a _next both in post and get thus creating a list. On Aug 25, 6:29 pm, Anthony abas...@gmail.com wrote: Syntax error: *or request.post_vars._next**:* Drop the colon at the end of that line. Actually, it's now short enough to get it all on one line: next = request.get_vars._next or request.post_vars._next Also, why isn't it just: next = request.vars._next Anthony On Thursday, August 25, 2011 6:57:22 PM UTC-4, Massimo Di Pierro wrote: Please check trunk.
Re: [web2py] Re: CAS Auth redirect loop
May be this url? http://0.0.0.0:8000/tutor/default/user/cas/login?service=http://0.0.0.0:8000/http://0.0.0.0:8000/tutor/default/user/cas/login?service=http://0.0.0.0:8000/client/default/user/login client/default/user/loginhttp://0.0.0.0:8000/tutor/default/user/cas/login?service=http://0.0.0.0:8000/client/default/user/login always redirect to /login On Fri, Aug 26, 2011 at 1:44 AM, Anthony abasta...@gmail.com wrote: Yes, I even created a custom table by copying the exact auth_user table from Auth.define_tables, and it still generated the redirect loop, so it doesn't appear to have anything to do with the particular fields or definition of the auth_user table -- just the fact that it is defined outside of define_tables(). It wasn't clear what was causing the loop in that case. Anthony On Friday, August 26, 2011 12:22:20 AM UTC-4, rochacbruno wrote: I ran in the same problem, I figured out that using custom auth tables in provider app make the client app to run in infinite loop. I also tried to include 'username' field to the custom Auth table but did not solve the problem. My custom Auth Table https://gist.github.com/**1172687 https://gist.github.com/1172687 ( I tried with username = True, but did not works) *then in the client app i have* auth = Auth(db,hmac_key=Auth.get_or_**create_key(),cas_provider='htt** p://0.0.0.0:8000/tutor/**default/user/cashttp://0.0.0.0:8000/tutor/default/user/cas ') from gluon.contrib.login_methods.**cas_auth import CasAuth auth.settings.login_form=**CasAuth(globals(), urlbase = http://0.0.0.0:8000/tutor/**default/user/cashttp://0.0.0.0:8000/tutor/default/user/cas, actions=['login', 'validate', 'logout']) I got this as url: http://0.0.0.0:8000/tutor/**default/user/cas/login?** service=http://0.0.0.0:8000/**client/default/user/loginhttp://0.0.0.0:8000/tutor/default/user/cas/login?service=http://0.0.0.0:8000/client/default/user/login and the browser error: This webpage has a redirect loop The webpage at *http://0.0.0.0:8000/tutor/default/user/cas/login? service=http://0.0.0.0:8000/client/default/user/login* has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer. It is strange because I already use CAS in another apps, but this apps has default auth table and runs very well, I also created an adapter to bring groups and permissions from provider to client and stores in a kind of cache. The problem seems to be when using custom auth tables. Any clue? -- -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] [ Aprenda a programar: http://CursoDePython.com.br ] [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] [ Consultoria em desenvolvimento web: http://www.blouweb.com ]
Re: [web2py] Re: CAS Auth redirect loop
Anthony, as your code looks more compact, an you open an issue? and link your example code? ( I would do it but my code is too large to paste in) On Fri, Aug 26, 2011 at 1:44 AM, Anthony abasta...@gmail.com wrote: Yes, I even created a custom table by copying the exact auth_user table from Auth.define_tables, and it still generated the redirect loop, so it doesn't appear to have anything to do with the particular fields or definition of the auth_user table -- just the fact that it is defined outside of define_tables(). It wasn't clear what was causing the loop in that case. Anthony On Friday, August 26, 2011 12:22:20 AM UTC-4, rochacbruno wrote: I ran in the same problem, I figured out that using custom auth tables in provider app make the client app to run in infinite loop. I also tried to include 'username' field to the custom Auth table but did not solve the problem. My custom Auth Table https://gist.github.com/**1172687 https://gist.github.com/1172687 ( I tried with username = True, but did not works) *then in the client app i have* auth = Auth(db,hmac_key=Auth.get_or_**create_key(),cas_provider='htt** p://0.0.0.0:8000/tutor/**default/user/cashttp://0.0.0.0:8000/tutor/default/user/cas ') from gluon.contrib.login_methods.**cas_auth import CasAuth auth.settings.login_form=**CasAuth(globals(), urlbase = http://0.0.0.0:8000/tutor/**default/user/cashttp://0.0.0.0:8000/tutor/default/user/cas, actions=['login', 'validate', 'logout']) I got this as url: http://0.0.0.0:8000/tutor/**default/user/cas/login?** service=http://0.0.0.0:8000/**client/default/user/loginhttp://0.0.0.0:8000/tutor/default/user/cas/login?service=http://0.0.0.0:8000/client/default/user/login and the browser error: This webpage has a redirect loop The webpage at *http://0.0.0.0:8000/tutor/default/user/cas/login? service=http://0.0.0.0:8000/client/default/user/login* has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer. It is strange because I already use CAS in another apps, but this apps has default auth table and runs very well, I also created an adapter to bring groups and permissions from provider to client and stores in a kind of cache. The problem seems to be when using custom auth tables. Any clue? -- -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] [ Aprenda a programar: http://CursoDePython.com.br ] [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] [ Consultoria em desenvolvimento web: http://www.blouweb.com ]
Re: [web2py] routes.py
On Aug 25, 2011, at 9:28 PM, Kenneth Lundström wrote: On 26.8.2011 5:21, Jonathan Lundell wrote: On Aug 25, 2011, at 4:48 PM, Kenneth Lundström wrote: I'd like to have three types of routings: a) web2py.main_domain.comdefaults to init, but you can choose the application with web2py.main_domain.com b) testing.main_domain.com leads to application: testing c) development.main_domain.comleads to application: testing, controller:ticket and function: create_new is this possible? Not quite. The parametric router will come close, with something like this in the BASE router: default_application = init, domains = { testing.main_domain.com : testing, development.main_domain.com : testing/ticket, }, ...I think, but it does not yet support per-controller default functions. Thanks Jonathan and Anthony. So to get as near as possible at the moment I could do: development.main_domain.com : testing/ticket_create_new, then create a new controller called ticket_create_new with a index function that does what my testing/ticket/create_new would have done? I think that should work. But there aren't corresponding unit tests, so there could be problems. Give it a try, and if it doesn't behave the way you think it should, let me know.
[web2py] Re: Database performance
Thanks for the reply. {{rows = db.executesql(dataSet._select())}} executes in 0.16s. On Aug 26, 2:09 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Try by replacing {{rows = dataSet.select()}} with {{rows = db.executesql(dataSet._select())}} and tell me what get. Anyway, your raw sql select is only feting a third of the rows that that web2py is fetching. web2py is also doing a lot of extra work converting the list of records from tuples to dictionaries. On Aug 25, 9:48 pm, HughBarker hbar...@gmail.com wrote: Hi, I'm new to web2py - first of all, thanks for such an excellent framework. It's certainly a breath of fresh air after writing J2EE webapps. Anyway, I'm building an application, part of which plots large datasets (using the JS Highstocks library). I've defined a table like this: db.define_table('Underway_Data', Field('UTCtime', 'datetime'), Field('waterTemp', 'double'), Field('waterTempQC', 'integer'), Field('latitude', 'double'), Field('latitudeQC', 'integer'), Field('longitude', 'double'), Field('longitudeQC', 'integer')) and populated it with data, about 175k rows (postgres on ubuntu, web2py is residing on the same server and setup using the 'one step production deployment' script) Running the database query: {{resolution=5}} {{query = (db.Underway_Data.id%resolution==0)}} {{dataSet = db(query)}} {{tic = time.clock()}} {{rows = dataSet.select()}} {{toc = time.clock()}} will take about 4.5 seconds (the resolution variable subsamples the data for performance reasons). While it is a fair amount of data to be pushing around, 4.5 seconds seems slow to me. I wrote a simple benchmark in pure python: import psycopg2, time tic = time.clock() conn = psycopg2.connect(host=ubuntu-geospatial-server user=postgres password= dbname=geospatial) cur = conn.cursor() cur.execute(SELECT Underway_Data.id, Underway_Data.UTCtime, Underway_Data.waterTemp, Underway_Data.waterTempQC, Underway_Data.latitude, Underway_Data.latitudeQC, Underway_Data.longitude, Underway_Data.longitudeQC FROM Underway_Data WHERE ((Underway_Data.id % 5) = 0);) rows = cur.fetchall() toc = time.clock() print toc-tic cur.close() conn.close() which runs in ~0.13 seconds. (the query I use is the output of db(query)._select() ) Am I missing something here? Is there anything I can do to increase performance? Regards, Hugh.
Re: [web2py] Re: Memory problems on Webfaction
thank yo Anthony :)
[web2py] Filtering dropdown
From the manual: subset=db(db.person.id100) db.dog.owner.requires = IS_IN_DB(db, 'person.id', '%(name)s', _and=IS_NOT_IN_DB(subset,'person.id')) Am I right in my interpretation that the dog.owner dropdown will only show person names who are not in the subset? Am trying to implement '_and' but it seems to be not working as I expected. Is this because the subset validation is not a filter function but rather as merely a check upon form submit?