Re: [web2py] Re: web2py database migration workflow
Thank you Dave! Hey!! The project have an issue about mercurial [1] and you can help a lot with sqlite too! You just need to follow developers guide that I wrote in README: There are dummy files inside folders version_control and databases. These dummy files are useful if you want to extend this project because all of needed functions are there to implement new database or version control support. If you need more help please send me PM by mail I will enhance README for developers and post here soon [1] https://github.com/dmvieira/web2py-migrate/issues/1 2014-09-02 16:47 GMT-03:00 Dave S snidely@gmail.com: On Saturday, August 30, 2014 9:15:37 PM UTC-7, Diogo Munaro wrote: Hey guys, I was thinking about web2py migrates and how control database version. I did a workflow that take care of database version control and it's extensible for a lot of version controls (like git or mercurial, but by now only git) and databases (by now only mysql and postgres, but extensible too). Looks interesting. I haven't worried too much about migrations yet because I dont' have a real production environment, but it certainly looks like it will be worth studying the flow chart, so I printed it out. I'm a Mercurial type myself, but I don't know how much testing I can help with. If I can, though, I will. (I'm also a sqlite type, though I've used Postgres in class.) This workflow could be useful with Continuous Integration environment. It's open for all kind of usage and is here for more information: https://github.com/dmvieira/web2py-migrate I'll love collaboration and feedback ;) Regards Thanks! /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/4z55wXvUq40/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: web2py database migration workflow
Hey guys, I updated developers readme: https://github.com/dmvieira/web2py-migrate/blob/master/README.md#for-developers 2014-09-02 17:29 GMT-03:00 Diogo Munaro diogo.mvie...@gmail.com: Thank you Dave! Hey!! The project have an issue about mercurial [1] and you can help a lot with sqlite too! You just need to follow developers guide that I wrote in README: There are dummy files inside folders version_control and databases. These dummy files are useful if you want to extend this project because all of needed functions are there to implement new database or version control support. If you need more help please send me PM by mail I will enhance README for developers and post here soon [1] https://github.com/dmvieira/web2py-migrate/issues/1 2014-09-02 16:47 GMT-03:00 Dave S snidely@gmail.com: On Saturday, August 30, 2014 9:15:37 PM UTC-7, Diogo Munaro wrote: Hey guys, I was thinking about web2py migrates and how control database version. I did a workflow that take care of database version control and it's extensible for a lot of version controls (like git or mercurial, but by now only git) and databases (by now only mysql and postgres, but extensible too). Looks interesting. I haven't worried too much about migrations yet because I dont' have a real production environment, but it certainly looks like it will be worth studying the flow chart, so I printed it out. I'm a Mercurial type myself, but I don't know how much testing I can help with. If I can, though, I will. (I'm also a sqlite type, though I've used Postgres in class.) This workflow could be useful with Continuous Integration environment. It's open for all kind of usage and is here for more information: https://github.com/dmvieira/web2py-migrate I'll love collaboration and feedback ;) Regards Thanks! /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/4z55wXvUq40/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] web2py database migration workflow
Hey guys, I was thinking about web2py migrates and how control database version. I did a workflow that take care of database version control and it's extensible for a lot of version controls (like git or mercurial, but by now only git) and databases (by now only mysql and postgres, but extensible too). This workflow could be useful with Continuous Integration environment. It's open for all kind of usage and is here for more information: https://github.com/dmvieira/web2py-migrate I'll love collaboration and feedback ;) Regards -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: MySQL will never migrate this way (not alter table problem)
Summary: We can't make some database migrates on MySQL because we can't DROP column with foreign key. Suggestions? Em segunda-feira, 18 de agosto de 2014 09h46min49s UTC-3, Diogo Munaro escreveu: Hey guys, I'm trying to do CI (continuous integration) on web2py application. I really need automatic database migration and web2py is really good with it, but using MySQL I notice that we have some caveats http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#MySQL : I can live without more than one alter table on migrations, but I can't without this other caveat that is not specified by web2py but is on mysql manual http://dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html: Setting foreign_key_checks to 0 can also be useful for ignoring foreign key constraints during LOAD DATA and ALTER TABLE operations. *However, even if foreign_key_checks = 0, MySQL does not permit the creation of a foreign key constraint where a column references a nonmatching column type*. Also, if a table has foreign key constraints, ALTER TABLE cannot be used to alter the table to use another storage engine. To change the storage engine, you must drop any foreign key constraints first. So, I can't drop a column without dropping it's foreign key constraints first, and I always get error 150 if I try. Now I'm migrating my database to Postgres, because web2py REALLY support migrations on it. Just look this citation inside postgres manual http://www.postgresql.org/docs/9.1/static/sql-altertable.html: *This form drops a column from a table. Indexes and table constraints involving the column will be automatically dropped as well.* You will need to say CASCADE if anything outside the table depends on the column, for example, foreign key references or views. If IF EXISTS is specified and the column does not exist, no error is thrown. In this case a notice is issued instead. What should we do to solve this issue with MySQL? A Stackoverflow question http://stackoverflow.com/questions/338978/mysql-innodb-need-to-delete-column-and-accompanying-foreign-key-constraint-a said that we should create a table replica, apply migrations on it and than migrate data. I don't know any other migrations solutions that do it on python. I think South have same problem because new Django 1.7 migration feature South-like have a lot of caveats: https://docs.djangoproject.com/en/dev/topics/migrations/ What do you think about make migrations as stackoverflow question suggest? ( http://stackoverflow.com/questions/338978/mysql-innodb-need-to-delete-column-and-accompanying-foreign-key-constraint-a ) Is there another way to do that with MySQL? Regards -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: web2py 2.6.4 mysql migration problem
You have a lot of indexes into one table Em segunda-feira, 23 de setembro de 2013 08h47min08s UTC-3, frasse escreveu: Hi All I try to follow migration recommendation for mysql in web2py 2.6.4 . as follow 1. I am setting migrate_enabled=False 2. everything is ok 3. length=255 to string Fields 4. everything is ok 5. re-enable migrations with migrate_enabled=True 6. application crash Here is Error Traceback (most recent call last): File /var/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /var/web2py/applications/myapp/models/db.py https://farzad.dipconnect.com/admin/default/edit/btcpirates/models/db.py, line 72, in module auth.define_tables() File /var/web2py/gluon/tools.py, line 1728, in define_tables format='%(first_name)s %(last_name)s (%(id)s)')) File /var/web2py/gluon/dal.py, line 7895, in define_table table = self.lazy_define_table(tablename,*fields,**args) File /var/web2py/gluon/dal.py, line 7932, in lazy_define_table polymodel=polymodel) File /var/web2py/gluon/dal.py, line 1029, in create_table fake_migrate=fake_migrate) File /var/web2py/gluon/dal.py, line 1136, in migrate_table self.execute(sub_query) File /var/web2py/gluon/dal.py, line 1833, in execute return self.log_execute(*a, **b) File /var/web2py/gluon/dal.py, line 1827, in log_execute ret = self.cursor.execute(command, *a[1:], **b) File /var/web2py/gluon/contrib/pymysql/cursors.py, line 117, in execute self.errorhandler(self, exc, value) File /var/web2py/gluon/contrib/pymysql/connections.py, line 202, in defaulterrorhandler raise errorclass, errorvalue InternalError: (1071, u'Specified key was too long; max key length is 767 bytes') any idea Thanks Frasse -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] MySQL will never migrate this way (not alter table problem)
Hey guys, I'm trying to do CI (continuous integration) on web2py application. I really need automatic database migration and web2py is really good with it, but using MySQL I notice that we have some caveats http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#MySQL : I can live without more than one alter table on migrations, but I can't without this other caveat that is not specified by web2py but is on mysql manual http://dev.mysql.com/doc/refman/5.6/en/create-table-foreign-keys.html: Setting foreign_key_checks to 0 can also be useful for ignoring foreign key constraints during LOAD DATA and ALTER TABLE operations. *However, even if foreign_key_checks = 0, MySQL does not permit the creation of a foreign key constraint where a column references a nonmatching column type*. Also, if a table has foreign key constraints, ALTER TABLE cannot be used to alter the table to use another storage engine. To change the storage engine, you must drop any foreign key constraints first. So, I can't drop a table without dropping it's foreign key constraints first, and I always get error 150 if I try. Now I'm migrating my database to Postgres, because web2py REALLY support migrations on it. Just look this citation inside postgres manual http://www.postgresql.org/docs/9.1/static/sql-altertable.html: *This form drops a column from a table. Indexes and table constraints involving the column will be automatically dropped as well.* You will need to say CASCADE if anything outside the table depends on the column, for example, foreign key references or views. If IF EXISTS is specified and the column does not exist, no error is thrown. In this case a notice is issued instead. What should we do to solve this issue with MySQL? A Stackoverflow question http://stackoverflow.com/questions/338978/mysql-innodb-need-to-delete-column-and-accompanying-foreign-key-constraint-a said that we should create a table replica, apply migrations on it and than migrate data. I don't know any other migrations solutions that do it on python. I think South have same problem because new Django 1.7 migration feature South-like have a lot of caveats: https://docs.djangoproject.com/en/dev/topics/migrations/ What do you think about make migrations as stackoverflow question suggest? ( http://stackoverflow.com/questions/338978/mysql-innodb-need-to-delete-column-and-accompanying-foreign-key-constraint-a ) Is there another way to do that with MySQL? Regards -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: AWS Elastic Beanstalk installation Recipe
It's working now with '3º fail' that I describe. I'm using fake_migrate_all with previews version and migrate with new version Thx for all helpers! Em quarta-feira, 9 de julho de 2014 19h00min33s UTC-3, Diogo Munaro escreveu: I'm with some problems here... I really hate .table files. That's my deploy routine: 1. download web2py from src 2. get my application from git and put inside web2py 3. remove some unused folders 4. backup my database 5. migrate my database structure with python web2py.py -S app -M -R anyscript.py *(that's the point!!)* 6. if ok, finished, else restore backup and last code 5 is my problem. I have a database structure and a lot of data but new code come with new table structure (that needs database migration). So I have some fails: - If I maintain .table files into databases folder on localhost, than the hash is different from production hash (because connection is different). Solution: rename .table files for new db._uri_hash (It's not so beautiful) - If I set migrate=False I need to do migrations setting sql into my mysql database (not good and I'm doing by now). - If I not mantain .table files I need fake_migrate from previews deploy and than migrate. Looks good but need a lot of extra work and I don't know if it work. What's the best way? Are there new suggestions? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: AWS Elastic Beanstalk installation Recipe
I'm with some problems here... I really hate .table files. That's my deploy routine: 1. download web2py from src 2. get my application from git and put inside web2py 3. remove some unused folders 4. backup my database 5. migrate my database structure *(that's the point!!)* 6. if ok, finished, else restore backup and last code 5 is my problem. I have a database structure and a lot of data but new code come with new table structure (that needs database migration). So I have some fails: - If I maintain .table files into databases folder on localhost, than the hash is different from production hash (because connection is different). Solution: rename .table files for new db._uri_hash (It's not so beautiful) - If I set migrate=False I need to do migrations setting sql into my mysql database (not good and I'm doing by now). - If I not mantain .table files I need fake_migrate from previews deploy and than migrate. Looks good but need a lot of extra work and I don't know if it work. What's the best way? Are there new suggestions? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: [web2py-users-brazil:6353] Is This Web2py
Nossa, parabéns a toda a equipe! Eles estão na comunidade? Em 10/06/2014 16:43, Ovidio Marinho ovidio...@gmail.com escreveu: http://sentibol.com/ Congratulations http://sentibol.com/ourteam Universidade de Lavras - Minas Gerais - Brasil. Ovidio Marinho Falcao Neto ITJP.NET.BR ovidio...@gmail.com itjp.net...@gmail.com Brasil -- Você recebeu essa mensagem por estar inscrito no grupo web2py-users-brazil. Para enviar uma mensagem ao grupo, envie email a: web2py-users-bra...@googlegroups.com Para se desinscrever, envie email a: web2py-users-brazil+unsubscr...@googlegroups.com Para mais opções, visite o site do grupo em: http://groups.google.com/group/web2py-users-brazil?hl=en --- Você recebeu essa mensagem porque está inscrito no grupo quot;web2py-users-brazil dos Grupos do Google. Para cancelar inscrição nesse grupo e parar de receber e-mails dele, envie um e-mail para web2py-users-brazil+unsubscr...@googlegroups.com. Para mais opções, acesse https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: AWS Elastic Beanstalk installation Recipe
Thx massimo... I will plain a deploy structure and then I'll post here. Perhaps web2py migration just need read database structure and view diff between database structure and model structure. Have you thought about that? It sound great for deploy! Couldn't be? 2014-05-27 1:26 GMT-03:00 Massimo Di Pierro massimo.dipie...@gmail.com: If migrate_enabled=False then .table files are ignored. You can use command line tools. If you create a applications/yourapp/DISABLED file, your app is temporarily disabled. If you run python web2py.py -S web2py -M -R anyscript.py your script anyscript.py will run as if it were a controller. On Monday, 26 May 2014 10:54:38 UTC-5, Diogo Munaro wrote: Thx Massimo, but I need other .tables inside deploy version? i.e: I have my production version with x db structure, but my new production version have x+1 db structure. I need x .tables inside my deploy? Could I make migrate without access page? Could I use any command line tools? 2014-05-26 12:40 GMT-03:00 Massimo Di Pierro massimo.dipie...@gmail.com : They are automatic in web2py. They only problem you may incur in is that if you have multiple web2py instances accessing the server, multiple instances may initiate the migrations concurrently. Normally you handle this at the application level. You set migrate_enabled=False and when you deploy a new version of the app you first disable the app (so users cannot access it during migration) then set migrate_enabled=True and after the migration is completed you restore migrate_enabled=False and and enable the app again to users. http://web2py.com/books/default/chapter/29/06/the- database-abstraction-layer?search=migrate_enabled%3DFalse On Saturday, 24 May 2014 10:47:38 UTC-5, Diogo Munaro wrote: But how could I manage migrates? How could I make migrates on deploy? Em 24/05/2014 04:02, Massimo Di Pierro massimo.dipie...@gmail.com escreveu: There is nothing equivalent to this in web2py. You just remove that line. On Thursday, 22 May 2014 12:43:59 UTC-5, Diogo Munaro wrote: Hey Massimo, and how could I replace command: django-admin.py syncdb --noinput ? I need migrate=False because I have a loadbalancer with elastic beanstalk Em quinta-feira, 25 de julho de 2013 11h45min05s UTC-3, Aladdin Teng escreveu: Thank you very much. On Thursday, July 25, 2013 8:53:33 PM UTC+8, Massimo Di Pierro wrote: The instructions should be almost identical except that: 1) you do not pip install Django 2) you do not ever call django-admin 3) instead you download and unzip web2py. The web2py folder plays the role of the mysite folder in the example 4) you do not edit any django config file (there is no django!) 5) instead you edit db.py and you replace db= DAL(...) with import os uri = “mysql://%(RDS_USERNAME)s:%(RDS_PASSWORD)s@%(RDS_HOSTNAME) s:%(RDS_PORT)s/%(RDS_DB_NAME)s” % os.environ db = DAL(uri, pool_size=10) session.connect(request, response db=db) # sessions in DB! 6) before you commit and push you must create a file web2py/application.py which contains FILE web2py/application.py import sys import os path = os.path.dirname(os.path.abspath(__file__)) os.chdir(path) sys.path = [path] + [p for p in sys.path if not p == path] sys.stdout = sys.stderr import gluon.main application = gluon.main.wsgibase FILE This should work. If you try it please post your findings. Caveat 1. You must get web2py from web2py_src.zip from the web site and not from the Git report else the web2py git repo will conflict with the git repo you are supposed to create according to this tutorial. Caveat 2. From:http://blog.uptill3.com/2 012/08/25/python-on-elastic-beanstalk.html It's critical to understand that the Elastic Beanstalk images are all ephemeral, in the 'old' style of AWS AMIs. This means that nothing on an instances filesystem will survive through a deployment, redeployment, or stoppage of the environment/instance. This means that session/tickets/uploads must all go to the file system. web2py admin will be useful. You also needs to setup sticky sessions and I am not sure whether AWS does it automatically or not. On Wednesday, 17 July 2013 11:14:20 UTC-5, Aladdin Teng wrote: Hi! Is there an update on this demo? I am looking into AWS deployment too. Thanks. On Saturday, October 13, 2012 9:52:03 AM UTC+8, Massimo Di Pierro wrote: I will try a demo asap but I do not have an account so it will take a tille time. In principle everything in eb is not django specific and should work with web2py almost out of them box. On Tuesday, 9 October 2012 11:42:35 UTC-5, CST International Mike wrote: Hi I trying to find an AWS Elastic Beanstalk Web2py installation recipe. Amazon have a Django version http://docs.amazonwebservices. com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html My Linux\web2py skill are a little weak and rusty. ( over a year now) Regards
Re: [web2py] Re: AWS Elastic Beanstalk installation Recipe
Thx Massimo, but I need other .tables inside deploy version? i.e: I have my production version with x db structure, but my new production version have x+1 db structure. I need x .tables inside my deploy? Could I make migrate without access page? Could I use any command line tools? 2014-05-26 12:40 GMT-03:00 Massimo Di Pierro massimo.dipie...@gmail.com: They are automatic in web2py. They only problem you may incur in is that if you have multiple web2py instances accessing the server, multiple instances may initiate the migrations concurrently. Normally you handle this at the application level. You set migrate_enabled=False and when you deploy a new version of the app you first disable the app (so users cannot access it during migration) then set migrate_enabled=True and after the migration is completed you restore migrate_enabled=False and and enable the app again to users. http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=migrate_enabled%3DFalse On Saturday, 24 May 2014 10:47:38 UTC-5, Diogo Munaro wrote: But how could I manage migrates? How could I make migrates on deploy? Em 24/05/2014 04:02, Massimo Di Pierro massimo.dipie...@gmail.com escreveu: There is nothing equivalent to this in web2py. You just remove that line. On Thursday, 22 May 2014 12:43:59 UTC-5, Diogo Munaro wrote: Hey Massimo, and how could I replace command: django-admin.py syncdb --noinput ? I need migrate=False because I have a loadbalancer with elastic beanstalk Em quinta-feira, 25 de julho de 2013 11h45min05s UTC-3, Aladdin Teng escreveu: Thank you very much. On Thursday, July 25, 2013 8:53:33 PM UTC+8, Massimo Di Pierro wrote: The instructions should be almost identical except that: 1) you do not pip install Django 2) you do not ever call django-admin 3) instead you download and unzip web2py. The web2py folder plays the role of the mysite folder in the example 4) you do not edit any django config file (there is no django!) 5) instead you edit db.py and you replace db= DAL(...) with import os uri = “mysql://%(RDS_USERNAME)s:%(RDS_PASSWORD)s@%(RDS_HOSTNAME)s: %(RDS_PORT)s/%(RDS_DB_NAME)s” % os.environ db = DAL(uri, pool_size=10) session.connect(request, response db=db) # sessions in DB! 6) before you commit and push you must create a file web2py/application.py which contains FILE web2py/application.py import sys import os path = os.path.dirname(os.path.abspath(__file__)) os.chdir(path) sys.path = [path] + [p for p in sys.path if not p == path] sys.stdout = sys.stderr import gluon.main application = gluon.main.wsgibase FILE This should work. If you try it please post your findings. Caveat 1. You must get web2py from web2py_src.zip from the web site and not from the Git report else the web2py git repo will conflict with the git repo you are supposed to create according to this tutorial. Caveat 2. From:http://blog.uptill3.com/2012/08/25/python-on-elastic- beanstalk.html It's critical to understand that the Elastic Beanstalk images are all ephemeral, in the 'old' style of AWS AMIs. This means that nothing on an instances filesystem will survive through a deployment, redeployment, or stoppage of the environment/instance. This means that session/tickets/uploads must all go to the file system. web2py admin will be useful. You also needs to setup sticky sessions and I am not sure whether AWS does it automatically or not. On Wednesday, 17 July 2013 11:14:20 UTC-5, Aladdin Teng wrote: Hi! Is there an update on this demo? I am looking into AWS deployment too. Thanks. On Saturday, October 13, 2012 9:52:03 AM UTC+8, Massimo Di Pierro wrote: I will try a demo asap but I do not have an account so it will take a tille time. In principle everything in eb is not django specific and should work with web2py almost out of them box. On Tuesday, 9 October 2012 11:42:35 UTC-5, CST International Mike wrote: Hi I trying to find an AWS Elastic Beanstalk Web2py installation recipe. Amazon have a Django version http://docs.amazonwebservices. com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html My Linux\web2py skill are a little weak and rusty. ( over a year now) Regards Michael -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/ topic/web2py/qR6tx0Sa6i0/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code
Re: [web2py] Re: AWS Elastic Beanstalk installation Recipe
But how could I manage migrates? How could I make migrates on deploy? Em 24/05/2014 04:02, Massimo Di Pierro massimo.dipie...@gmail.com escreveu: There is nothing equivalent to this in web2py. You just remove that line. On Thursday, 22 May 2014 12:43:59 UTC-5, Diogo Munaro wrote: Hey Massimo, and how could I replace command: django-admin.py syncdb --noinput ? I need migrate=False because I have a loadbalancer with elastic beanstalk Em quinta-feira, 25 de julho de 2013 11h45min05s UTC-3, Aladdin Teng escreveu: Thank you very much. On Thursday, July 25, 2013 8:53:33 PM UTC+8, Massimo Di Pierro wrote: The instructions should be almost identical except that: 1) you do not pip install Django 2) you do not ever call django-admin 3) instead you download and unzip web2py. The web2py folder plays the role of the mysite folder in the example 4) you do not edit any django config file (there is no django!) 5) instead you edit db.py and you replace db= DAL(...) with import os uri = “mysql://%(RDS_USERNAME)s:%(RDS_PASSWORD)s@%(RDS_HOSTNAME) s:%(RDS_PORT)s/%(RDS_DB_NAME)s” % os.environ db = DAL(uri, pool_size=10) session.connect(request, response db=db) # sessions in DB! 6) before you commit and push you must create a file web2py/application.py which contains FILE web2py/application.py import sys import os path = os.path.dirname(os.path.abspath(__file__)) os.chdir(path) sys.path = [path] + [p for p in sys.path if not p == path] sys.stdout = sys.stderr import gluon.main application = gluon.main.wsgibase FILE This should work. If you try it please post your findings. Caveat 1. You must get web2py from web2py_src.zip from the web site and not from the Git report else the web2py git repo will conflict with the git repo you are supposed to create according to this tutorial. Caveat 2. From:http://blog.uptill3.com/2012/08/25/python-on-elastic- beanstalk.html It's critical to understand that the Elastic Beanstalk images are all ephemeral, in the 'old' style of AWS AMIs. This means that nothing on an instances filesystem will survive through a deployment, redeployment, or stoppage of the environment/instance. This means that session/tickets/uploads must all go to the file system. web2py admin will be useful. You also needs to setup sticky sessions and I am not sure whether AWS does it automatically or not. On Wednesday, 17 July 2013 11:14:20 UTC-5, Aladdin Teng wrote: Hi! Is there an update on this demo? I am looking into AWS deployment too. Thanks. On Saturday, October 13, 2012 9:52:03 AM UTC+8, Massimo Di Pierro wrote: I will try a demo asap but I do not have an account so it will take a tille time. In principle everything in eb is not django specific and should work with web2py almost out of them box. On Tuesday, 9 October 2012 11:42:35 UTC-5, CST International Mike wrote: Hi I trying to find an AWS Elastic Beanstalk Web2py installation recipe. Amazon have a Django version http://docs.amazonwebservices. com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html My Linux\web2py skill are a little weak and rusty. ( over a year now) Regards Michael -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/qR6tx0Sa6i0/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: AWS Elastic Beanstalk installation Recipe
Hey Massimo, and how could I replace command: django-admin.py syncdb --noinput ? I need migrate=False because I have a loadbalancer with elastic beanstalk Em quinta-feira, 25 de julho de 2013 11h45min05s UTC-3, Aladdin Teng escreveu: Thank you very much. On Thursday, July 25, 2013 8:53:33 PM UTC+8, Massimo Di Pierro wrote: The instructions should be almost identical except that: 1) you do not pip install Django 2) you do not ever call django-admin 3) instead you download and unzip web2py. The web2py folder plays the role of the mysite folder in the example 4) you do not edit any django config file (there is no django!) 5) instead you edit db.py and you replace db= DAL(...) with import os uri = “mysql://%(RDS_USERNAME)s:%(RDS_PASSWORD)s@%(RDS_HOSTNAME)s:%(RDS_PORT)s/%(RDS_DB_NAME)s” % os.environ db = DAL(uri, pool_size=10) session.connect(request, response db=db) # sessions in DB! 6) before you commit and push you must create a file web2py/application.py which contains FILE web2py/application.py import sys import os path = os.path.dirname(os.path.abspath(__file__)) os.chdir(path) sys.path = [path] + [p for p in sys.path if not p == path] sys.stdout = sys.stderr import gluon.main application = gluon.main.wsgibase FILE This should work. If you try it please post your findings. Caveat 1. You must get web2py from web2py_src.zip from the web site and not from the Git report else the web2py git repo will conflict with the git repo you are supposed to create according to this tutorial. Caveat 2. From: http://blog.uptill3.com/2012/08/25/python-on-elastic-beanstalk.html It's critical to understand that the Elastic Beanstalk images are all ephemeral, in the 'old' style of AWS AMIs. This means that nothing on an instances filesystem will survive through a deployment, redeployment, or stoppage of the environment/instance. This means that session/tickets/uploads must all go to the file system. web2py admin will be useful. You also needs to setup sticky sessions and I am not sure whether AWS does it automatically or not. On Wednesday, 17 July 2013 11:14:20 UTC-5, Aladdin Teng wrote: Hi! Is there an update on this demo? I am looking into AWS deployment too. Thanks. On Saturday, October 13, 2012 9:52:03 AM UTC+8, Massimo Di Pierro wrote: I will try a demo asap but I do not have an account so it will take a tille time. In principle everything in eb is not django specific and should work with web2py almost out of them box. On Tuesday, 9 October 2012 11:42:35 UTC-5, CST International Mike wrote: Hi I trying to find an AWS Elastic Beanstalk Web2py installation recipe. Amazon have a Django version http://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html My Linux\web2py skill are a little weak and rusty. ( over a year now) Regards Michael -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Removing all tables filter_out. before_inset and before_update works?
Hi Anthony, thx for your help, I was using table inside lambda then table value was always the last table. Good point! I'll use as you said 2014-05-07 3:22 GMT-03:00 Anthony abasta...@gmail.com: You're already looping over the tables when you define your functions, so just use the table value from the loop in your lambda function definitions. Not tested, but maybe something like: def remove_filters(table): for field in table: field.filter_out = None for t in db.tables: db[t]._before_insert.insert(0, lambda f, table=db[t]: remove_filters( table)) db[t]._before_update.insert(0, lambda s, f, table=db[t]:remove_filters (table)) Instead, though, it might be worth figuring out why you're getting the errors and seeing if that can be fixed. Anthony On Wednesday, April 30, 2014 10:03:48 AM UTC-4, Diogo Munaro wrote: Hey guys! Nowadays I'm using a some filter_outs but they got update and insert erros on record versioning. I'm solving update issue using before_update like this: def remove_filter(s,field): field_obj = s.query.db[str(s.query).split('.')[0][1:]][field] field_obj.filter_out = '' for t in db.tables: db[t]._before_update.insert(0, lambda s, f: not [remove_filter(s, field) for field in f]) s.query.db is the returned db; str(s.query).split('.')[0][1:] is an ugly way to get table name field is the field_name. With update I got an ugly solution, but I got a solution. With insert I can't do it because before_insert don't have a Query object and I can't get table name Is there a better way to solve it and remove filter_outs before inserts and updates? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/hml1Oyi3tpg/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Removing all tables filter_out. before_inset and before_update works?
No answer? Em quarta-feira, 30 de abril de 2014 11h03min48s UTC-3, Diogo Munaro escreveu: Hey guys! Nowadays I'm using a some filter_outs but they got update and insert erros on record versioning. I'm solving update issue using before_update like this: def remove_filter(s,field): field_obj = s.query.db[str(s.query).split('.')[0][1:]][field] field_obj.filter_out = '' for t in db.tables: db[t]._before_update.insert(0, lambda s, f: not [remove_filter(s, field) for field in f]) s.query.db is the returned db; str(s.query).split('.')[0][1:] is an ugly way to get table name field is the field_name. With update I got an ugly solution, but I got a solution. With insert I can't do it because before_insert don't have a Query object and I can't get table name Is there a better way to solve it and remove filter_outs before inserts and updates? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Removing all tables filter_out. before_inset and before_update works?
Hey guys! Nowadays I'm using a some filter_outs but they got update and insert erros on record versioning. I'm solving update issue using before_update like this: def remove_filter(s,field): field_obj = s.query.db[str(s.query).split('.')[0][1:]][field] field_obj.filter_out = '' for t in db.tables: db[t]._before_update.insert(0, lambda s, f: not [remove_filter(s, field) for field in f]) s.query.db is the returned db; str(s.query).split('.')[0][1:] is an ugly way to get table name field is the field_name. With update I got an ugly solution, but I got a solution. With insert I can't do it because before_insert don't have a Query object and I can't get table name Is there a better way to solve it and remove filter_outs before inserts and updates? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: pyfilesystem support (store uploads in S3)
Hey guys! I know this topic is old, but here it's *working great* with mysql or sqlite on web2py 2.7.4. Just install: pip install fs Then on model: import fs.s3fs myfs = fs.s3fs.S3FS(bucket, prefix, aws_access_key, aws_secret_key) db.define_table('image',Field('image','upload',uploadfs = myfs)) I'm using ubuntu 12.04 amd64 with python 2.7.3 virtualenv. Thx for your help! Em sábado, 2 de junho de 2012 19h19min57s UTC-3, c h escreveu: i bet we could do something similar using the boto library on GAE. On Thursday, May 31, 2012 10:56:47 AM UTC-7, Massimo Di Pierro wrote: Here is an example: easy_install pyfilesystem import fs.s3fs myfs = fs.s3fs.S3FS(bucket, prefix, aws_access_ke, aws_secret_key) db.define_table('test',Field('file','upload',uploadfs = myfs)) Now all your uploaded files will go on S3. Here is a list of supported filesystems: http://packages.python.org/fs/filesystems.html WARNINGS: - needs testing. I have tested with OSFS and I am confident it works - I do not think with will work on GAE, should be tested - uploadfolder and uploadseparate are ignored when uploadfs is specified (this should be changed, any takers?) Should be possible to wrap myfs into an encryption layer but I have not done it yet. We may want a more comprehensive strategy and allow every web2py file (including apps, sessions, tickets, etc) to go into a pyfilesystem. Is this necessary? On linux one can mount filesystems in a folder anyway. Is this more trouble than it is worth? Massimo -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Web2py crash if i define model with function
Yes, thanks Michele! Omg, I was using web2py with apache. With the same code and using rocket server no errors occurs and the databases was created. I configured apache with web2py script. Someone knows whats happen? Anyway, now I can configure database with rocket than manage with apache. It's working now! I think some index makes apache/mysql crazy and returned this error: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. Traceback (most recent call last): File /var/www/sistema/gluon/main.py, line 550, in wsgibase BaseAdapter.close_all_instances('rollback') File /var/www/sistema/gluon/dal.py, line 558, in close_all_instances db._adapter.close(action) File /var/www/sistema/gluon/dal.py, line 538, in close getattr(self, action)() File /var/www/sistema/gluon/dal.py, line 1789, in rollback return self.connection.rollback() ProgrammingError: (2014, Commands out of sync; you can't run this command now) Thanks Michele, if I have some news I'll post here. I'll try using commits at each index creation. Em 12/11/2013 07:33, Michele Comitini michele.comit...@gmail.com escreveu: The error you sent seems to point to some statement that has not been properly closed. The commit/rollback happens in the middle of an open statement? That is what mysql seems to say. The problem could be earlier than when the error raises. Hard to say where. You could try to force db.commit/rollback in different places to see where you start see errors. 2013/11/12 Diogo Munaro diogo.mvie...@gmail.com The error continues, but without index :( The indexes are successful created 2013/11/11 Michele Comitini michele.comit...@gmail.com What happens if you remove the index creation inside the try/except block? 2013/11/11 Diogo Munaro diogo.mvie...@gmail.com It's not a simple function, but putting the model definition inside the function. Here the code: http://pastebin.com/rN7gvAT8 Attached the error ticket Em segunda-feira, 11 de novembro de 2013 08h34min44s UTC-2, Michele Comitini escreveu: If you define a function like def f(): pass in a model, you should have no problems. Just show us an extract of code that causes the problem, without violating any reserved information or IP. That way we can help you... mic Il giorno lunedì 11 novembre 2013 10:43:49 UTC+1, Diogo Munaro ha scritto: Hi guys, first the problem: I need some databases with identical structure, but with different data. These databases must be stored with the clients because they want (different locations), but the auth system is unique. So, my structure by now is: a centralized auth system and some disyributed databases. The centralized system controls access to other databases. Teoricaly web2py works great with it, because I defined a function that I pass connection string, access control db and its made a lot of databases replicas with foreign keys to access control database. Without the function it works great, but with, it make a complete first client database and then crash all of web2py. It returns a ciclic ticket error when I try access any application of that web2py, either Welcome application. Im using web2py 2.7.4 with mysql on ubuntu. So, whats happening? I cant define model with function. Oh, my function is in the same model file. BR, Diogo -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/_OnWZGMqkE0/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http
Re: [web2py] Re: Web2py crash if i define model with function
It's not working... 1- I tried pool_size with n = 2, 3, 6; 2- apache with prefork I just need to restart apache once a time when de database is created. It's really strange... but works... 2013/11/12 Michele Comitini michele.comit...@gmail.com Seem a threading issue. Try : 1) pass a pool_size=n option with different values of n 2) use preforking instead of threading in apache configuration 2013/11/12 Diogo Munaro diogo.mvie...@gmail.com Yes, thanks Michele! Omg, I was using web2py with apache. With the same code and using rocket server no errors occurs and the databases was created. I configured apache with web2py script. Someone knows whats happen? Anyway, now I can configure database with rocket than manage with apache. It's working now! I think some index makes apache/mysql crazy and returned this error: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. Traceback (most recent call last): File /var/www/sistema/gluon/main.py, line 550, in wsgibase BaseAdapter.close_all_instances('rollback') File /var/www/sistema/gluon/dal.py, line 558, in close_all_instances db._adapter.close(action) File /var/www/sistema/gluon/dal.py, line 538, in close getattr(self, action)() File /var/www/sistema/gluon/dal.py, line 1789, in rollback return self.connection.rollback() ProgrammingError: (2014, Commands out of sync; you can't run this command now) Thanks Michele, if I have some news I'll post here. I'll try using commits at each index creation. Em 12/11/2013 07:33, Michele Comitini michele.comit...@gmail.com escreveu: The error you sent seems to point to some statement that has not been properly closed. The commit/rollback happens in the middle of an open statement? That is what mysql seems to say. The problem could be earlier than when the error raises. Hard to say where. You could try to force db.commit/rollback in different places to see where you start see errors. 2013/11/12 Diogo Munaro diogo.mvie...@gmail.com The error continues, but without index :( The indexes are successful created 2013/11/11 Michele Comitini michele.comit...@gmail.com What happens if you remove the index creation inside the try/except block? 2013/11/11 Diogo Munaro diogo.mvie...@gmail.com It's not a simple function, but putting the model definition inside the function. Here the code: http://pastebin.com/rN7gvAT8 Attached the error ticket Em segunda-feira, 11 de novembro de 2013 08h34min44s UTC-2, Michele Comitini escreveu: If you define a function like def f(): pass in a model, you should have no problems. Just show us an extract of code that causes the problem, without violating any reserved information or IP. That way we can help you... mic Il giorno lunedì 11 novembre 2013 10:43:49 UTC+1, Diogo Munaro ha scritto: Hi guys, first the problem: I need some databases with identical structure, but with different data. These databases must be stored with the clients because they want (different locations), but the auth system is unique. So, my structure by now is: a centralized auth system and some disyributed databases. The centralized system controls access to other databases. Teoricaly web2py works great with it, because I defined a function that I pass connection string, access control db and its made a lot of databases replicas with foreign keys to access control database. Without the function it works great, but with, it make a complete first client database and then crash all of web2py. It returns a ciclic ticket error when I try access any application of that web2py, either Welcome application. Im using web2py 2.7.4 with mysql on ubuntu. So, whats happening? I cant define model with function. Oh, my function is in the same model file. BR, Diogo -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/_OnWZGMqkE0/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book
Re: [web2py] Re: Web2py crash if i define model with function
Hey Michele! Now it's working... The indexes are crashing web2py on apache. With a list of indexes I can execute sql in a for: for i in indices: try: db.executesql(i) except:pass Thx for all help! 2013/11/12 Diogo Munaro diogo.mvie...@gmail.com It's not working... 1- I tried pool_size with n = 2, 3, 6; 2- apache with prefork I just need to restart apache once a time when de database is created. It's really strange... but works... 2013/11/12 Michele Comitini michele.comit...@gmail.com Seem a threading issue. Try : 1) pass a pool_size=n option with different values of n 2) use preforking instead of threading in apache configuration 2013/11/12 Diogo Munaro diogo.mvie...@gmail.com Yes, thanks Michele! Omg, I was using web2py with apache. With the same code and using rocket server no errors occurs and the databases was created. I configured apache with web2py script. Someone knows whats happen? Anyway, now I can configure database with rocket than manage with apache. It's working now! I think some index makes apache/mysql crazy and returned this error: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. Traceback (most recent call last): File /var/www/sistema/gluon/main.py, line 550, in wsgibase BaseAdapter.close_all_instances('rollback') File /var/www/sistema/gluon/dal.py, line 558, in close_all_instances db._adapter.close(action) File /var/www/sistema/gluon/dal.py, line 538, in close getattr(self, action)() File /var/www/sistema/gluon/dal.py, line 1789, in rollback return self.connection.rollback() ProgrammingError: (2014, Commands out of sync; you can't run this command now) Thanks Michele, if I have some news I'll post here. I'll try using commits at each index creation. Em 12/11/2013 07:33, Michele Comitini michele.comit...@gmail.com escreveu: The error you sent seems to point to some statement that has not been properly closed. The commit/rollback happens in the middle of an open statement? That is what mysql seems to say. The problem could be earlier than when the error raises. Hard to say where. You could try to force db.commit/rollback in different places to see where you start see errors. 2013/11/12 Diogo Munaro diogo.mvie...@gmail.com The error continues, but without index :( The indexes are successful created 2013/11/11 Michele Comitini michele.comit...@gmail.com What happens if you remove the index creation inside the try/except block? 2013/11/11 Diogo Munaro diogo.mvie...@gmail.com It's not a simple function, but putting the model definition inside the function. Here the code: http://pastebin.com/rN7gvAT8 Attached the error ticket Em segunda-feira, 11 de novembro de 2013 08h34min44s UTC-2, Michele Comitini escreveu: If you define a function like def f(): pass in a model, you should have no problems. Just show us an extract of code that causes the problem, without violating any reserved information or IP. That way we can help you... mic Il giorno lunedì 11 novembre 2013 10:43:49 UTC+1, Diogo Munaro ha scritto: Hi guys, first the problem: I need some databases with identical structure, but with different data. These databases must be stored with the clients because they want (different locations), but the auth system is unique. So, my structure by now is: a centralized auth system and some disyributed databases. The centralized system controls access to other databases. Teoricaly web2py works great with it, because I defined a function that I pass connection string, access control db and its made a lot of databases replicas with foreign keys to access control database. Without the function it works great, but with, it make a complete first client database and then crash all of web2py. It returns a ciclic ticket error when I try access any application of that web2py, either Welcome application. Im using web2py 2.7.4 with mysql on ubuntu. So, whats happening? I cant define model with function. Oh, my function is in the same model file. BR, Diogo -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https
[web2py] Web2py crash if i define model with function
Hi guys, first the problem: I need some databases with identical structure, but with different data. These databases must be stored with the clients because they want (different locations), but the auth system is unique. So, my structure by now is: a centralized auth system and some disyributed databases. The centralized system controls access to other databases. Teoricaly web2py works great with it, because I defined a function that I pass connection string, access control db and its made a lot of databases replicas with foreign keys to access control database. Without the function it works great, but with, it make a complete first client database and then crash all of web2py. It returns a ciclic ticket error when I try access any application of that web2py, either Welcome application. Im using web2py 2.7.4 with mysql on ubuntu. So, whats happening? I cant define model with function. Oh, my function is in the same model file. BR, Diogo -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Web2py crash if i define model with function
The error continues, but without index :( The indexes are successful created 2013/11/11 Michele Comitini michele.comit...@gmail.com What happens if you remove the index creation inside the try/except block? 2013/11/11 Diogo Munaro diogo.mvie...@gmail.com It's not a simple function, but putting the model definition inside the function. Here the code: http://pastebin.com/rN7gvAT8 Attached the error ticket Em segunda-feira, 11 de novembro de 2013 08h34min44s UTC-2, Michele Comitini escreveu: If you define a function like def f(): pass in a model, you should have no problems. Just show us an extract of code that causes the problem, without violating any reserved information or IP. That way we can help you... mic Il giorno lunedì 11 novembre 2013 10:43:49 UTC+1, Diogo Munaro ha scritto: Hi guys, first the problem: I need some databases with identical structure, but with different data. These databases must be stored with the clients because they want (different locations), but the auth system is unique. So, my structure by now is: a centralized auth system and some disyributed databases. The centralized system controls access to other databases. Teoricaly web2py works great with it, because I defined a function that I pass connection string, access control db and its made a lot of databases replicas with foreign keys to access control database. Without the function it works great, but with, it make a complete first client database and then crash all of web2py. It returns a ciclic ticket error when I try access any application of that web2py, either Welcome application. Im using web2py 2.7.4 with mysql on ubuntu. So, whats happening? I cant define model with function. Oh, my function is in the same model file. BR, Diogo -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/_OnWZGMqkE0/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] aplicação com calculo de campos
Sorry guys, I thought was the portuguese group Em 04/11/2013 18:55, Niphlod niph...@gmail.com escreveu: BTW, this is the english web2py-user group. Please keep posts in English lately there are a lot of messages coming in in Portuguese and those are starting to be too many to be an oversight :-P On Monday, November 4, 2013 12:08:48 PM UTC+1, viniciusban wrote: Hermano, vale lembrar que Web2py é um framework para desenvolvimento de aplicações web. Sendo assim, temos à nossa disposição a infraestrutura para programadores trabalharem. O Web2py não é: - um CMS - um conjunto de componentes com regras de negócio Talvez você esteja procurando algum sistema iniciado ou já pronto. 2013/11/4 Diogo Munaro diogo@gmail.com: Usa o openerp Em 03/11/2013 14:08, Hermano Ponce mangab...@gmail.com escreveu: Valeu Diogo. Já procurei por ali. Web2py é muito ágil e bom pra algumas coisas mas tem suas limitações. Estou a procura de App tipo estoque de produtos. Mesmo valeu e estamos aí. Em 03/11/2013 10:37, Diogo Munaro diogo@gmail.com escreveu: Oi Hermano, tem alguns exemplos aqui de aplicações: http://www.web2py.com/appliances Veja o que mais se parece com o que deseja. Abraços! Em 2 de novembro de 2013 17:00, Ovidio Marinho ovid...@gmail.com escreveu: Hermano boa tarde faz isso no python: a =0 b =1 c=2 a=b+c e ve o resultado. Ovidio Marinho Falcao Neto ITJP.NET.BR ovid...@gmail.com Brasil 2013/11/2 Hermano Ponce mangab...@gmail.com Alguém pode disponibilizar uma app que tenha cálculos entre campos. por exemplo: campo A * campo B = campo C oucampo A + campo B = campo C. App tipo estoque de produtos. Quero somente um exemplo da aplicação. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/_w0TDXKusaY/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py
Re: [web2py] Javascript event onchange with Calendar
Hi josé, you tried handle onchange with jquery on function? Phehaps some js after declared is changing you handle. So, try: $(item).on(change, function(){}); Em 05/11/2013 15:52, José Luis Redrejo jredr...@gmail.com escreveu: Hi, I'm having problems with the Calendar used for date fields in an SQLFORM. In the web page, the javascript onchange does never happen (tested with Firefox and Google chrome). Other events like click or focusout works correctly, and other fields with other text input widgets work correctly too. Is there any way to handle when the user changes the date after clicking on a calendar day? Thanks José L. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] How to build a SQLFORM for relational database? Beginner in need of help.
Form = SQLFORM.factory(db.author,db.link,db.post) if form.process().accepted: ... return dict(form=form) Em 05/11/2013 14:59, Noah knudsenn...@gmail.com escreveu: I have a relational database structure containing 3 tables, set up in the model as follows: db.define_table('author', Field('name', 'string'), Field('bio', 'text')) db.define_table('link', Field('name', 'string'), Field('description', 'text')) db.define_table('post', Field('body','text',label=Post Body), Field('authorID', db.author), Field('linkID', db.link), Field('posted_on','datetime',readable=False,writable=False), Field('posted_by','reference auth_user',readable=False,writable=False)) I want to create a form that allows the user to submit a Post using the following inputs: - Post Body -(db.post.body) - Author Name -(db.author.name) - Link Name -(db.link.name) If the author name or link name already exists in the database, it doesn't need adding to that table again. Instead the post should just be inserted using the existing IDs. I'm way over my head on this one.. I'm just learning Web2Py. Thanks for any help! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Javascript event onchange with Calendar
No jose, try use .on instead of .change as the example Em 05/11/2013 16:19, José Luis Redrejo jredr...@gmail.com escreveu: 2013/11/5 Diogo Munaro diogo.mvie...@gmail.com: Hi josé, you tried handle onchange with jquery on function? Phehaps some js after declared is changing you handle. So, try: $(item).on(change, function(){}); Yes, and it doesn't work. In fact this is part of my code: jQuery(#CabeceraEntrada_Fecha).change(function() { set_parametros('fecha',jQuery(this)); }); jQuery(#CabeceraEntrada_tipoProcedencia).change(function() { set_parametros('procedencia',jQuery(this)); }); jQuery('#CabeceraEntrada_Codigo').change(function(){ set_parametros('codigo',jQuery(this)); }); #CabeceraEntrada_Codigo is a normal text input (integer datafield), #CabeceraEntrada_tipoProcedencia is a select (IS_IN_SET datafield requirement) and #CabeceraEntrada_Fecha is a text input with calendar (date datafield). With the same code, they all execute set_parametros function, excepting #CabeceraEntrada_Fecha Em 05/11/2013 15:52, José Luis Redrejo jredr...@gmail.com escreveu: Hi, I'm having problems with the Calendar used for date fields in an SQLFORM. In the web page, the javascript onchange does never happen (tested with Firefox and Google chrome). Other events like click or focusout works correctly, and other fields with other text input widgets work correctly too. Is there any way to handle when the user changes the date after clicking on a calendar day? Thanks José L. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] how do i return several rows from json using ajax?
Try: return response.json(yourjson) Em 03/11/2013 08:13, Ricardo Pedroso rmdpedr...@gmail.com escreveu: Try change the response content-type, see below: On Sun, Nov 3, 2013 at 6:28 AM, Mihir Lade lade.mi...@gmail.com wrote: hi, i have a function in a controller which queries the database if the user is logged in and then grabs the information using json (as below) def pruchaseHistoryJson(): if auth.user: rows = db(db.sale.auth_id == auth.user.id ).select(db.sale.title, db.sale.price, db.sale.shipping_address, db.sale.shipping_state, db.sale.shipping_city, db.sale.shipping_zip_code) else: redirect(URL('default', 'user/login')) response.headers['Content-Type'] = 'application/json' import gluon.contrib.simplejson as json prodHistory = json.dumps([{'name': i.title, 'prodValue':i.price, 'shipAdd':i.shipping_address, 'shipCity':i.shipping_city, 'shipState':i.shipping_state, 'shipCode':i.shipping_zip_code} for i in rows]) return prodHistory Also note that json top level arrays are not recommended: http://haacked.com/archive/2009/06/25/json-hijacking.aspx http://security.stackexchange.com/questions/7001/how-should-web-app-developers-defend-against-json-hijacking -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] aplicação com calculo de campos
Usa o openerp Em 03/11/2013 14:08, Hermano Ponce mangabeir...@gmail.com escreveu: Valeu Diogo. Já procurei por ali. Web2py é muito ágil e bom pra algumas coisas mas tem suas limitações. Estou a procura de App tipo estoque de produtos. Mesmo valeu e estamos aí. Em 03/11/2013 10:37, Diogo Munaro diogo.mvie...@gmail.com escreveu: Oi Hermano, tem alguns exemplos aqui de aplicações: http://www.web2py.com/appliances Veja o que mais se parece com o que deseja. Abraços! Em 2 de novembro de 2013 17:00, Ovidio Marinho ovidio...@gmail.comescreveu: Hermano boa tarde faz isso no python: a =0 b =1 c=2 a=b+c e ve o resultado. Ovidio Marinho Falcao Neto ITJP.NET.BR ovidio...@gmail.com Brasil 2013/11/2 Hermano Ponce mangabeir...@gmail.com Alguém pode disponibilizar uma app que tenha cálculos entre campos. por exemplo: campo A * campo B = campo C oucampo A + campo B = campo C. App tipo estoque de produtos. Quero somente um exemplo da aplicação. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/_w0TDXKusaY/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] IS_DATE validate and internationalization
Hi, I'm using web2py 2.7.2 and date fields on DAL are translating your validate. Example: I have in model: product = db.define_table('product', Field('expiration','date')) db.product.expiration.requires = IS_DATE(format('%Y-%m-%d')) T.force(None) When I insert a date like this: *2013-11-19* - If my browser is in english language: It's ok and insert in database - If my browser is in brazilian portuguese language: The form returns a error like this: *enter date as 28-08-1963* How could I force the format -MM-DD? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] IS_DATE validate and internationalization
No, the problem is that the form get accepted only if the browser language is english. Otherwise, if the browser is in portuguese it's change the validation to DD-MM-, but I don't want I don't want T or internalizations 2013/11/4 Richard Vézina ml.richard.vez...@gmail.com Are you talking about the error message? This should work : IS_DATE(format=T('%Y-%m-%d'), error_message=T('Valid date of format : -MM-DD')) Notice the T() above... Richard On Mon, Nov 4, 2013 at 10:19 AM, Diogo Munaro diogo.mvie...@gmail.comwrote: Hi, I'm using web2py 2.7.2 and date fields on DAL are translating your validate. Example: I have in model: product = db.define_table('product', Field('expiration','date')) db.product.expiration.requires = IS_DATE(format('%Y-%m-%d')) T.force(None) When I insert a date like this: *2013-11-19* - If my browser is in english language: It's ok and insert in database - If my browser is in brazilian portuguese language: The form returns a error like this: *enter date as 28-08-1963* How could I force the format -MM-DD? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] IS_DATE validate and internationalization
Thx for help Richard, but the problem persist It should be a bug or there is a trick? 2013/11/4 Diogo Munaro diogo.mvie...@gmail.com No, the problem is that the form get accepted only if the browser language is english. Otherwise, if the browser is in portuguese it's change the validation to DD-MM-, but I don't want I don't want T or internalizations 2013/11/4 Richard Vézina ml.richard.vez...@gmail.com Are you talking about the error message? This should work : IS_DATE(format=T('%Y-%m-%d'), error_message=T('Valid date of format : -MM-DD')) Notice the T() above... Richard On Mon, Nov 4, 2013 at 10:19 AM, Diogo Munaro diogo.mvie...@gmail.comwrote: Hi, I'm using web2py 2.7.2 and date fields on DAL are translating your validate. Example: I have in model: product = db.define_table('product', Field('expiration','date')) db.product.expiration.requires = IS_DATE(format('%Y-%m-%d')) T.force(None) When I insert a date like this: *2013-11-19* - If my browser is in english language: It's ok and insert in database - If my browser is in brazilian portuguese language: The form returns a error like this: *enter date as 28-08-1963* How could I force the format -MM-DD? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] IS_DATE validate and internationalization
Great! It's working now!! I removed all translations files except default.py. Now it's working. Thx Vinicius! 2013/11/4 Vinicius Assef vinicius...@gmail.com Create a new string and use it. IS_DATE() translates the string you send to it, as you can see in the source code [1]. So, you need to create another string will be translated to your desired format. Something like this: db.product.expiration.requires = IS_DATE(format(Y-m-d)) and in translation file, put: Y-m-d: %Y-%m-%d This is not a bug. It's designed to work this way. [1] https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2229 On Mon, Nov 4, 2013 at 2:11 PM, Diogo Munaro diogo.mvie...@gmail.com wrote: No, the problem is that the form get accepted only if the browser language is english. Otherwise, if the browser is in portuguese it's change the validation to DD-MM-, but I don't want I don't want T or internalizations 2013/11/4 Richard Vézina ml.richard.vez...@gmail.com Are you talking about the error message? This should work : IS_DATE(format=T('%Y-%m-%d'), error_message=T('Valid date of format : -MM-DD')) Notice the T() above... Richard On Mon, Nov 4, 2013 at 10:19 AM, Diogo Munaro diogo.mvie...@gmail.com wrote: Hi, I'm using web2py 2.7.2 and date fields on DAL are translating your validate. Example: I have in model: product = db.define_table('product', Field('expiration','date')) db.product.expiration.requires = IS_DATE(format('%Y-%m-%d')) T.force(None) When I insert a date like this: 2013-11-19 If my browser is in english language: It's ok and insert in database If my browser is in brazilian portuguese language: The form returns a error like this: enter date as 28-08-1963 How could I force the format -MM-DD? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] aplicação com calculo de campos
Oi Hermano, tem alguns exemplos aqui de aplicações: http://www.web2py.com/appliances Veja o que mais se parece com o que deseja. Abraços! Em 2 de novembro de 2013 17:00, Ovidio Marinho ovidio...@gmail.comescreveu: Hermano boa tarde faz isso no python: a =0 b =1 c=2 a=b+c e ve o resultado. Ovidio Marinho Falcao Neto ITJP.NET.BR ovidio...@gmail.com Brasil 2013/11/2 Hermano Ponce mangabeir...@gmail.com Alguém pode disponibilizar uma app que tenha cálculos entre campos. por exemplo: campo A * campo B = campo C oucampo A + campo B = campo C. App tipo estoque de produtos. Quero somente um exemplo da aplicação. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] form without errors and not accepted
Hi again guys, I'm using SQLFORM.factory and the form returned without errors and without been accepted. *Controller*: def product(): db.product_inventory.researcher_id.default = researcher_id() form = SQLFORM.factory(db.item,db.item_image,db.product,db.product_inventory) if form.process().accepted: print 'ok' elif form.errors: print form.errors else: print form return dict(form = form) *View: * {{=form}} When I submit it returns the the form html (*else*) whats happens? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] form without errors and not accepted
Yes Richard, but it should be accepted or should take errors, right? 2013/11/1 Richard Vézina ml.richard.vez...@gmail.com You don't do redirection after accepted and you set default value to some field, so you maybe just have the same form again and again... Also, with SQLFORM.factory() you have to manage the data input by yourself... search the book with filter_field... You have to process you form after if form.process().accepted: id = db.table.field.insert(field=form.vars.field) ... Richard On Fri, Nov 1, 2013 at 10:44 AM, Diogo Munaro diogo.mvie...@gmail.comwrote: Hi again guys, I'm using SQLFORM.factory and the form returned without errors and without been accepted. *Controller*: def product(): db.product_inventory.researcher_id.default = researcher_id() form = SQLFORM.factory(db.item,db.item_image,db.product,db.product_inventory) if form.process().accepted: print 'ok' elif form.errors: print form.errors else: print form return dict(form = form) *View: * {{=form}} When I submit it returns the the form html (*else*) whats happens? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] form without errors and not accepted
O Man!! I Solved!!! Was an extra field with radiobox... If I send by post SQLFORM don't get an error, but if I send by ajax post it's raising me a ticket. I removed the error and then the 2 post methods work. It should be a web2py bug? A bug on bug report? lol 2013/11/1 Richard Vézina ml.richard.vez...@gmail.com I don't see you models for the differents dbs, so can't say how validation should occure. But, it should use the same requires as are the set on these dbs... Richard On Fri, Nov 1, 2013 at 12:50 PM, Diogo Munaro diogo.mvie...@gmail.comwrote: Yes Richard, but it should be accepted or should take errors, right? 2013/11/1 Richard Vézina ml.richard.vez...@gmail.com You don't do redirection after accepted and you set default value to some field, so you maybe just have the same form again and again... Also, with SQLFORM.factory() you have to manage the data input by yourself... search the book with filter_field... You have to process you form after if form.process().accepted: id = db.table.field.insert(field=form.vars.field) ... Richard On Fri, Nov 1, 2013 at 10:44 AM, Diogo Munaro diogo.mvie...@gmail.comwrote: Hi again guys, I'm using SQLFORM.factory and the form returned without errors and without been accepted. *Controller*: def product(): db.product_inventory.researcher_id.default = researcher_id() form = SQLFORM.factory(db.item,db.item_image,db.product,db.product_inventory) if form.process().accepted: print 'ok' elif form.errors: print form.errors else: print form return dict(form = form) *View: * {{=form}} When I submit it returns the the form html (*else*) whats happens? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Join might work? Table limits?
Yes, web2py is not ok with it. Making 3 or 4 explicit joins and it gets errors 2013/10/31 Vinicius Assef vinicius...@gmail.com That was my point, Diogo. Is there some fault when we have many explicit joins in DAL? On Wed, Oct 30, 2013 at 4:01 PM, Diogo Munaro diogo.mvie...@gmail.com wrote: Hi Vinicius! The query with a lot of natural joins really don't work, but join with WHERE worked. I don't know what happend, but web2py become crazy when I set more natural joins 2013/10/30 Vinicius Assef vinicius...@gmail.com Maybe I missed something, but why the simple query (with few joins) worked and the complex one (with many joins) didn't? On Wed, Oct 30, 2013 at 2:31 PM, Diogo Munaro diogo.mvie...@gmail.com wrote: Hi Michele, I'm looking here the results... If I get where and natural join is different. The explain is like that: http://stackoverflow.com/questions/15996226/natural-join-vs-where-in-clauses Here is massimo suggested code: mysql explain SELECT groups.name, city.name, auth_user.id, auth_user.is_active, auth_user.created_on, auth_user.created_by, auth_user.modified_on, auth_user.modified_by, auth_user.email, auth_user.person_id, auth_user.password, auth_user.know_id, auth_user.registration_key, auth_user.reset_password_key, auth_user.registration_id FROM researcher, researcher_lab_permission, lab, groups, auth_user, city WHERE groups.id = lab.group_id) AND (lab.id = researcher_lab_permission.lab_id)) AND (researcher.id = researcher_lab_permission.researcher_id)) AND (researcher.user_id = auth_user.id)) AND (researcher_lab_permission.is_active = 'T')) AND (lab.is_active = 'T')) AND (groups.is_active = 'T')) AND (auth_user.is_active = 'T')) - ; ++-+---+++-+-++--++ | id | select_type | table | type | possible_keys | key | key_len | ref| rows | Extra | ++-+---+++-+-++--++ | 1 | SIMPLE | city | ALL| NULL | NULL| NULL| NULL | 5535 || | 1 | SIMPLE | researcher_lab_permission | ALL| researcher_id__idx,lab_id__idx | NULL| NULL| NULL |2 | Using where; Using join buffer | | 1 | SIMPLE | lab | eq_ref | PRIMARY,group_id__idx | PRIMARY | 4 | labsyn.researcher_lab_permission.lab_id|1 | Using where | | 1 | SIMPLE | groups| eq_ref | PRIMARY | PRIMARY | 4 | labsyn.lab.group_id| 1 | Using where| | 1 | SIMPLE | researcher| eq_ref | PRIMARY,user_id__idx | PRIMARY | 4 | labsyn.researcher_lab_permission.researcher_id |1 | | | 1 | SIMPLE | auth_user | eq_ref | PRIMARY | PRIMARY | 4 | labsyn.researcher.user_id | 1 | Using where| ++-+---+++-+-++--++ Here is with JOIN: explain SELECT l.id,g.name,c.name FROM researcher_lab_permission as rl JOIN lab as l - JOIN researcher as r JOIN auth_user as a JOIN groups as g JOIN city as c - ON rl.researcher_id = r.id AND rl.lab_id = l.idAND a.id = r.user_id AND l.group_id = g.id - AND c.id = g.city_id - ; ++-+---+++-+-+-+--++ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | ++-+---+++-+-+-+--++ | 1 | SIMPLE | l | index | PRIMARY,group_id__idx | group_id__idx | 5 | NULL|2 | Using index | | 1 | SIMPLE | rl| ALL| researcher_id__idx,lab_id__idx | NULL | NULL| NULL|2 | Using where; Using join buffer | | 1 | SIMPLE | a | index | PRIMARY
[web2py] SQLFORM.factory same table twice or more...
Hey guys, it's possible to use sqlform to generate same table twice or more? example: form = SQLFORM.factory(db.item,db.item_image,db.item_image,db.item_image) Is there exists a best way? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Multiple dbs foreign key
Hello guys! I'm using web2py to create new dbs automatically for each company that uses my system. It's using a central DB for authentication and some default tables. I heard that somebody was developing an integration to work with these foreign key inter dbs. Here everything is working, except auth_user with auth.signature, but I made a workaround using the default fields (createdby, is_active, etc...), making index with executesql and mantaining integrity with IS_IN_DB. IS_IN_DB works great! ex: *db*.define_table('cool_table', Field('user_id', 'integer', requires=IS_IN_DB(*db2*,*db2*.auth_user_id))) The worst problem is making a record_versioning. If before this example table I force record_versioning it's create a backup table, but the feature of make the versioning don't work :( Example: * db*.define_table('cool_table', Field('created_by', 'integer', requires=IS_EMPTY_OR(IS_IN_DB(db2, db2.auth_user.id http://db_pai.auth_user.id)), widget=SQLFORM.widgets.options.widget), Field('created_on', 'datetime'), Field('modified_by', 'integer', requires=IS_EMPTY_OR(IS_IN_DB(db2, db2.auth_user.idhttp://db_pai.auth_user.id)), widget=SQLFORM.widgets.options.widget), Field('modified_on', 'datetime')) db.cool_table._enable_record_versioning() There is a best way to do it or I need to do my own record versioning? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] SQLFORM.factory same table twice or more...
Thx Richard! Clone is amazing!! 2013/10/31 Richard Vézina ml.richard.vez...@gmail.com Your table can't have the same field name : http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=One+form+for+multiple+tables#Other-types-of-Forms This only works when the tables don't have field names in common. But you can .clone() your field : https://groups.google.com/d/msg/web2py/FAvjWNUiC3Y/gV_4BPXZkw4J Hope it helps Richard On Thu, Oct 31, 2013 at 5:05 PM, Diogo Munaro diogo.mvie...@gmail.comwrote: Hey guys, it's possible to use sqlform to generate same table twice or more? example: form = SQLFORM.factory(db.item,db.item_image,db.item_image,db.item_image) Is there exists a best way? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Regarding checkbox implementation in web2py??
Hi Akash! Use: db.Field('category','list: reference Category',requires=IS_IN_DB(db,'Category.id','Category.Name',multiple=True), *widget=SQLFORM.widgets.checkboxes.widget*) I think it works 2013/10/31 Akash Agrawall akash.wan...@gmail.com Hie guys I am a newbie in web2py I have added a Field in the table which goes like this: { db.Field('category','list:reference Category',requires=IS_IN_DB(db,'Category.id','Category.Name',multiple=True)) } how to implement it more as a checkbox type what is the syntax for it ?? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Join might work? Table limits?
I'ts working, but it's results a WHERE JOIN and takes much more time than JOIN sintax :( 2013/10/29 Massimo Di Pierro massimo.dipie...@gmail.com Try this: rows = db(db.groups.id == db.lab.group_id)(db.lab.id == db.researcher_lab_permission.l**ab_id)(db.researcher.id == db.researcher_lab_permission.r**esearcher_id)(db.researcher.us**er_id == db.auth_user.id).select(db.**groups.name http://db.groups.name/, db.city.name,db.**auth_user.ALL) On Monday, 28 October 2013 21:46:28 UTC-5, Diogo Munaro wrote: Here is the sql generated: SELECT groups.name, city.name, auth_user.email, name1.id, name1.is_active, name1.created_on, name1.created_by, name1.modified_on, name1.modified_by, name1.user_id, name1.image, name1.image_file, name1.lattes, name2.id, name2.is_active, name2.created_on, name2.created_by, name2.modified_on, name2.modified_by, name2.site, name2.url, name2.cnpj, name2.type_id, name2.group_id, name2.privacity FROM researcher_lab_permission, researcher, lab JOIN groups ON ((groups.id = lab.group_id) AND (groups.is_active = 'T')) JOIN city ON (city.id = groups.city_id) JOIN auth_user ON ((researcher.user_id = auth_user.id) AND (auth_user.is_active = 'T')) JOIN `researcher` AS name1 ON ( researcher.id = researcher_lab_permission.**researcher_id) JOIN `lab` AS name2 ON ((lab.id = researcher_lab_permission.lab_**id) AND (lab.is_active = 'T')) Some JOINS are wrong 2013/10/29 Diogo Munaro diogo@gmail.com I need these joins because I need filter some tables without selecting all the tables and filtering with where. Anyway, I tried: rows = (db.groups.id == db.lab.group_id)(db.lab.id == db.researcher_lab_permission.l**ab_id)(db.researcher.id == db.researcher_lab_permission.r**esearcher_id)(db.researcher.us**er_id == db.auth_user.id).select(db.**groups.name http://db.groups.name/, db.city.name,db.**auth_user.ALL) And it returns: type 'exceptions.TypeError' 'Query' object is not callable I'm using db.executesql and it's working: db.executesql('''SELECT l.id,g.name,c.name FROM researcher_lab_permission as rl JOIN lab as l JOIN researcher as r JOIN auth_user as a JOIN groups as g JOIN city as c ON rl.researcher_id = r.id AND rl.lab_id = l.id AND a.id= r.user_id AND l.group_id = g.id AND c.id = g.city_id WHERE a.id = %s''' %(auth.user_id)) Something strange with DAL... 2013/10/28 Massimo Di Pierro massimo@gmail.com (db.groups.**id http://db.groups.id/ == db.lab.group_id)(db.lab.id == db.researcher_lab_permission.**l**ab_id)(db.**researcher.idhttp://db.researcher.id/ == db.researcher_lab_permission.**r**esearcher_id)(db.researcher.**us* *er_id == db.auth_user.id).select(db.**groups.namehttp://db.groups.name/ ,db.**city.name http://db.city.name/,db.**auth_user.ALL) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/0YdtJwCEdl4/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Join might work? Table limits?
I really need these joins to filter tables instead of join all and then make a filter with WHERE (spend a long time). I only need these 2 fields. My query works great with db.executesql but I'm not working with dal optimizations, like table record versioning, and need to do some where statment by myself (is_active). It's a DAL bug? I'm using web2py 2.7.2 2013/10/30 Massimo Di Pierro massimo.dipie...@gmail.com What fields do you need to select. We can optimize this. On Wednesday, 30 October 2013 05:17:09 UTC-5, Diogo Munaro wrote: I'ts working, but it's results a WHERE JOIN and takes much more time than JOIN sintax :( 2013/10/29 Massimo Di Pierro massimo@gmail.com Try this: rows = db(db.groups.id == db.lab.group_id)(db.lab.id == db.researcher_lab_permission.lab_id)(db.researcher.id == db.researcher_lab_permission.researcher_id)(db.researcher.user_id == db.auth_user.id).select(db.groups.name http://db.groups.name/, db.city.name,db.**au**th_user.ALL) On Monday, 28 October 2013 21:46:28 UTC-5, Diogo Munaro wrote: Here is the sql generated: SELECT groups.name, city.name, auth_user.email, name1.id, name1.is_active, name1.created_on, name1.created_by, name1.modified_on, name1.modified_by, name1.user_id, name1.image, name1.image_file, name1.lattes, name2.id, name2.is_active, name2.created_on, name2.created_by, name2.modified_on, name2.modified_by, name2.site, name2.url, name2.cnpj, name2.type_id, name2.group_id, name2.privacity FROM researcher_lab_permission, researcher, lab JOIN groups ON ((groups.id= lab.group_id) AND (groups.is_active = 'T')) JOIN city ON ( city.id = groups.city_id) JOIN auth_user ON ((researcher.user_id = auth_user.id) AND (auth_user.is_active = 'T')) JOIN `researcher` AS name1 ON (researcher.id = researcher_lab_permission.**rese**archer_id) JOIN `lab` AS name2 ON ((lab.id = researcher_lab_permission.lab_id) AND (lab.is_active = 'T')) Some JOINS are wrong 2013/10/29 Diogo Munaro diogo@gmail.com I need these joins because I need filter some tables without selecting all the tables and filtering with where. Anyway, I tried: rows = (db.groups.id == db.lab.group_id)(db.lab.id == db.researcher_lab_permission.lab_id)(db.researcher.id == db.researcher_lab_permission.researcher_id)(db.researcher.user_id == db.auth_user.id).select(db.groups.name http://db.groups.name/ ,db.city.name,db.**au**th_user.ALL) And it returns: type 'exceptions.TypeError' 'Query' object is not callable I'm using db.executesql and it's working: db.executesql('''SELECT l.id,g.name,c.name FROM researcher_lab_permission as rl JOIN lab as l JOIN researcher as r JOIN auth_user as a JOIN groups as g JOIN city as c ON rl.researcher_id = r.id AND rl.lab_id = l.id AND a.id = r.user_id AND l.group_id = g.id AND c.id = g.city_id WHERE a.id = %s''' %(auth.user_id)) Something strange with DAL... 2013/10/28 Massimo Di Pierro massimo@gmail.com (db.groups.**id http://db.groups.id/ == db.lab.group_id)(db.lab.id == db.researcher_lab_permission.**lab_id)(db.**researcher.idhttp://db.researcher.id/ == db.researcher_lab_permission.**researcher_id)(db.researcher.* *user_id == db.auth_user.id).select(db.groups.namehttp://db.groups.name/ ,db.**city.name http://db.city.name/,db.**au**th_user.ALL) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/**web2py http://github.com/web2py/web2py(Source code) - https://code.google.com/p/**web2py/issues/listhttps://code.google.com/p/web2py/issues/list(Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/0YdtJwCEdl4/**unsubscribehttps://groups.google.com/d/topic/web2py/0YdtJwCEdl4/unsubscribe . To unsubscribe from this group and all its topics, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/0YdtJwCEdl4/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received
Re: [web2py] Re: Join might work? Table limits?
it's getting all the cities first without any optimizations. So I observed that that code was not filtering cities. Now works great: rows = db(db.groups.id == db.lab.group_id)(db.groups.city_id == db.city.id)( db.lab.id == db.researcher_lab_permission.lab_id)(db.researcher.id == db.researcher_lab_permission.researcher_id)(db.researcher.user_id == db.auth_user.id).select(db.groups.name,db.city.name) Thank you guys! 2013/10/30 Michele Comitini michele.comit...@gmail.com implicit inner join vs explicit should be same in speed terms, but... http://stackoverflow.com/questions/5273942/mysql-inner-join-vs-where 2013/10/30 Diogo Munaro diogo.mvie...@gmail.com I really need these joins to filter tables instead of join all and then make a filter with WHERE (spend a long time). I only need these 2 fields. My query works great with db.executesql but I'm not working with dal optimizations, like table record versioning, and need to do some where statment by myself (is_active). It's a DAL bug? I'm using web2py 2.7.2 2013/10/30 Massimo Di Pierro massimo.dipie...@gmail.com What fields do you need to select. We can optimize this. On Wednesday, 30 October 2013 05:17:09 UTC-5, Diogo Munaro wrote: I'ts working, but it's results a WHERE JOIN and takes much more time than JOIN sintax :( 2013/10/29 Massimo Di Pierro massimo@gmail.com Try this: rows = db(db.groups.id == db.lab.group_id)(db.lab.id == db.researcher_lab_permission.lab_id)(db.researcher.id == db.researcher_lab_permission.researcher_id)(db.researcher.user_id == db.auth_user.id).select(db.groups.name http://db.groups.name/ ,db.city.name,db.**au**th_user.ALL) On Monday, 28 October 2013 21:46:28 UTC-5, Diogo Munaro wrote: Here is the sql generated: SELECT groups.name, city.name, auth_user.email, name1.id, name1.is_active, name1.created_on, name1.created_by, name1.modified_on, name1.modified_by, name1.user_id, name1.image, name1.image_file, name1.lattes, name2.id, name2.is_active, name2.created_on, name2.created_by, name2.modified_on, name2.modified_by, name2.site, name2.url, name2.cnpj, name2.type_id, name2.group_id, name2.privacity FROM researcher_lab_permission, researcher, lab JOIN groups ON ((groups.id= lab.group_id) AND (groups.is_active = 'T')) JOIN city ON ( city.id = groups.city_id) JOIN auth_user ON ((researcher.user_id = auth_user.id) AND (auth_user.is_active = 'T')) JOIN `researcher` AS name1 ON (researcher.id = researcher_lab_permission.**rese**archer_id) JOIN `lab` AS name2 ON ((lab.id = researcher_lab_permission.lab_id) AND (lab.is_active = 'T')) Some JOINS are wrong 2013/10/29 Diogo Munaro diogo@gmail.com I need these joins because I need filter some tables without selecting all the tables and filtering with where. Anyway, I tried: rows = (db.groups.id == db.lab.group_id)(db.lab.id == db.researcher_lab_permission.lab_id)(db.researcher.id == db.researcher_lab_permission.researcher_id)(db.researcher.user_id == db.auth_user.id).select(db.groups.namehttp://db.groups.name/ ,db.city.name,db.**au**th_user.ALL) And it returns: type 'exceptions.TypeError' 'Query' object is not callable I'm using db.executesql and it's working: db.executesql('''SELECT l.id,g.name,c.name FROM researcher_lab_permission as rl JOIN lab as l JOIN researcher as r JOIN auth_user as a JOIN groups as g JOIN city as c ON rl.researcher_id = r.id AND rl.lab_id = l.id AND a.id = r.user_id AND l.group_id = g.id AND c.id = g.city_id WHERE a.id = %s''' %(auth.user_id)) Something strange with DAL... 2013/10/28 Massimo Di Pierro massimo@gmail.com (db.groups.**id http://db.groups.id/ == db.lab.group_id)( db.lab.id == db.researcher_lab_permission.**lab_id)(db.** researcher.id http://db.researcher.id/ == db.researcher_lab_permission.**researcher_id)(db.researcher.** user_id == db.auth_user.id).select(db.groups.namehttp://db.groups.name/ ,db.**city.name http://db.city.name/,db.**au**th_user.ALL) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/**web2py http://github.com/web2py/web2py(Source code) - https://code.google.com/p/**web2py/issues/listhttps://code.google.com/p/web2py/issues/list(Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/0YdtJwCEdl4/**unsubscribehttps://groups.google.com/d/topic/web2py/0YdtJwCEdl4/unsubscribe . To unsubscribe from this group and all its topics, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py
Re: [web2py] Re: Join might work? Table limits?
Hi Vinicius! The query with a lot of natural joins really don't work, but join with WHERE worked. I don't know what happend, but web2py become crazy when I set more natural joins 2013/10/30 Vinicius Assef vinicius...@gmail.com Maybe I missed something, but why the simple query (with few joins) worked and the complex one (with many joins) didn't? On Wed, Oct 30, 2013 at 2:31 PM, Diogo Munaro diogo.mvie...@gmail.com wrote: Hi Michele, I'm looking here the results... If I get where and natural join is different. The explain is like that: http://stackoverflow.com/questions/15996226/natural-join-vs-where-in-clauses Here is massimo suggested code: mysql explain SELECT groups.name, city.name, auth_user.id, auth_user.is_active, auth_user.created_on, auth_user.created_by, auth_user.modified_on, auth_user.modified_by, auth_user.email, auth_user.person_id, auth_user.password, auth_user.know_id, auth_user.registration_key, auth_user.reset_password_key, auth_user.registration_id FROM researcher, researcher_lab_permission, lab, groups, auth_user, city WHERE groups.id = lab.group_id) AND ( lab.id = researcher_lab_permission.lab_id)) AND (researcher.id = researcher_lab_permission.researcher_id)) AND (researcher.user_id = auth_user.id)) AND (researcher_lab_permission.is_active = 'T')) AND (lab.is_active = 'T')) AND (groups.is_active = 'T')) AND (auth_user.is_active = 'T')) - ; ++-+---+++-+-++--++ | id | select_type | table | type | possible_keys | key | key_len | ref| rows | Extra | ++-+---+++-+-++--++ | 1 | SIMPLE | city | ALL| NULL | NULL| NULL| NULL | 5535 || | 1 | SIMPLE | researcher_lab_permission | ALL| researcher_id__idx,lab_id__idx | NULL| NULL| NULL |2 | Using where; Using join buffer | | 1 | SIMPLE | lab | eq_ref | PRIMARY,group_id__idx | PRIMARY | 4 | labsyn.researcher_lab_permission.lab_id|1 | Using where | | 1 | SIMPLE | groups| eq_ref | PRIMARY | PRIMARY | 4 | labsyn.lab.group_id| 1 | Using where| | 1 | SIMPLE | researcher| eq_ref | PRIMARY,user_id__idx | PRIMARY | 4 | labsyn.researcher_lab_permission.researcher_id |1 | | | 1 | SIMPLE | auth_user | eq_ref | PRIMARY | PRIMARY | 4 | labsyn.researcher.user_id | 1 | Using where| ++-+---+++-+-++--++ Here is with JOIN: explain SELECT l.id,g.name,c.name FROM researcher_lab_permission as rl JOIN lab as l - JOIN researcher as r JOIN auth_user as a JOIN groups as g JOIN city as c - ON rl.researcher_id = r.id AND rl.lab_id = l.id AND a.id = r.user_id AND l.group_id = g.id - AND c.id = g.city_id - ; ++-+---+++-+-+-+--++ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | ++-+---+++-+-+-+--++ | 1 | SIMPLE | l | index | PRIMARY,group_id__idx | group_id__idx | 5 | NULL|2 | Using index | | 1 | SIMPLE | rl| ALL| researcher_id__idx,lab_id__idx | NULL | NULL| NULL|2 | Using where; Using join buffer | | 1 | SIMPLE | a | index | PRIMARY| created_by__idx | 5 | NULL|2 | Using index; Using join buffer | | 1 | SIMPLE | r | eq_ref | PRIMARY,user_id__idx | PRIMARY | 4 | labsyn.rl.researcher_id |1 | Using where | | 1 | SIMPLE | g | eq_ref | PRIMARY,city_id__idx | PRIMARY | 4 | labsyn.l.group_id |1 | | | 1 | SIMPLE | c | eq_ref
[web2py] Join might work? Table limits?
Hey guys, I'm using web2py with mysql and I can't do a Inner Join When I try: groups = db().select(db.groups.name,db.city.name, join=[db.groups.on(db.groups.id == db.lab.group_id), db.city.on(db.city.id == db.groups.city_id), db.auth_user.on(db.researcher.user_id == db.auth_user.id), db.researcher.on(db.researcher.id == db.researcher_lab_permission.researcher_id), db.lab.on(db.lab.id == db.researcher_lab_permission.lab_id) ]) Raise this error: class 'gluon.contrib.pymysql.err.InternalError' (1054, uUnknown column 'lab.group_id' in 'on clause') But when I try only: groups = db().select(db.groups.name,db.city.name, join=[db.groups.on(db.groups.id == db.lab.group_id), db.city.on(db.city.id == db.groups.city_id) ]) It's works. There are some limit for tables join? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Join might work? Table limits?
Yes, thanks Massimo! The first error pass, but now: class 'gluon.contrib.pymysql.err.InternalError' (1054, uUnknown column 'researcher.user_id' in 'on clause') How could I generate sql to debug it? 2013/10/28 Massimo Di Pierro massimo.dipie...@gmail.com groups = db().select(db.groups.name,db.**city.name http://db.city.name/ ,db.auth_user.email,db.researcher.with_alias('name1').ALL, db.lab. with_alias('name2').ALL, join=[db.groups.on(db.groups.**idhttp://db.groups.id/ == db.lab.group_id), db.city.on(db.city.id == db.groups.city_id), db.auth_user.on(db.researcher.**user_id == db.auth_user.id), db.researcher.with_alias('name1').on(db.** researcher.id http://db.researcher.id/ == db.researcher_lab_permission.* *researcher_id), db.lab.with_alias('name2').on(db.lab.id == db.researcher_lab_permission.**lab_id) ]) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Join might work? Table limits?
I need these joins because I need filter some tables without selecting all the tables and filtering with where. Anyway, I tried: rows = (db.groups.id == db.lab.group_id)(db.lab.id == db.researcher_lab_permission.lab_id)(db.researcher.id == db.researcher_lab_permission.researcher_id)(db.researcher.user_id == db.auth_user.id).select(db.groups.name,db.city.name,db.auth_user.ALL) And it returns: type 'exceptions.TypeError' 'Query' object is not callable I'm using db.executesql and it's working: db.executesql('''SELECT l.id,g.name,c.name FROM researcher_lab_permission as rl JOIN lab as l JOIN researcher as r JOIN auth_user as a JOIN groups as g JOIN city as c ON rl.researcher_id = r.id AND rl.lab_id = l.id AND a.id = r.user_id AND l.group_id = g.id AND c.id = g.city_id WHERE a.id = %s''' %(auth.user_id)) Something strange with DAL... 2013/10/28 Massimo Di Pierro massimo.dipie...@gmail.com (db.groups.**id http://db.groups.id/ == db.lab.group_id)(db.lab.id == db.researcher_lab_permission.**lab_id)(db.**researcher.idhttp://db.researcher.id/ == db.researcher_lab_permission.**researcher_id)(db.researcher.**user_id == db.auth_user.id).select(db.groups.name,db.**city.namehttp://db.city.name/ ,db.auth_user.ALL) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Join might work? Table limits?
Here is the sql generated: SELECT groups.name, city.name, auth_user.email, name1.id, name1.is_active, name1.created_on, name1.created_by, name1.modified_on, name1.modified_by, name1.user_id, name1.image, name1.image_file, name1.lattes, name2.id, name2.is_active, name2.created_on, name2.created_by, name2.modified_on, name2.modified_by, name2.site, name2.url, name2.cnpj, name2.type_id, name2.group_id, name2.privacity FROM researcher_lab_permission, researcher, lab JOIN groups ON ((groups.id = lab.group_id) AND (groups.is_active = 'T')) JOIN city ON (city.id = groups.city_id) JOIN auth_user ON ((researcher.user_id = auth_user.id) AND (auth_user.is_active = 'T')) JOIN `researcher` AS name1 ON (researcher.id = researcher_lab_permission.researcher_id) JOIN `lab` AS name2 ON ((lab.id = researcher_lab_permission.lab_id) AND (lab.is_active = 'T')) Some JOINS are wrong 2013/10/29 Diogo Munaro diogo.mvie...@gmail.com I need these joins because I need filter some tables without selecting all the tables and filtering with where. Anyway, I tried: rows = (db.groups.id == db.lab.group_id)(db.lab.id == db.researcher_lab_permission.lab_id)(db.researcher.id == db.researcher_lab_permission.researcher_id)(db.researcher.user_id == db.auth_user.id).select(db.groups.name,db.city.name,db.auth_user.ALL) And it returns: type 'exceptions.TypeError' 'Query' object is not callable I'm using db.executesql and it's working: db.executesql('''SELECT l.id,g.name,c.name FROM researcher_lab_permission as rl JOIN lab as l JOIN researcher as r JOIN auth_user as a JOIN groups as g JOIN city as c ON rl.researcher_id = r.id AND rl.lab_id = l.id AND a.id= r.user_id AND l.group_id = g.id AND c.id = g.city_id WHERE a.id = %s''' %(auth.user_id)) Something strange with DAL... 2013/10/28 Massimo Di Pierro massimo.dipie...@gmail.com (db.groups.**id http://db.groups.id/ == db.lab.group_id)(db.lab.id == db.researcher_lab_permission.**lab_id)(db.**researcher.idhttp://db.researcher.id/ == db.researcher_lab_permission.**researcher_id)(db.researcher.**user_id == db.auth_user.id).select(db.groups.name,db.**city.namehttp://db.city.name/ ,db.auth_user.ALL) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: form.custom usage
Thanks Anthony, I will try... Next week I will reproduce it. Em 25/10/2013 00:21, Anthony abasta...@gmail.com escreveu: Not quite clear what the problem is. What you put in the view shouldn't matter -- that just generates the HTML to display the widgets -- it doesn't have anything to do with validation (and form.custom.widget.fieldname will produce the same HTML as form.element(_name='fieldname')). Of course, you won't be able to use form.custom.widget.fieldname for the fields you manually added to the form. If you have time, perhaps you could produce a minimal app that replicates the problem. Include one page that uses form.custom.widget and one that uses form.element(), and explain how they behave differently. Also, note that form.elements()[0][0] is simply equivalent to form[0]. Anthony On Thursday, October 24, 2013 9:07:09 PM UTC-4, Diogo Munaro wrote: Here my controller and view: http://pastebin.com/AXGx99UN If I use form.custom.widget.first_name (for example). It's doesn't work. Another thing, if I insert: form2.element(_name=city_id)**['_type']='hidden' after: if form2.process().accepted: It's returns a text field before the validation instead of a hidden field. 2013/10/23 Diogo Munaro diogo@gmail.com Now it's working only with form.element(_name=first_**name). The controller is the same for 2 types. Tomorrow I'll post everything, but now I can post the controller simple structure: def register(): form = SQLFORM.factory(db.person, db.auth_user,db.researcher) if form.process().accepted: ##register people in db The view was the same... I need a auth structure with 3 tables: People has n auth and auth has n researcher, and I really need it... Em terça-feira, 22 de outubro de 2013 17h31min40s UTC-2, Anthony escreveu: Please show all of your controller and view code. On Tuesday, October 22, 2013 3:18:16 PM UTC-4, Diogo Munaro wrote: Sorry Antony, I forgot the = here, but the code have it. The fields are there, but no validators work Em terça-feira, 22 de outubro de 2013 12h33min37s UTC-2, Anthony escreveu: {{form.custom.begin}} {{form.custom.widget.first_**nam**e}} {{form.custom.submit}} {{form.custom.end}} Is that the actual code? If so, you need to precede each item above with an =. The fields comes without validators. Then, it reflect problems with form.process().accepted Validation happens in the controller when form.process() is called, not in the view. So you still get validation when you use form.custom.widget. {{form.custom.begin}} {{=form.element(_name=first_**n**ame)}} form.element(_name=first_**name**) is the same as form.custom.widget.first_name. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/**web2py http://github.com/web2py/web2py(Source code) - https://code.google.com/p/**web2py/issues/listhttps://code.google.com/p/web2py/issues/list(Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/ggzIjyqNoSQ/**unsubscribehttps://groups.google.com/d/topic/web2py/ggzIjyqNoSQ/unsubscribe . To unsubscribe from this group and all its topics, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/ggzIjyqNoSQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: form.custom usage
Here my controller and view: http://pastebin.com/AXGx99UN If I use form.custom.widget.first_name (for example). It's doesn't work. Another thing, if I insert: form2.element(_name=city_id)['_type']='hidden' after: if form2.process().accepted: It's returns a text field before the validation instead of a hidden field. 2013/10/23 Diogo Munaro diogo.mvie...@gmail.com Now it's working only with form.element(_name=first_name). The controller is the same for 2 types. Tomorrow I'll post everything, but now I can post the controller simple structure: def register(): form = SQLFORM.factory(db.person, db.auth_user,db.researcher) if form.process().accepted: ##register people in db The view was the same... I need a auth structure with 3 tables: People has n auth and auth has n researcher, and I really need it... Em terça-feira, 22 de outubro de 2013 17h31min40s UTC-2, Anthony escreveu: Please show all of your controller and view code. On Tuesday, October 22, 2013 3:18:16 PM UTC-4, Diogo Munaro wrote: Sorry Antony, I forgot the = here, but the code have it. The fields are there, but no validators work Em terça-feira, 22 de outubro de 2013 12h33min37s UTC-2, Anthony escreveu: {{form.custom.begin}} {{form.custom.widget.first_**name}} {{form.custom.submit}} {{form.custom.end}} Is that the actual code? If so, you need to precede each item above with an =. The fields comes without validators. Then, it reflect problems with form.process().accepted Validation happens in the controller when form.process() is called, not in the view. So you still get validation when you use form.custom.widget. {{form.custom.begin}} {{=form.element(_name=first_**name)}} form.element(_name=first_**name) is the same as form.custom.widget.first_name. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/ggzIjyqNoSQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: form.custom usage
Now it's working only with form.element(_name=first_name). The controller is the same for 2 types. Tomorrow I'll post everything, but now I can post the controller simple structure: def register(): form = SQLFORM.factory(db.person, db.auth_user,db.researcher) if form.process().accepted: ##register people in db The view was the same... I need a auth structure with 3 tables: People has n auth and auth has n researcher, and I really need it... Em terça-feira, 22 de outubro de 2013 17h31min40s UTC-2, Anthony escreveu: Please show all of your controller and view code. On Tuesday, October 22, 2013 3:18:16 PM UTC-4, Diogo Munaro wrote: Sorry Antony, I forgot the = here, but the code have it. The fields are there, but no validators work Em terça-feira, 22 de outubro de 2013 12h33min37s UTC-2, Anthony escreveu: {{form.custom.begin}} {{form.custom.widget.first_name}} {{form.custom.submit}} {{form.custom.end}} Is that the actual code? If so, you need to precede each item above with an =. The fields comes without validators. Then, it reflect problems with form.process().accepted Validation happens in the controller when form.process() is called, not in the view. So you still get validation when you use form.custom.widget. {{form.custom.begin}} {{=form.element(_name=first_name)}} form.element(_name=first_name) is the same as form.custom.widget.first_name. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] DAL and JOINS error
Hi guy, I'm using web2py version 2.7.2 with ubuntu 12.04. I made a simple db.py: state = db.define_table('state', Field('name','string',label=T('State'))) city = db.define_table('city', Field('name','string',label=T('City')), Field('state_id','reference state',required=True, requires=IS_IN_DB(db,'state.id', lambda reg: '%(city)s - %(state)s' % dict(city=reg.name,state=reg.country_id.name When I make a query: db(db.city.name.contains('rio')).select(db.city.name,db.city.id, db.state.name,join=db.city.on(db.city.state_id == db.state.id)) it takes 180ms, but when i make db(db.city.name.contains('rio') db.city.state_id == db.state.id).select( db.city.name,db.city.id,db.state.name) it takes 24 seconds waiting and 5 seconds to retrieve. Looking inside, I saw that web2py is making a WHERE clause instead of a JOIN. It's normal? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] form.custom usage
Hi, I'm using custom forms because I have a predefined layout. So, in views, if I make: {{form.custom.begin}} {{form.custom.widget.first_name}} {{form.custom.submit}} {{form.custom.end}} The fields comes without validators. Then, it reflect problems with form.process().accepted By now, I'm using: {{form.custom.begin}} {{=form.element(_name=first_name)}} {{=form.element(_type=submit)}} {{form.custom.end}} I'ts works great with validators. It's ok? What's happen here? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: form.custom usage
Sorry Antony, I forgot the = here, but the code have it. The fields are there, but no validators work Em terça-feira, 22 de outubro de 2013 12h33min37s UTC-2, Anthony escreveu: {{form.custom.begin}} {{form.custom.widget.first_name}} {{form.custom.submit}} {{form.custom.end}} Is that the actual code? If so, you need to precede each item above with an =. The fields comes without validators. Then, it reflect problems with form.process().accepted Validation happens in the controller when form.process() is called, not in the view. So you still get validation when you use form.custom.widget. {{form.custom.begin}} {{=form.element(_name=first_name)}} form.element(_name=first_name) is the same as form.custom.widget.first_name. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: DAL and JOINS error
But the book is wrong? Here: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=join#Inner-joins Em terça-feira, 22 de outubro de 2013 13h09min07s UTC-2, Anthony escreveu: db(db.city.name.contains('rio') db.city.state_id == db.state.id).select( db.city.name,db.city.id,db.state.name) db(db.city.name.contains('rio') db.city.state_id == db.state.id) should be: db(db.city.name.contains('rio') (db.city.state_id == db.state.id)) In python, the takes precedence over the == (see http://docs.python.org/2/reference/expressions.html#operator-precedence), so you need to put the second part of the query in parentheses. Looking inside, I saw that web2py is making a WHERE clause instead of a JOIN. It's normal? Yes, if you do an implicit join via the query, web2py generates a WHERE clause, not an explicit JOIN statement. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: DAL and JOINS error
O...Ok, thanks Anthony! 2013/10/22 Anthony abasta...@gmail.com On Tuesday, October 22, 2013 3:22:09 PM UTC-4, Diogo Munaro wrote: But the book is wrong? Here: http://web2py.com/books/**default/chapter/29/06/the-** database-abstraction-layer?**search=join#Inner-joinshttp://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=join#Inner-joins What do you see wrong in the book? Note, using the WHERE clause still does an inner join, it just doesn't do it via a JOIN clause. The book even clarifies this (see highlighted text below): There is an alternative syntax for INNER JOINS: rows = db(db.person).select(join=db.thing.on(db.person.id==db.thing.owner_id)) for row in rows: print row.person.name, 'has', row.thing.name Alex has Boat Alex has Chair Bob has Shoes While the output is the same, the generated SQL in the two cases can be different. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/EW_WhDeP9Uo/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: li_class on Menu doesn't work
Nobody knows? Em quinta-feira, 10 de outubro de 2013 11h08min42s UTC-3, Diogo Munaro escreveu: Hey guys, I have a menu with 3 elements. When I try it: {{=MENU(response.contextmenu,_ class=catalogo_topo_menu,li_class='textcenter',li_first=textcenter,li_last=textcenter)}} only li_first and li_last work... The first and last items ares filled with the class, but the middle item doesn't get a class. What's happening? My result: li class=textcenter … /li li … /li li class=textcenter … /li Using: 2.7.2-stable+timestamp.2013.10.07.13.52.24 (Running on Apache/2.2.22 (Ubuntu), Python 2.7.4) By now, the workaround is using the ul item to set li classes, but I'll can't do it in the future Thx for help -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: li_class on Menu doesn't work
Thx Massimo, but how could I make it? It's working with first and last. How could I insert for mid elements? 2013/10/11 Massimo Di Pierro massimo.dipie...@gmail.com li_class is only used for list items which contain sub-menus. It is not for mid elements. I do not think anything has changed there. Do you think it has? Massimo On Thursday, 10 October 2013 09:08:42 UTC-5, Diogo Munaro wrote: Hey guys, I have a menu with 3 elements. When I try it: {{=MENU(response.contextmenu,_ class=catalogo_topo_menu,li_**class='textcenter',li_first=** textcenter,li_last=**textcenter)}} only li_first and li_last work... The first and last items ares filled with the class, but the middle item doesn't get a class. What's happening? My result: li class=textcenter … /li li … /li li class=textcenter … /li Using: 2.7.2-stable+timestamp.2013.**10.07.13.52.24 (Running on Apache/2.2.22 (Ubuntu), Python 2.7.4) By now, the workaround is using the ul item to set li classes, but I'll can't do it in the future Thx for help -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/rN2193EIJxA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: li_class on Menu doesn't work
Ok, thx... li_first and li_last confused me. I think I could put mid li classes on server side like li_first and li_last do. Thx for explanation Em 11/10/2013 20:00, Massimo Di Pierro massimo.dipie...@gmail.com escreveu: But why do you need it? You can refer to elements using jQuery('.catalogo_topo_menu li') and you can use the jQuery addClass method to do it client side. Massimo On Friday, 11 October 2013 17:19:09 UTC-5, Diogo Munaro wrote: Thx Massimo, but how could I make it? It's working with first and last. How could I insert for mid elements? 2013/10/11 Massimo Di Pierro massimo@gmail.com li_class is only used for list items which contain sub-menus. It is not for mid elements. I do not think anything has changed there. Do you think it has? Massimo On Thursday, 10 October 2013 09:08:42 UTC-5, Diogo Munaro wrote: Hey guys, I have a menu with 3 elements. When I try it: {{=MENU(response.contextmenu,_ class=catalogo_topo_menu,li_class='textcenter',li_first=**t** extcenter,li_last=**textcenter**)}} only li_first and li_last work... The first and last items ares filled with the class, but the middle item doesn't get a class. What's happening? My result: li class=textcenter … /li li … /li li class=textcenter … /li Using: 2.7.2-stable+timestamp.2013.**10**.07.13.52.24 (Running on Apache/2.2.22 (Ubuntu), Python 2.7.4) By now, the workaround is using the ul item to set li classes, but I'll can't do it in the future Thx for help -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/**web2py http://github.com/web2py/web2py(Source code) - https://code.google.com/p/**web2py/issues/listhttps://code.google.com/p/web2py/issues/list(Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/web2py/rN2193EIJxA/**unsubscribehttps://groups.google.com/d/topic/web2py/rN2193EIJxA/unsubscribe . To unsubscribe from this group and all its topics, send an email to web2py+un...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/rN2193EIJxA/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] li_class on Menu doesn't work
Hey guys, I have a menu with 3 elements. When I try it: {{=MENU(response.contextmenu,_ class=catalogo_topo_menu,li_class='textcenter',li_first=textcenter,li_last=textcenter)}} only li_first and li_last work... The first and last items ares filled with the class, but the middle item doesn't get a class. What's happening? My result: li class=textcenter … /li li … /li li class=textcenter … /li Using: 2.7.2-stable+timestamp.2013.10.07.13.52.24 (Running on Apache/2.2.22 (Ubuntu), Python 2.7.4) By now, the workaround is using the ul item to set li classes, but I'll can't do it in the future Thx for help -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Install in hostgator
Thx man! You help me a lot!! Em sábado, 14 de maio de 2011 01h21min13s UTC-3, José Eloy escreveu: Hello! Recently a customer bought a hosting plan (business) with hostgator. I'm developing for him a web2py application, I have doubts of how to deploy it. Somebody can help me? The application runs well in localhost (ubuntu). Thanks in advance -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.