[web2py] Re: Can not check True/False on this field?
Huge thanks! That worked! Den fredagen den 8:e mars 2013 kl. 12:45:34 UTC+8 skrev weheh: What kind of error message are you getting? I assume the request.vars['lesson'] and request.vars.answer are both indices into their respective tables. However, request.vars will be holding these values as strings. Without knowing more, I would suggest putting an int() around those two vars, as in: answer = db.answer[int(request.vars.answer)] and then do your test: if 'y' in answer.is_correct: # do something else: # do something else Hope this helps. On Friday, March 8, 2013 12:37:20 PM UTC+8, Mika Sjöman wrote: Hi trying to check true false in a string set, but does not work ## db.py db.define_table('answer', Field('description'), Field('is_correct', type='list:string'), Field('belongs_to_quiz',type='reference quiz',writable=False), ) db.answer.is_correct.requires=IS_IN_SET(('y','n')) ## controller def check_if_correct_answer(): this function tests if the user answers correctly to a question and sends back a ajax response lesson = db.lesson(request.vars['lesson']) answer = db.answer(request.vars.answer) if answer.is_correct == y: #db.user_answer.insert(belongs_to_user=auth.user.id, belongs_to_lesson=lesson.id, correct='y') correct_or_not='y' else: correct_or_not='n' return jQuery('.flash').html('%s').slideDown(); % (correct_or_not) But this test with answer.is_correct does not work. Anybody has an idea on how to check? -- --- 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] Scheduler and legacy databases
deviating from the standards can be a pain, but if you set the migration off, change your column datatype outside web2py, the default typecasting would kick in and it should work anyway. PS: legacy db is where there are yet tables you can't change. The scheduler creates its own tables, so why the need for smallints as booleans ? On Friday, March 8, 2013 9:28:13 AM UTC+1, Massimiliano wrote: Is there any chance to take a look on this problem? Thank you On Mon, Feb 25, 2013 at 7:42 PM, Massimiliano mbel...@gmail.comjavascript: wrote: Hi, I'm working on a legacy database where all boolean are mapped to 0, -1. In my application I redefine adapter TRUE/FALSE as saw in this group. In db.py: db = DAL('postgres://postgres@127.0.0.1/logistica') import copy db._adapter.types = copy.copy(db._adapter.types) db._adapter.types['boolean']='SMALLINT' db._adapter.TRUE = -1 db._adapter.FALSE = 0 Now I'm trying to use the scheduler but I found that running ./web2py.py-K logistica it doesn't take care (or it redefine to default 'F' and 'T') of my custom db._adapter.FALSE and db._adapter.TRUE. Is there something that I can do to help fixing that? I think that to support custom boolean value is very important where working on legacy databases. Thank you very much -- Massimiliano -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Massimiliano -- --- 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: database shootout
That's true. But 'Serial' gives four-byte integer (no other option). In MySQL's autoincrement, we can define it on any size of variable (tinyint, mediumint, int, etc.). This would make a difference when data size is large. -- --- 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] problem with SLQTABLE headers
Greetings, I have some issues with SQLTABLE when I want to use the headers argument. If I call SQLTABLE(data, _class='table table-bordered small', headers = 'fieldname:capitalize', columns = columns) I get a table with the capitalized field names If I call SQLTABLE(data, _class='table table-bordered small', headers = 'labels',columns = columns) I get an error because one of the fields is virtual and it has no label, but when I try to set the label during the field definition I get an unexpected argument on the label. The only way to have all the headers as I want is to pass a dictionary that maps 'tablename.fieldname' : 'header I want' for each field Is ths the expected behaviour? What about the virtual fields, is there a way to add a label to them? Thanks in advance. Geo p.s. using web2py 2.3.2 (2012-12-17 15:03:30) stable source on windows -- --- 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] Scheduler and legacy databases
The need of smallint as boolean is required for my application... I don't knows if the word legacy is correct, I can't change the table structure but I can insert and delete records... In any case I expect that running ./web2py.py-K logistica it reads my db.py and my defines. What's happen if my scheduled task insert a record in the legacy table where boolean need to be 0 or -1, but this task is in and enviroment created by ./web2py.py-K logistica where boolean are F or T beacause it don't take care of my defines in db.py? On Fri, Mar 8, 2013 at 9:47 AM, Niphlod niph...@gmail.com wrote: deviating from the standards can be a pain, but if you set the migration off, change your column datatype outside web2py, the default typecasting would kick in and it should work anyway. PS: legacy db is where there are yet tables you can't change. The scheduler creates its own tables, so why the need for smallints as booleans ? On Friday, March 8, 2013 9:28:13 AM UTC+1, Massimiliano wrote: Is there any chance to take a look on this problem? Thank you On Mon, Feb 25, 2013 at 7:42 PM, Massimiliano mbel...@gmail.com wrote: Hi, I'm working on a legacy database where all boolean are mapped to 0, -1. In my application I redefine adapter TRUE/FALSE as saw in this group. In db.py: db = DAL('postgres://postgres@127.**0.0.1/logisticahttp://postgres@127.0.0.1/logistica ') import copy db._adapter.types = copy.copy(db._adapter.types) db._adapter.types['boolean']='**SMALLINT' db._adapter.TRUE = -1 db._adapter.FALSE = 0 Now I'm trying to use the scheduler but I found that running ./web2py.py-K logistica it doesn't take care (or it redefine to default 'F' and 'T') of my custom db._adapter.FALSE and db._adapter.TRUE. Is there something that I can do to help fixing that? I think that to support custom boolean value is very important where working on legacy databases. Thank you very much -- Massimiliano -- --- 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_outhttps://groups.google.com/groups/opt_out . -- Massimiliano -- --- 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. -- Massimiliano -- --- 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: database shootout
This is going nuts. He was fine until now with SQLite, either one of mysql or postgres will do fine, with a total preference on postgres if he doesn't want to employ a legal office to know if he can use mysql or not. PS: the day I'm going to choose mysql over postgres for the combined requirement of having: - a nice syntax to expose an autoincrementing field - is able to accomodate 8M rows with 3 bytes instead of 4 (I'll never consider a tiny or a smallint as an autoincrement-eligible field) it's the day I'll stop working on databases. -- --- 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] Scheduler and legacy databases
Ok, got it. it's not the scheduler's table you want with the booleans to work, it's the things the scheduler execute that needs to interact with some other tables in the environment...to be polite, that little hack you do is nice, but not the recommended way this is a case for your own custom adapter! ADAPTERS = { 'sqlite': SQLiteAdapter, 'sqlite:memory': SQLiteAdapter, 'mysql': MySQLAdapter, 'postgres': PostgreSQLAdapter, 'postgresmyown': MyOwnPostgreSQLAdapter, .. } class MyOwnPostgreSQLAdapter(PostgreSQLAdapter): # specify a diver to use drivers = ('psycopg2','pg8000') TRUE = 0 FALSE = -1 types = { 'boolean': 'smallint', 'string': 'VARCHAR(%(length)s)', 'text': 'TEXT', 'json': 'TEXT', 'password': 'VARCHAR(%(length)s)', 'blob': 'BYTEA', 'upload': 'VARCHAR(%(length)s)', 'integer': 'INTEGER', 'bigint': 'BIGINT', 'float': 'FLOAT', 'double': 'FLOAT8', 'decimal': 'NUMERIC(%(precision)s,%(scale)s)', 'date': 'DATE', 'time': 'TIME', 'datetime': 'TIMESTAMP', 'id': 'SERIAL PRIMARY KEY', 'reference': 'INTEGER REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'list:integer': 'TEXT', 'list:string': 'TEXT', 'list:reference': 'TEXT', 'geometry': 'GEOMETRY', 'geography': 'GEOGRAPHY', 'big-id': 'BIGSERIAL PRIMARY KEY', 'big-reference': 'BIGINT REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', } and then connect to it with db = DAL('postgresmyown://user:pass@host/database') -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Using a recursive select but encountered a broken reference
Hello, I've been having this exact same problem for a long, long time. I would also be interested in a solution, but I doubt there will be one. I think it might be a design issue with Web2py. Tamas On Saturday, March 2, 2013 9:48:38 PM UTC+1, Marin Pranjić wrote: It seems that the problem is because I run two web2py instances. One runs on domain.com and the other is on testing.domain.com. When I turn off testing instance, everything works as it should. With testing instance turned on, production instance fails. So... Can someone help me configure two web2py instances on the same port? Domains are different. I'm using apache virtual hosts. Marin Dana subota, 2. ožujka 2013. 20:55:17 UTC+1, korisnik Marin Pranjić napisao je: This happened to an user multiple times. No idea why it happens. Error ticket doesn't show much, this is everything I can get from there: Traceback (most recent call last): File /home/www-data/web2py/gluon/main.py, line 571, in wsgibase session._try_store_in_cookie_or_file(request, response) File /home/www-data/web2py/gluon/globals.py, line 738, in _try_store_in_cookie_or_file self._try_store_in_file(request, response) File /home/www-data/web2py/gluon/globals.py, line 745, in _try_store_in_file if not response.session_id or self._forget or self._unchanged(): File /home/www-data/web2py/gluon/globals.py, line 700, in _unchanged session_pickled = cPickle.dumps(dict(self)) File /usr/lib/python2.7/copy_reg.py, line 74, in _reduce_ex getstate = self.__getstate__ File /home/www-data/web2py/gluon/dal.py, line 7355, in __getattr__ self.__allocate() File /home/www-data/web2py/gluon/dal.py, line 7350, in __allocate raise RuntimeError, Using a recursive select but encountered a broken reference: %s %d%(self._table, int(self)) RuntimeError: Using a recursive select but encountered a broken reference: auth_group 5 However, auth_group record with id=5 exists. I have no idea why it raises an error. I'm using web2py 2.2.1, this is production instance so I can't test with other versions right now. Marin -- --- 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] Distinct expression only supported on Postgres?
A quote from the book: Notice that distinct can also be an expression for example: for row in db().select(db.person.name,distinct=db.person.name): print row.name Alex Bob Carl While this works on PostgreSQL, others raise an exception. OperationalError: near ON: syntax error This is what I get on SQLite. It makes sense because 'DISTINCT ON' is only supported by Postgres (correct me if I'm wrong). Do we need this in the book? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Using a recursive select but encountered a broken reference
On Friday, March 8, 2013 11:06:00 AM UTC+1, Tamas wrote: Hello, I've been having this exact same problem for a long, long time. I would also be interested in a solution, but I doubt there will be one. I think it might be a design issue with Web2py. Tamas I'm correct when I think that what you're asking is for two different programs to bind to the same socket ? I don't think that's possibile with whatever program, not only web2py. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Using a recursive select but encountered a broken reference
On Friday, March 8, 2013 11:57:39 AM UTC+1, Niphlod wrote: On Friday, March 8, 2013 11:06:00 AM UTC+1, Tamas wrote: Hello, I've been having this exact same problem for a long, long time. I would also be interested in a solution, but I doubt there will be one. I think it might be a design issue with Web2py. Tamas I'm correct when I think that what you're asking is for two different programs to bind to the same socket ? I don't think that's possibile with whatever program, not only web2py. Not quite, we're using Apache WSGI, which in fact can run multiple instances of web2py on the same port, along with other python scripts as well. -- --- 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: database shootout
It's not just the legal aspect. After seeing how poorly Oracle supported OpenOffice, I would be concerned about their future support for MySQL as well. On Friday, March 8, 2013 4:43:06 AM UTC-5, Niphlod wrote: This is going nuts. He was fine until now with SQLite, either one of mysql or postgres will do fine, with a total preference on postgres if he doesn't want to employ a legal office to know if he can use mysql or not. PS: the day I'm going to choose mysql over postgres for the combined requirement of having: - a nice syntax to expose an autoincrementing field - is able to accomodate 8M rows with 3 bytes instead of 4 (I'll never consider a tiny or a smallint as an autoincrement-eligible field) it's the day I'll stop working on databases. -- --- 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: Can not check True/False on this field?
Field('is_correct', 'boolean', default=False) In the form you get a checkbox widget unless you choose otherwise. In the controller: if form.vars.is_correct: # do something else: #do otherwise Less typing. Also, look in your database back end and see how it represents the values. You will find they are surrounded by pipe characters. Web2py is using them for list separators because it expects you to store multiple values in the field. Is that what you want to do? On Friday, March 8, 2013 3:09:55 AM UTC-5, Mika Sjöman wrote: Huge thanks! That worked! Den fredagen den 8:e mars 2013 kl. 12:45:34 UTC+8 skrev weheh: What kind of error message are you getting? I assume the request.vars['lesson'] and request.vars.answer are both indices into their respective tables. However, request.vars will be holding these values as strings. Without knowing more, I would suggest putting an int() around those two vars, as in: answer = db.answer[int(request.vars.answer)] and then do your test: if 'y' in answer.is_correct: # do something else: # do something else Hope this helps. On Friday, March 8, 2013 12:37:20 PM UTC+8, Mika Sjöman wrote: Hi trying to check true false in a string set, but does not work ## db.py db.define_table('answer', Field('description'), Field('is_correct', type='list:string'), Field('belongs_to_quiz',type='reference quiz',writable=False), ) db.answer.is_correct.requires=IS_IN_SET(('y','n')) ## controller def check_if_correct_answer(): this function tests if the user answers correctly to a question and sends back a ajax response lesson = db.lesson(request.vars['lesson']) answer = db.answer(request.vars.answer) if answer.is_correct == y: #db.user_answer.insert(belongs_to_user=auth.user.id, belongs_to_lesson=lesson.id, correct='y') correct_or_not='y' else: correct_or_not='n' return jQuery('.flash').html('%s').slideDown(); % (correct_or_not) But this test with answer.is_correct does not work. Anybody has an idea on how to check? -- --- 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: Can not check True/False on this field?
Cliff is absolutely right! If all you're storing is True or False, make the field a boolean. It's much more efficient in all respects. The list: string and list: reference are most useful if you're storing a reasonably small number of one to many relationships. -- --- 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: Expecting psycopg2 error but not getting one - anybody got a clue?
That makes sense. Thank you. On Thursday, March 7, 2013 2:50:29 PM UTC-5, Niphlod wrote: seems that whatever dict you pass only the values pertaining to the table gets filled. It's useful, e.g. for fields coming from multiple tables that needs to be inserted , e.g. in a SQLFORM holding 2 tables. db.define_table('testshortcuts', Field('abcd'), Field('efgh')) Table testshortcuts (id,abcd,efgh) db.testshortcuts[0] = dict(a=1) for row in db(db.testshortcuts).select(): ... print row ... Row {'abcd': None, 'id': 1, 'efgh': None} db._lastsql 'SELECT testshortcuts.id, testshortcuts.abcd, testshortcuts.efgh FROM testshortcuts WHERE (testshortcuts.id IS NOT NULL);' db.testshortcuts[0] = dict(a=1) db._lastsql 'INSERT INTO testshortcuts(abcd,efgh) VALUES (NULL,NULL);' I don't know what agenda had the author or this feature, but it seems to have a point for flexibility. On Thursday, March 7, 2013 8:00:08 PM UTC+1, Cliff Kachinske wrote: Niphlod: It's one of the dal shortcuts. Similar to db.mytable[0] = dict(myfield='somevalue') The first one should raise an exception, but instead it inserts a record and ignores the misnamed field. Richard: The thing doesn't even fail. It just ignores the incorrect field name and inserts a record. Checking with psql I find that it inserted values for the properly named fields. I tried to see what was going on with db._lastsql, but I got back the sql that fetched the id of the last insert. Time permitting I'll look at the dal code to see if I can figure out what's going on. On Thursday, March 7, 2013 11:03:47 AM UTC-5, Niphlod wrote: I quite don't get the issue: what are you trying to do with those dicts ? On Thursday, March 7, 2013 4:54:25 PM UTC+1, Cliff Kachinske wrote: I don't know why this code does not fail. It seems like it should because there is no file 'sale_product_id' in the table. lots = db.customer_order_product_lots lots[0] = dict( customer_order_product_id=customer_order_product_id, sale_product_id=request.args(0), quantity_allocated=v, requested_ship_date=form.vars[req_date], ship_date=form.vars[act_date], ) The code should look like this: lots = db.customer_order_product_lots lots[0] = dict( customer_order_product_id=customer_order_product_id, production_job_id=production_job_id, quantity_allocated=v, requested_ship_date=form.vars[req_date], ship_date=form.vars[act_date], ) Can anyone tell me what's going on? Thanks, Cliff Kachinske -- --- 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: problem with SLQTABLE headers
why not define it on models like : db.branch.address.label=T('Address') hope this can help... On Friday, March 8, 2013 4:17:32 PM UTC+7, Geo wrote: Greetings, I have some issues with SQLTABLE when I want to use the headers argument. If I call SQLTABLE(data, _class='table table-bordered small', headers = 'fieldname:capitalize', columns = columns) I get a table with the capitalized field names If I call SQLTABLE(data, _class='table table-bordered small', headers = 'labels',columns = columns) I get an error because one of the fields is virtual and it has no label, but when I try to set the label during the field definition I get an unexpected argument on the label. The only way to have all the headers as I want is to pass a dictionary that maps 'tablename.fieldname' : 'header I want' for each field Is ths the expected behaviour? What about the virtual fields, is there a way to add a label to them? Thanks in advance. Geo p.s. using web2py 2.3.2 (2012-12-17 15:03:30) stable source on windows -- --- 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: How to validate a field using data being entered from a field next to it in same table
please try : db.SuggestionCategorizationIntersection.taxonomyDataID.requires=IS_IN_DB(db(db. TaxonomyData.taxonomyID==db.SuggestionCategorization.TaxonomyID), db.TaxonomyData.id http://db.taxonomydata.id/, '%(taxonomyName)s') hope this can help -- --- 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: database shootout
@Cliff MariaDB!! :) Richard On Fri, Mar 8, 2013 at 7:36 AM, Cliff Kachinske cjk...@gmail.com wrote: It's not just the legal aspect. After seeing how poorly Oracle supported OpenOffice, I would be concerned about their future support for MySQL as well. On Friday, March 8, 2013 4:43:06 AM UTC-5, Niphlod wrote: This is going nuts. He was fine until now with SQLite, either one of mysql or postgres will do fine, with a total preference on postgres if he doesn't want to employ a legal office to know if he can use mysql or not. PS: the day I'm going to choose mysql over postgres for the combined requirement of having: - a nice syntax to expose an autoincrementing field - is able to accomodate 8M rows with 3 bytes instead of 4 (I'll never consider a tiny or a smallint as an autoincrement-eligible field) it's the day I'll stop working on databases. -- --- 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. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Using a recursive select but encountered a broken reference
wait a sec who binds to that socket is apache, not web2py :D On Friday, March 8, 2013 1:29:23 PM UTC+1, Tamas wrote: On Friday, March 8, 2013 11:57:39 AM UTC+1, Niphlod wrote: On Friday, March 8, 2013 11:06:00 AM UTC+1, Tamas wrote: Hello, I've been having this exact same problem for a long, long time. I would also be interested in a solution, but I doubt there will be one. I think it might be a design issue with Web2py. Tamas I'm correct when I think that what you're asking is for two different programs to bind to the same socket ? I don't think that's possibile with whatever program, not only web2py. Not quite, we're using Apache WSGI, which in fact can run multiple instances of web2py on the same port, along with other python scripts as well. -- --- 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] can not get routes.py to work
I'm a routes.py newbie! Amazing it's taken me this long to really dive in. This should be trivial, but I'm struggling to get mydomain/robots.txt to map to mydomain/static/robots.txt. In fact, none of my routes_in are working. My non-working routes.py file: #!/usr/bin/python # -*- coding: utf-8 -*- default_application = 'init'# ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py routes_app = ( (r'/(?Pappmydomain|admin|appadmin|other)\b.*', r'\gapp'), (r'(.*)', r'myapp'), (r'/?(.*)', r'myapp'), ) routes_in = ( ('/favicon.ico', '/static/images/logo/favicon.ico'), ('/robots.txt', '/static/robots.txt'), ('/cgi-bin/foobar.py', '/newfoobar/index'), ) routes_out = ( ('/static/robots.txt', 'robots.txt'), ('/appadmin/(?Pany.*)', '/\gany'), ('/mydomain/(?Pany.*)', '/\gany'), ('/other/(?Pany.*)', '/\gany'), ) logging = 'debug' # Display 404 for all invalid server messages routes_onerror = [ ('*/*', '/mydomain/static/404.html'), ] Also, I would like to know what the logging='debug' does? Where does the log file go? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Using a recursive select but encountered a broken reference
True, but... Apache is not raising errors, web2py is. The error message is strange. At least we could have a nicer error if this can't be fixed. However in my example, both instances work until i try to log in. I can use the site without database i/o. Both instances work. Now, why would web2py (1) raise an exception when working with database (2) because the apache (3) configuration is bad ? Sometimes the testing instance fails on login, sometimes it is production instance... I'd like to see more about Tamas's problem. Dana petak, 8. ožujka 2013. 15:05:01 UTC+1, korisnik Niphlod napisao je: wait a sec who binds to that socket is apache, not web2py :D On Friday, March 8, 2013 1:29:23 PM UTC+1, Tamas wrote: On Friday, March 8, 2013 11:57:39 AM UTC+1, Niphlod wrote: On Friday, March 8, 2013 11:06:00 AM UTC+1, Tamas wrote: Hello, I've been having this exact same problem for a long, long time. I would also be interested in a solution, but I doubt there will be one. I think it might be a design issue with Web2py. Tamas I'm correct when I think that what you're asking is for two different programs to bind to the same socket ? I don't think that's possibile with whatever program, not only web2py. Not quite, we're using Apache WSGI, which in fact can run multiple instances of web2py on the same port, along with other python scripts as well. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Web2py 'exceptions.SyntaxError' No fields to update on heroku sometimes when login with facebook
Hello, I am using Web2py on the Heroku servers with the gunicorn server (also tried rocket) and using the helloFacebook example made by Michele Comitini ( https://code.google.com/r/michelecomitini-facebookaccess/ ). I have updated with the latest facebookforpython facebook.py file, and doing local_import instead of the global. Short version: At random times, when doing the login the redirects fails with type 'exceptions.SyntaxError' No fields to update If I drop all the databases and restart the server, then it works again (but of course I have no data!!!) Long version: First I had a problem when login, with Oauth2, instead of making a redirection to the actual server, it redirected to my web IP address, weird! I solved changing: gluon/contrib/login_methods/oauth20_account.py 105 r = current.request 106 #http_host = r.env.http_x_forwarded_for #THIS was making a problem getting my laptop address instead of my server address ... WHY?? 107 http_host = r.env.http_host - I've checked the book (The core chapter), manuals and the ref and I don't get why we would use: r.env.http_x_forwarded_for instead of r.env.http_host Any help here? Well, coming back to the main issue: The problem is, everything works great sometimes, database is working, updates, login, etc. This is from the actual production server AND with the local (foreman from heroku) server, both facebook apps running correctly. Server is either gunicorn (but I don't know how to configure the admin password to be available in a file correctly) or either with rocket (which I use for testing and being able to see the admin and the tickets). With both I'm having the same issue. facebookforpython (facebook.py file) is updated to the last version, web2py version is the latest stable. and the virtualenv requirements.txt file now contains: argparse==1.2.1 distribute==0.6.24 gunicorn==0.17.2 psycopg2==2.4.6 requests==1.1.0 wsgiref==0.1.2 For the database I am using postgres from heroku and for the configuration in the db.py file, is with: -- from gluon.contrib.heroku import get_db db = get_db() -- At a certain point (when the server gets restarted, what happens every push or once a day in heroku and every source change in the local) when I try do the login, it fails and gives me the stated error. Here: ( http://pastebin.com/y8bseuAN ) all the info about the Error. Note the trace is taken from the local server, but the info is the same when running on the production server. Questions: Why is the system trying to update the database when logging in with an Oauth system? Why is the system working correctly with a clean database, but a certain point (even if I do not modify at all myself the DB) it breaks? Any hints on how to solve this issue? Best, Leo -- --- 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] OT: Why my posts do not appear on the list?
why? -- --- 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] 'exceptions.SyntaxError' No fields to update when login on heroku + facebook
Hello, I have a facebook app hosted on heroku working with the lastest stable Web2py. Initially everything works perfect (in local and in production server), but sometimes, when restarting (in case of local on local modifications; and in case of production, either when heroku restarts the server, or on git push heroku master command), sometimes it breaks giving the error: type 'exceptions.SyntaxError' No fields to update Traces here: http://pastebin.com/y8bseuAN When this happens, the only way I have found to make it work again, is to actually reset the db (in local, erasing everything and letting web2py remake it all). This, of course, is not too nice. Details on the system, configurations, etc: Facebook application is taken from example https://code.google.com/r/michelecomitini-facebookaccess/ helloFacebook app facebook.py is updated to the latest version of the https://github.com/pythonforfacebook db is configured with: from gluon.contrib.heroku import get_db db = get_db() virtualenv is configured, requirements.txt file has the following argparse==1.2.1 distribute==0.6.24 gunicorn==0.17.2 psycopg2==2.4.6 requests==1.1.0 wsgiref==0.1.2 I have tried with gunicorn and with rocket servers, configuration Procfiles containing either: web: python anyserver.py -s gunicorn -i 0.0.0.0 -p $PORT or: web: python web2py.py -a mypasswd -i 0.0.0.0 -p $PORT Questions: Why is the system trying to update the DB when doing the login with OAuth? Why it should break when an update is empty, instead of ignoring the error and saying that nothing was done instead? Have you got any clues on how to start solving the issue? I sincerely have no clue about what lead to follow. I am tented to modify the dal.py file and tell it to ignore the error Another thing that I need to state: When first tried to login, the redirect address generated by OAuth was wrong, it gave my local personal IP address, instead of the one in the server (I don't know why), I managed to solve it modifying: gluon/contrib/login_methods/oauth20_account.py -- 105r = current.request 106#http_host = r.env.http_x_forwarded_for #THIS was making a problem getting my laptop address instead of my server address ... WHY??? 107http_host = r.env.http_host -- Reading in the book (chapter The Core) and in the ref. I do not get why we should use env.http_x_forwarded_for instead of env.http_host , Don't we want the server address to be the redirection address? Why would we even want an address that is the client AND can be spoofed? -- --- 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: can not get routes.py to work
for the logging part alter those to DEBUG https://github.com/web2py/web2py/blob/master/logging.example.conf#L59 https://github.com/web2py/web2py/blob/master/logging.example.conf#L99 and you should read it in the console. On Friday, March 8, 2013 3:08:22 PM UTC+1, weheh wrote: I'm a routes.py newbie! Amazing it's taken me this long to really dive in. This should be trivial, but I'm struggling to get mydomain/robots.txt to map to mydomain/static/robots.txt. In fact, none of my routes_in are working. My non-working routes.py file: #!/usr/bin/python # -*- coding: utf-8 -*- default_application = 'init'# ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py routes_app = ( (r'/(?Pappmydomain|admin|appadmin|other)\b.*', r'\gapp'), (r'(.*)', r'myapp'), (r'/?(.*)', r'myapp'), ) routes_in = ( ('/favicon.ico', '/static/images/logo/favicon.ico'), ('/robots.txt', '/static/robots.txt'), ('/cgi-bin/foobar.py', '/newfoobar/index'), ) routes_out = ( ('/static/robots.txt', 'robots.txt'), ('/appadmin/(?Pany.*)', '/\gany'), ('/mydomain/(?Pany.*)', '/\gany'), ('/other/(?Pany.*)', '/\gany'), ) logging = 'debug' # Display 404 for all invalid server messages routes_onerror = [ ('*/*', '/mydomain/static/404.html'), ] Also, I would like to know what the logging='debug' does? Where does the log file go? -- --- 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: Tip of the day... ajax buttons in grid
can you explain what triggers view refresh after thing.update_record(active=not thing.active) On Thursday, March 7, 2013 5:09:01 PM UTC-5, wwwgong wrote: I am using v2.4.2 on win7, tried both chrome and firefox, same issue, I have to do a refresh to see Active field checked/unchecked On Thursday, March 7, 2013 4:54:45 PM UTC-5, Massimo Di Pierro wrote: It should update it. it does for me. On Thursday, 7 March 2013 15:43:08 UTC-6, wwwgong wrote: Thanks for the tip, I noticed that the checkbox is not updated after clicking on/off button. how to make active field refresh automatically On Wednesday, March 6, 2013 9:09:41 PM UTC-5, Massimo Di Pierro wrote: Do you know you can do this? db.define_table('thing',Field('name'),Field('active','boolean',default=False)) @auth.requires_login() def index(): grid = SQLFORM.grid(db.thing, inks=[lambda row: A('on' if row.active else 'off', _class='btn', _id='t%i'%row.id, target='t%i'%row.id, callback=URL('activate',args=row.id ))]) return dict(grid=grid) @auth.requires_login() def activate(): if request.env.request_method=='POST': thing = db.thing(request.args(0,cast=int)) thing.update_record(active=not thing.active) return 'on' if thing.active else 'off' It makes Ajax buttons which toggle on/off the value of thing.active field for each row. -- --- 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: can not get routes.py to work
Sorry, I don't follow. Alter what to DEBUG? Don't know what that means. Can you see anything wrong with my routes.py file that causes www.mydomain.com/robots.txt to generate a 404 error? On Friday, March 8, 2013 10:18:25 PM UTC+8, Niphlod wrote: for the logging part alter those to DEBUG https://github.com/web2py/web2py/blob/master/logging.example.conf#L59 https://github.com/web2py/web2py/blob/master/logging.example.conf#L99 and you should read it in the console. On Friday, March 8, 2013 3:08:22 PM UTC+1, weheh wrote: I'm a routes.py newbie! Amazing it's taken me this long to really dive in. This should be trivial, but I'm struggling to get mydomain/robots.txt to map to mydomain/static/robots.txt. In fact, none of my routes_in are working. My non-working routes.py file: #!/usr/bin/python # -*- coding: utf-8 -*- default_application = 'init'# ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py routes_app = ( (r'/(?Pappmydomain|admin|appadmin|other)\b.*', r'\gapp'), (r'(.*)', r'myapp'), (r'/?(.*)', r'myapp'), ) routes_in = ( ('/favicon.ico', '/static/images/logo/favicon.ico'), ('/robots.txt', '/static/robots.txt'), ('/cgi-bin/foobar.py', '/newfoobar/index'), ) routes_out = ( ('/static/robots.txt', 'robots.txt'), ('/appadmin/(?Pany.*)', '/\gany'), ('/mydomain/(?Pany.*)', '/\gany'), ('/other/(?Pany.*)', '/\gany'), ) logging = 'debug' # Display 404 for all invalid server messages routes_onerror = [ ('*/*', '/mydomain/static/404.html'), ] Also, I would like to know what the logging='debug' does? Where does the log file go? -- --- 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: OT: Why my posts do not appear on the list?
This is a moderated group to avoid spam, but you have been cleared for posting now :) On Friday, March 8, 2013 5:41:22 AM UTC-5, Leo Rocha wrote: why? -- --- 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] Most Missing features in Web2Py
Hello François, On Fri, Mar 1, 2013 at 4:06 AM, François Delpierre francois.delpie...@gmail.com wrote: I'm using Web2Py for 6 months now, and I'm very happy with it. But here are the most missing features I found in Web2Py. Most of those missing features concerns grids/smartgrids. - inline_editing parameter for SQLFORM.(smart)grid to allow inline edition of some or all fields (ajax), without the need to go on a dedicated Edit page for every change. - Bulk editing: select some of the lines, and change one of the field to the same value. Very usefull when contraint IS_IN_... . - when a string field has the requires=IS_IN_SET(...) constraint, I would expect to have those predefined choices in the search form also, (and possibly keep one option for the free text search.) - Allow wildcards for simple searchs, but also regular expression if search string withing ! or / marks. - Allow a different representation in table than in view, in order to be able to have short fields in table when a mapping function is defined. For instance, if in the view forms we have company department field with requires=IS_IN_SET('Information Technology', 'Accounting Finance', 'Human Resources'), and if I defined the appropriate mapping function, I would like to see IT, AF and HR in the table view, to be able to display more columns. This is possible with represent if you use IS_IN_DB... You can use your requires=IS_IN_DB(...) than your drop down will be the way you want them to be and you can set your represent to use a different representation for the select to be able to cast more columns in the same amount of space. For this will have to make a look table with 2 differents representation field (long represent and short reprensent) and refer to one of each in your requires and represent. Also, using IS_IN_SET is only for convenience, because you hardcode your modality... Imagine there is more sector in your business you need to go back in the app code to add the new sector or change there name, it make no sens for big app so you better create look up table for those drop down anyway. Also, IS_IN_SET() prevent you to make your database respect the normal form becase it spread the same value all over the table, so you are stuck with the second normal form for this table and you have to think to update all the record if you change you IS_IN_SET() modality. - Option to disable the Delete confirmation from the smartgrid definition. (for only one form) - Export computed fields, either as text, either as html, or maybe default to export links, and provide a links_export similar to links but used for exporting data. Set links_export to None to prevent exporting links fields. - Autocompletion / help in the online code editor. Code completion is possible if you use the amy editor included in web2py but not available by defaut in the admin interface. https://groups.google.com/d/msg/web2py/1l9JrYVvUvM/4QkZwtY2zL4J This post is old and can't ensure that amy is still available, but I guess that it is still available... But as soon as you get more serious at web app developping you would use a IDE or a good text editor like Geany or Gedit... I start using Geany recently and it pretty near a IDE and very ligth weigth for the set of feature it offers. That what I can answer to the set of requirement you post, as I am not aware of all the web2py cooking new features... I know that inline edition is a work and progress so we will maybe have this in the near future. Richard -- --- 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. -- --- 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: can not get routes.py to work
after those there was a pointer to the relevant line in logging.conf embedded in the web2py repository: unfortunately I can't help you further because I have no python available right now, so no web2py either ^_^ On Friday, March 8, 2013 3:29:16 PM UTC+1, weheh wrote: Sorry, I don't follow. Alter what to DEBUG? Don't know what that means. Can you see anything wrong with my routes.py file that causes www.mydomain.com/robots.txt to generate a 404 error? On Friday, March 8, 2013 10:18:25 PM UTC+8, Niphlod wrote: for the logging part alter those to DEBUG https://github.com/web2py/web2py/blob/master/logging.example.conf#L59 https://github.com/web2py/web2py/blob/master/logging.example.conf#L99 and you should read it in the console. On Friday, March 8, 2013 3:08:22 PM UTC+1, weheh wrote: I'm a routes.py newbie! Amazing it's taken me this long to really dive in. This should be trivial, but I'm struggling to get mydomain/robots.txt to map to mydomain/static/robots.txt. In fact, none of my routes_in are working. My non-working routes.py file: #!/usr/bin/python # -*- coding: utf-8 -*- default_application = 'init'# ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py routes_app = ( (r'/(?Pappmydomain|admin|appadmin|other)\b.*', r'\gapp'), (r'(.*)', r'myapp'), (r'/?(.*)', r'myapp'), ) routes_in = ( ('/favicon.ico', '/static/images/logo/favicon.ico'), ('/robots.txt', '/static/robots.txt'), ('/cgi-bin/foobar.py', '/newfoobar/index'), ) routes_out = ( ('/static/robots.txt', 'robots.txt'), ('/appadmin/(?Pany.*)', '/\gany'), ('/mydomain/(?Pany.*)', '/\gany'), ('/other/(?Pany.*)', '/\gany'), ) logging = 'debug' # Display 404 for all invalid server messages routes_onerror = [ ('*/*', '/mydomain/static/404.html'), ] Also, I would like to know what the logging='debug' does? Where does the log file go? -- --- 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] 'exceptions.SyntaxError' No fields to update when login on heroku + facebook
Update, I found (testig with other facebook user) that the problem is not when I reboot the server, but when a user tries to log in for the second time. Following the trace I finally found that there is a call to the gluon/dal.py RecordUpdater.__call__(**fields) Where fields = {registration_id: u11} as registration_id is not in in table.fields [id, first_name, last_name, username, password, registration_key] (auth_user defined in helloFacebook) the field registration_id is erased from the dict: if not fieldname in table.fields or table[fieldname].type=='id': del newfields[fieldname] and an empty call is issued to Auth.get_or_create_user(self, keys, update_fields=['email']) (file in gluon/tools.py) There is the reason of the error. BUT as I see, there is the need to have a username instead of a registration_id for the call to be done correctly and the table in my db.py is: auth_table = db.define_table( auth.settings.table_user_name, Field('first_name', length=128, default=), Field('last_name', length=128, default=), Field('username', length=128, default=, unique=True), Field('password', 'password', length=256, readable=False, label='Password'), Field('registration_key', length=128, default= , writable=False, readable=False)) I tried with Field('registration_id', length=128, default=, unique=True), instead of username, but this time the error is that there is no 'email' field So following the login call, again I found out that RecordUpdater.__call__(**fields) is generated only when the user has already logged in at least once with facebook, the question is: Why does it want to update the fields?? Checking: gluon/tools.py and gluon/dal.py again I found that the problem was in gluon/tools.py (line 1930) def Auth.login() and in relationship with the field I do get (registration_id, that I do not know where it comes, but I think is from facebook) So this is what is in the file: if self.settings.login_userfield: username = self.settings.login_userfield elif 'username' in table_user.fields: username = 'username' else: username = 'email' if 'username' in table_user.fields or \ not self.settings.login_email_validate: tmpvalidator = IS_NOT_EMPTY(error_message=self.messages.is_empty) And i added for it to actually check for registration_id also entonces le agregue: if self.settings.login_userfield: username = self.settings.login_userfield elif 'username' in table_user.fields: username = 'username' elif 'registration_id' in table_user.fields: username = 'registration_id' else: username = 'email' if 'username' in table_user.fields or 'registration_id' in table_user.fields or \ not self.settings.login_email_validate: tmpvalidator = IS_NOT_EMPTY(error_message=self.messages.is_empty) This actually solves my problem, BUT, I want to know, Am I doing something REALLY wrong here? What would be a way to actually solve the issue but without modifying the web2py framework? Or it is seriously something to modify in the gluon/tools.py file? Questions: Why is the system trying to update the DB when doing the login with OAuth? Have you got any clues on how to start solving the issue? Any hints here? Another thing that I need to state: When first tried to login, the redirect address generated by OAuth was wrong, it gave my local personal IP address, instead of the one in the server (I don't know why), I managed to solve it modifying: gluon/contrib/login_methods/oauth20_account.py -- 105r = current.request 106#http_host = r.env.http_x_forwarded_for #THIS was making a problem getting my laptop address instead of my server address ... WHY??? 107http_host = r.env.http_host -- Reading in the book (chapter The Core) and in the ref. I do not get why we should use env.http_x_forwarded_for instead of env.http_host , Don't we want the server address to be the redirection address? Why would we even want an address that is the client AND can be spoofed? Any hints here? -- Ing. Leonardo Manuel Rocha -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Using a recursive select but encountered a broken reference
On Friday, March 8, 2013 3:16:25 PM UTC+1, Marin Pranjić wrote: True, but... Apache is not raising errors, web2py is. The error message is strange. At least we could have a nicer error if this can't be fixed. However in my example, both instances work until i try to log in. I can use the site without database i/o. Both instances work. Now, why would web2py (1) raise an exception when working with database (2) because the apache (3) configuration is bad ? Sometimes the testing instance fails on login, sometimes it is production instance... I'd like to see more about Tamas's problem. Well, we're running a very busy WSGI Python sctipt alongside a few web2py instances, and just like with your setup the only error that happens is when we try to log in on a w2p instance that uses the same mysql database as the other WSGI script. I've e-mailed Massimo with more details a couple of months ago, and he promised to look into the problem, but he never checked back, and my further inquiries had no answer, so I guess it's not an easy fix :( -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Using a recursive select but encountered a broken reference
yep, got that part: I don't use apache and never had any problems with multiple version running concurrently, but I guess there's a ton of users out there using apache...I don't think that is a problem related to having multiple web2py instances responding to the same port because that's what apache is there for. Maybe some weird transaction isolation problem on the db part ? On Friday, March 8, 2013 3:16:25 PM UTC+1, Marin Pranjić wrote: True, but... Apache is not raising errors, web2py is. The error message is strange. At least we could have a nicer error if this can't be fixed. However in my example, both instances work until i try to log in. I can use the site without database i/o. Both instances work. Now, why would web2py (1) raise an exception when working with database (2) because the apache (3) configuration is bad ? Sometimes the testing instance fails on login, sometimes it is production instance... I'd like to see more about Tamas's problem. Dana petak, 8. ožujka 2013. 15:05:01 UTC+1, korisnik Niphlod napisao je: wait a sec who binds to that socket is apache, not web2py :D On Friday, March 8, 2013 1:29:23 PM UTC+1, Tamas wrote: On Friday, March 8, 2013 11:57:39 AM UTC+1, Niphlod wrote: On Friday, March 8, 2013 11:06:00 AM UTC+1, Tamas wrote: Hello, I've been having this exact same problem for a long, long time. I would also be interested in a solution, but I doubt there will be one. I think it might be a design issue with Web2py. Tamas I'm correct when I think that what you're asking is for two different programs to bind to the same socket ? I don't think that's possibile with whatever program, not only web2py. Not quite, we're using Apache WSGI, which in fact can run multiple instances of web2py on the same port, along with other python scripts as well. -- --- 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] can not get routes.py to work
On 8 Mar 2013, at 6:08 AM, weheh richard_gor...@verizon.net wrote: I'm a routes.py newbie! Amazing it's taken me this long to really dive in. This should be trivial, but I'm struggling to get mydomain/robots.txt to map to mydomain/static/robots.txt. In fact, none of my routes_in are working. My non-working routes.py file: #!/usr/bin/python # -*- coding: utf-8 -*- default_application = 'init'# ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py routes_app = ( (r'/(?Pappmydomain|admin|appadmin|other)\b.*', r'\gapp'), (r'(.*)', r'myapp'), (r'/?(.*)', r'myapp'), ) routes_in = ( ('/favicon.ico', '/static/images/logo/favicon.ico'), ('/robots.txt', '/static/robots.txt'), ('/cgi-bin/foobar.py', '/newfoobar/index'), ) routes_out = ( ('/static/robots.txt', 'robots.txt'), ('/appadmin/(?Pany.*)', '/\gany'), ('/mydomain/(?Pany.*)', '/\gany'), ('/other/(?Pany.*)', '/\gany'), ) logging = 'debug' # Display 404 for all invalid server messages routes_onerror = [ ('*/*', '/mydomain/static/404.html'), ] Also, I would like to know what the logging='debug' does? Where does the log file go? Routes uses the standard logging mechanism; use logging.conf to configure it. Routes logs at a configurable loglevel, so you can raise it temporarily in routes.py to debug your routes logic without reconfiguring logging.conf. If you're using the pattern-matching router, you generally don't need routes_app unless you have multiple (per-app) routes.py files. It does *not* route requests themselves to apps; it simply chooses which routes.py to use if more than one is present. Presumably you want to be sending /robots.txt to /myapp/static/robots.txt (and so on). -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Using a recursive select but encountered a broken reference
Would you mind emailing me the details? I won't promise, but I plan to look into it next week. Dana petak, 8. ožujka 2013. 15:49:42 UTC+1, korisnik Tamas napisao je: On Friday, March 8, 2013 3:16:25 PM UTC+1, Marin Pranjić wrote: True, but... Apache is not raising errors, web2py is. The error message is strange. At least we could have a nicer error if this can't be fixed. However in my example, both instances work until i try to log in. I can use the site without database i/o. Both instances work. Now, why would web2py (1) raise an exception when working with database (2) because the apache (3) configuration is bad ? Sometimes the testing instance fails on login, sometimes it is production instance... I'd like to see more about Tamas's problem. Well, we're running a very busy WSGI Python sctipt alongside a few web2py instances, and just like with your setup the only error that happens is when we try to log in on a w2p instance that uses the same mysql database as the other WSGI script. I've e-mailed Massimo with more details a couple of months ago, and he promised to look into the problem, but he never checked back, and my further inquiries had no answer, so I guess it's not an easy fix :( -- --- 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] Reuse of db.define_table field definition in SQLFORM.factory() is it possible?
Hello, I would like to build a form that will contain many row for the same table to make a kind of batch insert of record a given table. Now I am searching a way to append many different instance of the same fields definition for a given table into SQLFORM.factory... Something like that : inputs = [] for i in range(0,10): inputs.append(subSetOfTableDifinedField) # HERE I would avoid redefining the field of the table that are already defined form = SQLFORM.factory(*inputs) So, I would like to get : Field('field1', 'type', ...) of a given table define... Are the field of each table define contained in a variable internally that I can access or web2py only parse Models? Thanks Richard -- --- 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] Reuse of db.define_table field definition in SQLFORM.factory() is it possible?
Ok, forget about that, I didn't know I could just do this : SQLFORM.factory(db.table1.field1, db.table1.field2) Richard On Fri, Mar 8, 2013 at 10:26 AM, Richard ml.richard.vez...@gmail.comwrote: Hello, I would like to build a form that will contain many row for the same table to make a kind of batch insert of record a given table. Now I am searching a way to append many different instance of the same fields definition for a given table into SQLFORM.factory... Something like that : inputs = [] for i in range(0,10): inputs.append(subSetOfTableDifinedField) # HERE I would avoid redefining the field of the table that are already defined form = SQLFORM.factory(*inputs) So, I would like to get : Field('field1', 'type', ...) of a given table define... Are the field of each table define contained in a variable internally that I can access or web2py only parse Models? Thanks Richard -- --- 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. -- --- 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] Reuse of db.define_table field definition in SQLFORM.factory() is it possible?
How I could re-instanciate each field in my for loop? If I do this : inputs = [] for i in range(0,10): inputs.append(db.table1.field1) inputs.append(db.table1.field2) Even if I get 10 inputs of each they all refer to the same instance so when I render the form with SQLFORM.factory I only get my 2 fields, but I would have 10 of each... Thanks Richard On Fri, Mar 8, 2013 at 10:33 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: Ok, forget about that, I didn't know I could just do this : SQLFORM.factory(db.table1.field1, db.table1.field2) Richard On Fri, Mar 8, 2013 at 10:26 AM, Richard ml.richard.vez...@gmail.comwrote: Hello, I would like to build a form that will contain many row for the same table to make a kind of batch insert of record a given table. Now I am searching a way to append many different instance of the same fields definition for a given table into SQLFORM.factory... Something like that : inputs = [] for i in range(0,10): inputs.append(subSetOfTableDifinedField) # HERE I would avoid redefining the field of the table that are already defined form = SQLFORM.factory(*inputs) So, I would like to get : Field('field1', 'type', ...) of a given table define... Are the field of each table define contained in a variable internally that I can access or web2py only parse Models? Thanks Richard -- --- 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. -- --- 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] Distinct expression only supported on Postgres?
DISTINCT and DISTINCT ON are two differents things : http://www.postgresql.org/docs/9.1/static/sql-select.html#SQL-DISTINCT I think that this is a issue with differents adaptors... And you maybe right that DISTINCT ON is only available on postgres... Richard On Fri, Mar 8, 2013 at 5:31 AM, Marin Pranjić marin.pran...@gmail.comwrote: A quote from the book: Notice that distinct can also be an expression for example: for row in db().select(db.person.name,distinct=db.person.name): print row.name Alex Bob Carl While this works on PostgreSQL, others raise an exception. OperationalError: near ON: syntax error This is what I get on SQLite. It makes sense because 'DISTINCT ON' is only supported by Postgres (correct me if I'm wrong). Do we need this in the book? -- --- 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. -- --- 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] Scheduler and legacy databases
Please open a ticket about this. On Friday, 8 March 2013 02:28:13 UTC-6, Massimiliano wrote: Is there any chance to take a look on this problem? Thank you On Mon, Feb 25, 2013 at 7:42 PM, Massimiliano mbel...@gmail.comjavascript: wrote: Hi, I'm working on a legacy database where all boolean are mapped to 0, -1. In my application I redefine adapter TRUE/FALSE as saw in this group. In db.py: db = DAL('postgres://postgres@127.0.0.1/logistica') import copy db._adapter.types = copy.copy(db._adapter.types) db._adapter.types['boolean']='SMALLINT' db._adapter.TRUE = -1 db._adapter.FALSE = 0 Now I'm trying to use the scheduler but I found that running ./web2py.py-K logistica it doesn't take care (or it redefine to default 'F' and 'T') of my custom db._adapter.FALSE and db._adapter.TRUE. Is there something that I can do to help fixing that? I think that to support custom boolean value is very important where working on legacy databases. Thank you very much -- Massimiliano -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Massimiliano -- --- 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: database shootout
Sorry I misunderstood your previous statement. On Friday, 8 March 2013 03:09:31 UTC-6, Vineet wrote: That's true. But 'Serial' gives four-byte integer (no other option). In MySQL's autoincrement, we can define it on any size of variable (tinyint, mediumint, int, etc.). IMHO, this flexibility would make a difference when data size is large. -- --- 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: How to validate a field using data being entered from a field next to it in same table
Are you saying you want the form dropdown dynamically populated with a subset of records based on the selection in a different field? If so, you'll have to do that with Javascript and an Ajax call. See http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910 for some ideas. Anthony On Friday, March 8, 2013 2:34:56 AM UTC-5, Alex Glaros wrote: I want to limit IS_IN_DB to a table whose fields match what is being entered in an adjoining field in the same table. Tables: *Taxonomy* is the taxonomy type and contains the types of taxonomies, e.g., plants taxonomy, computer languages taxonomy. *TaxonomyData* is the detail taxonomy of each taxonomy type, e.g., for plants, it could have roses, acorn trees, rice, and, for computer languages, it could have python, java, and perl. Taxonomy is the parent of TaxonomyData. *Suggestion* is a table of suggestions. *SuggestionCategorizationIntersection* table categorizes Suggestion data using Taxonomy and TaxonomyData. db.define_table('*Suggestion*'...) db.define_table('*Taxonomy*', Field('taxonomyShortName','string'), Field('taxonomyLongName','string'), db.define_table('*TaxonomyData'*, Field('taxonomyID','reference Taxonomy'), Field('taxonomyName','string'), Field('taxonomyDataID','string'), Field('taxonomyDataName','string'), db.define_table('*SuggestionCategorizationIntersection*', Field('suggestionID','reference Suggestion'), Field('taxonomyID','reference Taxonomy'), Field('taxonomyDataID','reference TaxonomyData')) Now if I use the code below, I get ALL of data in TaxonomyData, but I only want that data that matches what user typed in the adjoining TaxonomyID field in SuggestionCategorizationIntersection. db.SuggestionCategorizationIntersection.taxonomyDataID.requires = IS_IN_DB(db, db.TaxonomyData.id, '%(taxonomyDataName)s',zero=T('choose one')) ##--- I get too much data I want to choose from taxonomyDataID data where the taxonomyID for it in TaxonomyData only matches the TaxonomyID the user is entering in SuggestionCategorizationIntersection.taxonomyDataID. These two fields are next to each other in SuggestionCategorizationIntersection. Ideally, I'd like to be able to do something like this: db.SuggestionCategorizationIntersection.taxonomyDataID.requires = IS_IN_DB(db, db.TaxonomyData.id WHERE TaxonomyData.taxonomyID = SuggestionCategorization.TaxonomyID The record hasn't been saved yet so how would web2py know what is in the SuggestionCategorization.TaxonomyID record user is typing in? See field colored red above. Can someone please write out the syntax for this requires clause? I'm testing in the appadmin. Thanks, Alex Glaros -- --- 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: How to populate a SELECT field from a SQLFORM
See http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910 . On Friday, March 8, 2013 2:03:28 AM UTC-5, José Manuel López Muñoz wrote: Thank you Niphlod, I've do it with the Cities, but now I've to populate the hotels dropdown with the hotels available in a City. I want to do it with a JavaScript (Onchange), this way when a City is selected I can populate the hotels dropdown with the hotels available. I've the request (is trivial) to the data base, the hotels in a Array, but I don't know how to insert the values in the dropdown. Any clue about how to do it? :) On Thursday, March 7, 2013 4:33:35 PM UTC+1, Niphlod wrote: you can do as you did with the hotels (i.e. passing a queryset already filtered instead of a table to the IS_IN_DB) or create a dict holding a few cities with as the key the id of the city and the value the name of it. On Thursday, March 7, 2013 3:52:24 PM UTC+1, José Manuel López Muñoz wrote: Hi, I'm trying to populate a drop down menu of a form like this: def createOffer(): hotelesUsuario=db(db.Hotel.managerID == auth.user_id) db.Offer.hotel.requires=IS_IN_DB(hotelesUsuario,'Hotel.id','%(name)s') form = SQLFORM(db.Offer) This is my Offer table: db.define_table('Offer', SQLField('created_on', 'datetime', label=D√≠a de creaci√≥n de la oferta, writable=False, default=request.now), SQLField('valid_from_date', 'datetime', label=Oferta desde el d√≠a, default = request.now), SQLField('valid_to_date', 'datetime', label=Oferta hasta el d√≠a, default = request.now), SQLField('selected','boolean', default=False, readable=False, writable=False), SQLField('city',db.City, label=Ciudad), SQLField('hotel',db.Hotel), SQLField('num_rooms', label=N√∫mero de habitaciones, default=1), format=%(id)s) I want to populate the DropDown menu city with some cities (not all the cities, like now) in my database How can I do it? form.var.city = ¿?¿? I have tried many things but is clear I don't know how to do it. Any help will be very appreciated :) -- --- 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] Distinct expression only supported on Postgres?
In web2py, distinct can be boolean (distinct=True) or an expression, as quoted from the book. Boolean works fine, but expression maps to DISTINCT ON. It is in BaseAdapter class, _select method. I think only nosql adapters override that method. Marin (mobile) On Mar 8, 2013 4:48 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: DISTINCT and DISTINCT ON are two differents things : http://www.postgresql.org/docs/9.1/static/sql-select.html#SQL-DISTINCT I think that this is a issue with differents adaptors... And you maybe right that DISTINCT ON is only available on postgres... Richard On Fri, Mar 8, 2013 at 5:31 AM, Marin Pranjić marin.pran...@gmail.com wrote: A quote from t... -- --- 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] [new] cPickle - how and where to load a cPickle's file
Hi all, A question I think very simple but I don't resolve it : Some informations that I want to introduce in my site with Web2py comes in a cPickle's file. I have all the time the error that I don't resolve in the framework Web2Py : [Errno 2] No such file or directory Thus I have 2 questions : How can say to Web2Py where find my cPikle's file ? The program that extracts the informations of the cPickle's file must be where in the organisation of Web2Py : controller/index.py for exemple or somewhere else...? Thanks for your patience, bruno -- --- 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] Override _autocomplete function
I have been using the autocomplete widget which makes is really convenient. However, there are times where I would like to customise what is shown in the SELECT say with a custom expression rather than being limited to each OPTION being the value of the field in the row. It appears that the autocomplete widget does not accept a lambda in place of a field. However, I guess one approach would be to define a virtual field which could then be listed on the option. However, in my usage scenario, I am looking for a way to display full addresses in the SELECT when the user starts to enter a fragment of the postcode. Given that postcodes are expected at the end of the address rather than at the start, the autocomplete will not match that. Also, I am not sure if it would be a good idea to do this with a virtual field over a large addresses dataset. So, as an alternative, I have been toying with a workaround in which I try to override the autocomplete AJAX call. Say given a function/url /address, I have the following in my controller: def address(): if request.vars._autocomplete_address_postcode: return SELECT([OPTION(%s %s % (r.addr, r.postcode) for r in db(db.address.postcode.like('%s%%' %request .vars._autocomplete_address_postcode)).select()]) This however does not appear to run and I still get the default autocomplete behaviour. Any ideas? -- --- 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] 'exceptions.SyntaxError' No fields to update when login on heroku + facebook
Leo, I http_x_forwarded_for was for reversed proxy web2py installations. I removed it until as you did until we find a better solution. I will look into registration_id issue as soon as I get on a desk... tnx mic 2013/3/8 Leonardo M. Rocha leo.m.ro...@gmail.com: Update, I found (testig with other facebook user) that the problem is not when I reboot the server, but when a user tries to log in for the second time. Following the trace I finally found that there is a call to the gluon/dal.py RecordUpdater.__call__(**fields) Where fields = {registration_id: u11} as registration_id is not in in table.fields [id, first_name, last_name, username, password, registration_key] (auth_user defined in helloFacebook) the field registration_id is erased from the dict: if not fieldname in table.fields or table[fieldname].type=='id': del newfields[fieldname] and an empty call is issued to Auth.get_or_create_user(self, keys, update_fields=['email']) (file in gluon/tools.py) There is the reason of the error. BUT as I see, there is the need to have a username instead of a registration_id for the call to be done correctly and the table in my db.py is: auth_table = db.define_table( auth.settings.table_user_name, Field('first_name', length=128, default=), Field('last_name', length=128, default=), Field('username', length=128, default=, unique=True), Field('password', 'password', length=256, readable=False, label='Password'), Field('registration_key', length=128, default= , writable=False, readable=False)) I tried with Field('registration_id', length=128, default=, unique=True), instead of username, but this time the error is that there is no 'email' field So following the login call, again I found out that RecordUpdater.__call__(**fields) is generated only when the user has already logged in at least once with facebook, the question is: Why does it want to update the fields?? Checking: gluon/tools.py and gluon/dal.py again I found that the problem was in gluon/tools.py (line 1930) def Auth.login() and in relationship with the field I do get (registration_id, that I do not know where it comes, but I think is from facebook) So this is what is in the file: if self.settings.login_userfield: username = self.settings.login_userfield elif 'username' in table_user.fields: username = 'username' else: username = 'email' if 'username' in table_user.fields or \ not self.settings.login_email_validate: tmpvalidator = IS_NOT_EMPTY(error_message=self.messages.is_empty) And i added for it to actually check for registration_id also entonces le agregue: if self.settings.login_userfield: username = self.settings.login_userfield elif 'username' in table_user.fields: username = 'username' elif 'registration_id' in table_user.fields: username = 'registration_id' else: username = 'email' if 'username' in table_user.fields or 'registration_id' in table_user.fields or \ not self.settings.login_email_validate: tmpvalidator = IS_NOT_EMPTY(error_message=self.messages.is_empty) This actually solves my problem, BUT, I want to know, Am I doing something REALLY wrong here? What would be a way to actually solve the issue but without modifying the web2py framework? Or it is seriously something to modify in the gluon/tools.py file? Questions: Why is the system trying to update the DB when doing the login with OAuth? Have you got any clues on how to start solving the issue? Any hints here? Another thing that I need to state: When first tried to login, the redirect address generated by OAuth was wrong, it gave my local personal IP address, instead of the one in the server (I don't know why), I managed to solve it modifying: gluon/contrib/login_methods/oauth20_account.py -- 105r = current.request 106#http_host = r.env.http_x_forwarded_for #THIS was making a problem getting my laptop address instead of my server address ... WHY??? 107http_host = r.env.http_host -- Reading in the book (chapter The Core) and in the ref. I do not get why we should use env.http_x_forwarded_for instead of env.http_host , Don't we want the server address to be the redirection address? Why would we even want an address that is the client AND can be spoofed? Any hints here? -- Ing. Leonardo Manuel Rocha -- --- 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] Re: database shootout
web2py works nicely with Firebird DB. Highly recommended. On Thursday, March 7, 2013 3:41:18 PM UTC-5, BlueShadow wrote: Hi guys so I learned that using SQLlite for me wasn't a great choice(thanks Niphlod). But since I started using databases when I started to use web2py. I got no clue what database to use. I used sqllite because it was in the welcome app and it worked while having my site offline and with me being the only user. I know the choice is mostly personal prefrence but I thought give it a trail and ask you guys why you chose your particular database. It would be really nice if you could tell me a few pros and cons. I researched a little on PostgreSQL, MySQL and SQLite the informations I got were sometimes contradicting. I got about 2 times a writing command per page per visit. (keeping track of views for articles) but apparently thats already too much for SQLite. -- --- 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: database shootout
@Richard Yeah, I know. But what about documentation? The MySQL code itself is free open source, but Oracle owns the copyright on the MySQL documentation. So as the MariaDB fork adds features, the MySQL documentation becomes more and more inaccurate. At some point there will have to be a full rewrite of the MariaDB docs. Just seems too messy. On Friday, March 8, 2013 8:44:52 AM UTC-5, Richard wrote: @Cliff MariaDB!! :) Richard On Fri, Mar 8, 2013 at 7:36 AM, Cliff Kachinske cjk...@gmail.comjavascript: wrote: It's not just the legal aspect. After seeing how poorly Oracle supported OpenOffice, I would be concerned about their future support for MySQL as well. On Friday, March 8, 2013 4:43:06 AM UTC-5, Niphlod wrote: This is going nuts. He was fine until now with SQLite, either one of mysql or postgres will do fine, with a total preference on postgres if he doesn't want to employ a legal office to know if he can use mysql or not. PS: the day I'm going to choose mysql over postgres for the combined requirement of having: - a nice syntax to expose an autoincrementing field - is able to accomodate 8M rows with 3 bytes instead of 4 (I'll never consider a tiny or a smallint as an autoincrement-eligible field) it's the day I'll stop working on databases. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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: database shootout
Thanks Cliff I wasn't about that issue, it's good to know that. I would be really curious to know if the MySQL user base had splitted since the MariaDB fork and what the proportion that stays with MySQL and now with MariaDB... Richard On Fri, Mar 8, 2013 at 3:17 PM, Cliff Kachinske cjk...@gmail.com wrote: @Richard Yeah, I know. But what about documentation? The MySQL code itself is free open source, but Oracle owns the copyright on the MySQL documentation. So as the MariaDB fork adds features, the MySQL documentation becomes more and more inaccurate. At some point there will have to be a full rewrite of the MariaDB docs. Just seems too messy. On Friday, March 8, 2013 8:44:52 AM UTC-5, Richard wrote: @Cliff MariaDB!! :) Richard On Fri, Mar 8, 2013 at 7:36 AM, Cliff Kachinske cjk...@gmail.com wrote: It's not just the legal aspect. After seeing how poorly Oracle supported OpenOffice, I would be concerned about their future support for MySQL as well. On Friday, March 8, 2013 4:43:06 AM UTC-5, Niphlod wrote: This is going nuts. He was fine until now with SQLite, either one of mysql or postgres will do fine, with a total preference on postgres if he doesn't want to employ a legal office to know if he can use mysql or not. PS: the day I'm going to choose mysql over postgres for the combined requirement of having: - a nice syntax to expose an autoincrementing field - is able to accomodate 8M rows with 3 bytes instead of 4 (I'll never consider a tiny or a smallint as an autoincrement-eligible field) it's the day I'll stop working on databases. -- --- 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_outhttps://groups.google.com/groups/opt_out . -- --- 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. -- --- 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] 'exceptions.SyntaxError' No fields to update when login on heroku + facebook
Even if you can modify tools.py, my suggestion is to modify your db.py code. Remember that you can do many things sub-classing the OAuthAccount class! This is what I use these very days. Look what you can do in the get_user() method. Just map any of the returned attributes from facebook onto the required attributes of the auth table. HTH mic class FaceBookAccount(OAuthAccount): OAuth impl for FaceBook AUTH_URL=https://graph.facebook.com/oauth/authorize; #AUTH_URL=https://graph.facebook.com/oauth/authorize?display=popup; TOKEN_URL=https://graph.facebook.com/oauth/access_token; def __init__(self): OAuthAccount.__init__(self, None, FB_CLIENT_ID, FB_CLIENT_SECRET, self.AUTH_URL, self.TOKEN_URL, scope='email,user_about_me,user_activities, user_birthday, user_education_history, user_groups, user_hometown, user_interests, user_likes, user_location, user_relationships, user_relationship_details, user_religion_politics, user_subscriptions, user_work_history, user_photos, user_status, user_videos, publish_actions', state=auth_provider=facebook, display='popup') self.graph = None def get_user(self): '''Returns the user using the Graph API. ''' if not self.accessToken(): return None if not self.graph: self.graph = GraphAPI((self.accessToken())) user = None try: user = self.graph.get_object(me) except GraphAPIError, e: session.token = None self.graph = None if user: if not user.has_key('username'): username = user['id'] else: username = user['username'] session.my_auth_token=self.accessToken(), return dict(first_name = user['first_name'], last_name = user['last_name'], username = username, email = user['email']) ) def logout_url(self, next=/): graph_url = https://graph.facebook.com/me/permissions?method=deleteaccess_token=%s; % self.accessToken() urllib2.urlopen(graph_url).read() session.auth_provider = None return super(FaceBookAccount, self).logout_url(next) Il giorno venerdì 8 marzo 2013 18:46:14 UTC+1, Michele Comitini ha scritto: Leo, I http_x_forwarded_for was for reversed proxy web2py installations. I removed it until as you did until we find a better solution. I will look into registration_id issue as soon as I get on a desk... tnx mic 2013/3/8 Leonardo M. Rocha Update, I found (testig with other facebook user) that the problem is not when I reboot the server, but when a user tries to log in for the second time. Following the trace I finally found that there is a call to the gluon/dal.py RecordUpdater.__call__(**fields) Where fields = {registration_id: u11} as registration_id is not in in table.fields [id, first_name, last_name, username, password, registration_key] (auth_user defined in helloFacebook) the field registration_id is erased from the dict: if not fieldname in table.fields or table[fieldname].type=='id': del newfields[fieldname] and an empty call is issued to Auth.get_or_create_user(self, keys, update_fields=['email']) (file in gluon/tools.py) There is the reason of the error. BUT as I see, there is the need to have a username instead of a registration_id for the call to be done correctly and the table in my db.py is: auth_table = db.define_table( auth.settings.table_user_name, Field('first_name', length=128, default=), Field('last_name', length=128, default=), Field('username', length=128, default=, unique=True), Field('password', 'password', length=256, readable=False, label='Password'), Field('registration_key', length=128, default= , writable=False, readable=False)) I tried with Field('registration_id', length=128, default=, unique=True), instead of username, but this time the error is that there is no 'email' field So following the login call, again I found out that RecordUpdater.__call__(**fields) is generated only when the user has already logged in at least once with facebook, the question is: Why does it want to update the fields?? Checking: gluon/tools.py and gluon/dal.py again I found that the problem was in gluon/tools.py (line 1930) def Auth.login() and in relationship with the field I do get (registration_id, that I do not know where it comes, but I think is from facebook) So this is what is in the file: if self.settings.login_userfield: username =
[web2py] Re: [new] cPickle - how and where to load a cPickle's file
it was simple especially because it was writen in the book page 156 ! • request.folder: the application directory. For example if the application is welcome, request.folder is set to the absolute path /path/to/welcome. In your programs, you should always use this variable and the os.path.join function to build paths to the files you need to access. Cheers On Friday, March 8, 2013 6:35:42 PM UTC+1, open...@gmail.com wrote: Hi all, A question I think very simple but I don't resolve it : Some informations that I want to introduce in my site with Web2py comes in a cPickle's file. I have all the time the error that I don't resolve in the framework Web2Py : [Errno 2] No such file or directory Thus I have 2 questions : How can say to Web2Py where find my cPikle's file ? The program that extracts the informations of the cPickle's file must be where in the organisation of Web2Py : controller/index.py for exemple or somewhere else...? Thanks for your patience, bruno -- --- 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: How to validate a field using data being entered from a field next to it in same table
Thanks 黄祥 but I think Anthony is right. The == syntax you gave me just grabbed the first record in the Taxonomy table regardless of which one was selected during data entry. At least now I have the == syntax for some other tasks I needed. Much appreciated Anthony, Alex On Friday, March 8, 2013 8:46:35 AM UTC-8, Anthony wrote: Are you saying you want the form dropdown dynamically populated with a subset of records based on the selection in a different field? If so, you'll have to do that with Javascript and an Ajax call. See http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910 for some ideas. Anthony On Friday, March 8, 2013 2:34:56 AM UTC-5, Alex Glaros wrote: I want to limit IS_IN_DB to a table whose fields match what is being entered in an adjoining field in the same table. Tables: *Taxonomy* is the taxonomy type and contains the types of taxonomies, e.g., plants taxonomy, computer languages taxonomy. *TaxonomyData* is the detail taxonomy of each taxonomy type, e.g., for plants, it could have roses, acorn trees, rice, and, for computer languages, it could have python, java, and perl. Taxonomy is the parent of TaxonomyData. *Suggestion* is a table of suggestions. *SuggestionCategorizationIntersection* table categorizes Suggestion data using Taxonomy and TaxonomyData. db.define_table('*Suggestion*'...) db.define_table('*Taxonomy*', Field('taxonomyShortName','string'), Field('taxonomyLongName','string'), db.define_table('*TaxonomyData'*, Field('taxonomyID','reference Taxonomy'), Field('taxonomyName','string'), Field('taxonomyDataID','string'), Field('taxonomyDataName','string'), db.define_table('*SuggestionCategorizationIntersection*', Field('suggestionID','reference Suggestion'), Field('taxonomyID','reference Taxonomy'), Field('taxonomyDataID','reference TaxonomyData')) Now if I use the code below, I get ALL of data in TaxonomyData, but I only want that data that matches what user typed in the adjoining TaxonomyID field in SuggestionCategorizationIntersection. db.SuggestionCategorizationIntersection.taxonomyDataID.requires = IS_IN_DB(db, db.TaxonomyData.id, '%(taxonomyDataName)s',zero=T('choose one')) ##--- I get too much data I want to choose from taxonomyDataID data where the taxonomyID for it in TaxonomyData only matches the TaxonomyID the user is entering in SuggestionCategorizationIntersection.taxonomyDataID. These two fields are next to each other in SuggestionCategorizationIntersection. Ideally, I'd like to be able to do something like this: db.SuggestionCategorizationIntersection.taxonomyDataID.requires = IS_IN_DB(db, db.TaxonomyData.id WHERE TaxonomyData.taxonomyID = SuggestionCategorization.TaxonomyID The record hasn't been saved yet so how would web2py know what is in the SuggestionCategorization.TaxonomyID record user is typing in? See field colored red above. Can someone please write out the syntax for this requires clause? I'm testing in the appadmin. Thanks, Alex Glaros -- --- 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] postgres getting started (hello world)
I like to change my db to postgresql. So I installed it by the following guide: # setting up secure ssh adduser dbuser export EDITOR=nano visudo # add this to the end of the file # dbuser ALL=(ALL) ALL ssh-keygen -t rsa # fill everything out correctly scp ~/.ssh/id_rsa.pub dbu...@xxx.yyy.zzz.xyz:/home/dbuser/ mkdir /home/dbuser/.ssh mv /home/dbuser/id_rsa.pub /home/dbuser/.ssh/authorized_keys chown -R dbuser:dbuser /home/dbuser/.ssh chmod 700 /home/dbuser/.ssh/ chmod 600 /home/dbuser/.ssh/authorized_keys vi /etc/ssh/sshd_config #Be sure to check the following options. #Port 1234 --- change to a port of your choosing #Protocol 2 #PermitRootLogin yes #PasswordAuthentication no #X11Forwarding no #UsePAM no #UseDNS no #AllowUsers demo iptables -L # Yuck, we're allowing everything wget wget http://articles.slicehost.com/assets/2007/9/4/iptables.txt vi iptables.txt # **IMPORTANT!!** # Make sure to change the port for ssh 1234 # **IMPORTANT!!** mv iptables.txt /etc/iptables.up.rules iptables-restore /etc/iptables.up.rules iptables -L # much better, now make it permanent vi /etc/network/interfaces #... #auto lo #iface lo inet loopback #pre-up iptables-restore /etc/iptables.up.rules ## The primary network interface #... service ssh reload sudo apt-get update sudo apt-get upgrade sudo locale-gen en_US.UTF-8 sudo /usr/sbin/update-locale LANG=en_US.UTF-8 sudo apt-get install postgresql sudo apt-get install python-psycopg2 sudo vi /etc/postgresql/9.1/main/postgresql.conf #Find and uncomment/change these lines #... #listenaddress='localhost' #uncomment #... #track_counts = on#73% #... #autovacuum = on # Enable autovacuum subprocess? 'on' #... sudo /etc/init.d/postgresql restart sudo su - postgres #postgres@$ createuser -PE dbuser #answer no to superuser, create db, and create role. #postgres@$ createdb -O dbuser -E UTF8 testdb #postgres@$ exit sudo vi /etc/postgresql/9.1/main/pg_hba.conf #Find this part # TYPE DATABASEUSERCIDR-ADDRESS METHOD # local is for Unix domain socket connections only #local all all ident sameuser #Change the line to read #local all all md5 sudo /etc/init.d/postgresql restart #test it psql -U dbuser -d testdb #ctrl+d to exit the psql -U dbuser -d testdb didn't work: psql: FATAL: Peer authentication failed for user dbuser I had to try but obviously when I made a new welcome app(TestPostgres) where I changed the DAL line to: db = DAL('postgres://dbuser:testpw@localhost/testdb') I get this error page: invalid function (default/TestPostgres) no ticket or anything I also tried changing the md5 in pg_hba.conf # local is for Unix domain socket connections only #local all all md5 to password doesn't change a thing thanks -- --- 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 include headers in gluon.http.HTTP exceptions?
On Thu, Mar 7, 2013 at 2:47 AM, Alec Taylor alec.tayl...@gmail.com wrote: My attempt: msg = (403, json.dumps({state: , error_message: None, error: unauthorized_client}), None, {'Content-Type': 'application/json'}) If I recall correctly, you are missing a ** Should be: msg = (403, json.dumps({state: , error_message: None, error: unauthorized_client}), None, **{'Content-Type': 'application/json'}) Ricardo -- --- 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] ImportError: No module named gluon.contrib.comet_messaging
Hi, I tried the websocket (comet_messaging.py) and followed the procedures inside, but got the following error in ajax_form(): ImportError: No module named gluon.contrib.comet_messaging How can I solve the problem? Thanks. -- --- 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: database shootout
I don't know in terms of user numbers but mysql is getting replaced with mariadb in Fedora, which will have some impact. Current plan for Fedora 19 is this: - mariadb package will provide mysql - existing mysql package will be renamed to MySQL - mariadb and MySQL pacakges conflict, they can't be installed at the same time. In others words, mariadb will act as a drop-in replacement for mysql. All programs built against mysql libs will be rebuilt against the new mysql libs, thus against mariadb. Everybody who installs mysql will in fact install mariadb. There has been some debate about this mysql replacement and I'm expecting further discussions, especially when Fedora 19 alpha and beta get released and more users become aware of the change. I don't see any real changes for the users though, at least not in the near future. Regards, Ales On Friday, March 8, 2013 9:39:38 PM UTC+1, Richard wrote: Thanks Cliff I wasn't about that issue, it's good to know that. I would be really curious to know if the MySQL user base had splitted since the MariaDB fork and what the proportion that stays with MySQL and now with MariaDB... Richard On Fri, Mar 8, 2013 at 3:17 PM, Cliff Kachinske cjk...@gmail.comjavascript: wrote: @Richard Yeah, I know. But what about documentation? The MySQL code itself is free open source, but Oracle owns the copyright on the MySQL documentation. So as the MariaDB fork adds features, the MySQL documentation becomes more and more inaccurate. At some point there will have to be a full rewrite of the MariaDB docs. Just seems too messy. On Friday, March 8, 2013 8:44:52 AM UTC-5, Richard wrote: @Cliff MariaDB!! :) Richard On Fri, Mar 8, 2013 at 7:36 AM, Cliff Kachinske cjk...@gmail.comwrote: It's not just the legal aspect. After seeing how poorly Oracle supported OpenOffice, I would be concerned about their future support for MySQL as well. On Friday, March 8, 2013 4:43:06 AM UTC-5, Niphlod wrote: This is going nuts. He was fine until now with SQLite, either one of mysql or postgres will do fine, with a total preference on postgres if he doesn't want to employ a legal office to know if he can use mysql or not. PS: the day I'm going to choose mysql over postgres for the combined requirement of having: - a nice syntax to expose an autoincrementing field - is able to accomodate 8M rows with 3 bytes instead of 4 (I'll never consider a tiny or a smallint as an autoincrement-eligible field) it's the day I'll stop working on databases. -- --- 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_outhttps://groups.google.com/groups/opt_out . -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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: ImportError: No module named gluon.contrib.comet_messaging
I've been able to send a message from a terminal to the browser, but when the browser tries to send a message, the error occurs. On Friday, March 8, 2013 6:56:30 PM UTC-5, surfnet3 wrote: Hi, I tried the websocket (comet_messaging.py) and followed the procedures inside, but got the following error in ajax_form(): ImportError: No module named gluon.contrib.comet_messaging How can I solve the problem? Thanks. -- --- 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] postgres getting started (hello world)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Em 08-03-2013 23:19, BlueShadow escreveu: I like to change my db to postgresql. So I installed it by the following guide: | # setting up secure ssh adduser dbuser exportEDITOR=nano visudo # add this to the end of the file # dbuser ALL=(ALL) ALL ssh-keygen -t rsa # fill everything out correctly scp ~/.ssh/id_rsa.pub dbu...@xxx.yyy.zzz.xyz:/home/dbuser/ mkdir /home/dbuser/.ssh mv /home/dbuser/id_rsa.pub /home/dbuser/.ssh/authorized_keys chown -R dbuser:dbuser /home/dbuser/.ssh chmod 700/home/dbuser/.ssh/ chmod 600/home/dbuser/.ssh/authorized_keys vi /etc/ssh/sshd_config #Be sure to check the following options. #Port 1234 --- change to a port of your choosing #Protocol 2 #PermitRootLogin yes #PasswordAuthentication no #X11Forwarding no #UsePAM no #UseDNS no #AllowUsers demo iptables -L # Yuck, we're allowing everything wget wget http://articles.slicehost.com/assets/2007/9/4/iptables.txt vi iptables.txt # **IMPORTANT!!** # Make sure to change the port for ssh 1234 # **IMPORTANT!!** mv iptables.txt /etc/iptables.up.rules iptables-restore /etc/iptables.up.rules iptables -L # much better, now make it permanent vi /etc/network/interfaces #... #auto lo #iface lo inet loopback #pre-up iptables-restore /etc/iptables.up.rules ## The primary network interface #... service ssh reload sudo apt-getupdate sudo apt-getupgrade sudo locale-gen en_US.UTF-8 sudo /usr/sbin/update-locale LANG=en_US.UTF-8 sudo apt-getinstall postgresql sudo apt-getinstall python-psycopg2 sudo vi /etc/postgresql/9.1/main/postgresql.conf #Find and uncomment/change these lines #... #listenaddress='localhost' #uncomment #... #track_counts = on#73% #... #autovacuum = on # Enable autovacuum subprocess? 'on' #... sudo /etc/init.d/postgresql restart sudo su -postgres #postgres@$ createuser -PE dbuser #answer no to superuser, create db, and create role. #postgres@$ createdb -O dbuser -E UTF8 testdb #postgres@$ exit sudo vi /etc/postgresql/9.1/main/pg_hba.conf #Find this part # TYPE DATABASEUSERCIDR-ADDRESS METHOD # local is for Unix domain socket connections only #local all all ident sameuser #Change the line to read #local all all md5 sudo /etc/init.d/postgresql restart #test it psql -U dbuser -d testdb #ctrl+d to exit | the psql -U dbuser -d testdb didn't work: psql: FATAL: Peer authentication failed for user dbuser I had to try but obviously when I made a new welcome app(TestPostgres) where I changed the DAL line to: db = DAL('postgres://dbuser:testpw@localhost/testdb') I get this error page: invalid function (default/TestPostgres) no ticket or anything I also tried changing the md5 |in pg_hba.conf | |# local is for Unix domain socket connections only #local all all md5| |to password| |doesn't change a thing| I see two possible problems: 1. The line #local all all md5 appears to be commented out 2. Did you define a password for 'dbuser'? Also you should tell psql to prompt the user's password: psql -U dbuser -d testdb -W or have it defined in a ~/.pgpass file - -- Com os melhores cumprimentos, Carlos Correia = MEMÓRIA PERSISTENTE Tel.: 219 291 591 - GSM: 917 157 146 / 967 511 762 e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt Jabber: m...@jabber.org GnuPG: wwwkeys.eu.pgp.net URL Suporte: https://t5.m16e.com/gps -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iEYEARECAAYFAlE6lZYACgkQ90uzwjA1SJVDvQCguSrCBs894M8aWtEL1OqZAOa2 65sAn35Kp5JmoD1fJbOY1ZvbWNHO5l1j =SFPc -END PGP SIGNATURE- -- --- 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: Problem with uploading large file web2py version 2.3.2
Hi,this is my db: db.define_table('clsb_product', Field('product_category', type = 'reference clsb_category', notnull = True, label = T('Category')), Field('product_type', type = 'reference clsb_product_type', notnull = True, label = T('Product Type')), Field('product_relation', type = 'reference clsb_relation', notnull = True, label = T('Product Relation')), Field('product_creator', type = 'reference clsb_dic_creator', notnull = True, label = T('Product Creator')), Field('product_publisher', type = 'reference clsb_dic_publisher', notnull = True, label = T('Product Publisher')), Field('product_title', type = 'string', notnull = True, label = T('Product Title')), Field('product_code', type = 'string', notnull = True, unique = True, label = T('Product Code')), Field('total_file', type = 'integer', label = T('Total File')), Field('product_cover', type = 'upload', requires = IS_IMAGE(extensions = 'png'), notnull = True, label = T('Cover Image')), Field('product_data', type = 'upload', requires = IS_UPLOAD_FILENAME(extension = 'zip'), notnull = True, label = T('Product Data')), auth.signature, format = '%(product_title)s') this is function in controller: def manager(): if request.args: table = 'clsb_' + request.args(0) if not table in db.tables(): redirect(URL('error')) form = SQLFORM.grid(db[table], args = request.args[:1], onupdate = auth.archive, showbuttontext = False, user_signature = False) return dict(form = form) return None Thank everyone for repling me :-) On Friday, March 8, 2013 12:41:47 AM UTC+7, Massimo Di Pierro wrote: Can you show us your code? Web2py is transparent to the upload and does not stores the uploaded file in ram but your app may do it and that may be a problem. On Wednesday, 6 March 2013 20:56:28 UTC-6, Mạnh Trần Đức wrote: When I upload a ~400Mb file: Firstly, After Chrome show upload 100% , the python progress jump from 50 -. 400 MB Then after few senconds, it jumps to max of RAM (Step by step, 1GB, 1.5GB, ... 2.5 GB) then my PC hang (Fully of RAM) On Monday, March 4, 2013 7:15:55 PM UTC+7, Phyo Arkar wrote: How much Ram it takes. Wont take alot more than 400mb i believe. -- --- 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: ImportError: No module named gluon.contrib.comet_messaging
Should be websocket_messaging.py now. Anthony On Friday, March 8, 2013 6:56:30 PM UTC-5, surfnet3 wrote: Hi, I tried the websocket (comet_messaging.py) and followed the procedures inside, but got the following error in ajax_form(): ImportError: No module named gluon.contrib.comet_messaging How can I solve the problem? Thanks. -- --- 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: postgres getting started (hello world)
You'll get much better help on a forum that's about your OS and/or postgresql, as this doesn't have anything to do with web2py. Regards, Ales On Saturday, March 9, 2013 12:19:04 AM UTC+1, BlueShadow wrote: I like to change my db to postgresql. So I installed it by the following guide: # setting up secure ssh adduser dbuser export EDITOR=nano visudo # add this to the end of the file # dbuser ALL=(ALL) ALL ssh-keygen -t rsa # fill everything out correctly scp ~/.ssh/id_rsa.pub dbu...@xxx.yyy.zzz.xyz:/home/dbuser/ mkdir /home/dbuser/.ssh mv /home/dbuser/id_rsa.pub /home/dbuser/.ssh/authorized_keys chown -R dbuser:dbuser /home/dbuser/.ssh chmod 700 /home/dbuser/.ssh/ chmod 600 /home/dbuser/.ssh/authorized_keys vi /etc/ssh/sshd_config #Be sure to check the following options. #Port 1234 --- change to a port of your choosing #Protocol 2 #PermitRootLogin yes #PasswordAuthentication no #X11Forwarding no #UsePAM no #UseDNS no #AllowUsers demo iptables -L # Yuck, we're allowing everything wget wget http://articles.slicehost.com/assets/2007/9/4/iptables.txt vi iptables.txt # **IMPORTANT!!** # Make sure to change the port for ssh 1234 # **IMPORTANT!!** mv iptables.txt /etc/iptables.up.rules iptables-restore /etc/iptables.up.rules iptables -L # much better, now make it permanent vi /etc/network/interfaces #... #auto lo #iface lo inet loopback #pre-up iptables-restore /etc/iptables.up.rules ## The primary network interface #... service ssh reload sudo apt-get update sudo apt-get upgrade sudo locale-gen en_US.UTF-8 sudo /usr/sbin/update-locale LANG=en_US.UTF-8 sudo apt-get install postgresql sudo apt-get install python-psycopg2 sudo vi /etc/postgresql/9.1/main/postgresql.conf #Find and uncomment/change these lines #... #listenaddress='localhost' #uncomment #... #track_counts = on#73% #... #autovacuum = on # Enable autovacuum subprocess? 'on' #... sudo /etc/init.d/postgresql restart sudo su - postgres #postgres@$ createuser -PE dbuser #answer no to superuser, create db, and create role. #postgres@$ createdb -O dbuser -E UTF8 testdb #postgres@$ exit sudo vi /etc/postgresql/9.1/main/pg_hba.conf #Find this part # TYPE DATABASEUSERCIDR-ADDRESS METHOD # local is for Unix domain socket connections only #local all all ident sameuser #Change the line to read #local all all md5 sudo /etc/init.d/postgresql restart #test it psql -U dbuser -d testdb #ctrl+d to exit the psql -U dbuser -d testdb didn't work: psql: FATAL: Peer authentication failed for user dbuser I had to try but obviously when I made a new welcome app(TestPostgres) where I changed the DAL line to: db = DAL('postgres://dbuser:testpw@localhost/testdb') I get this error page: invalid function (default/TestPostgres) no ticket or anything I also tried changing the md5 in pg_hba.conf # local is for Unix domain socket connections only #local all all md5 to password doesn't change a thing thanks -- --- 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: ImportError: No module named gluon.contrib.comet_messaging
I'm still using an older version (2.0.9) On Friday, March 8, 2013 9:00:17 PM UTC-5, Anthony wrote: Should be websocket_messaging.py now. Anthony On Friday, March 8, 2013 6:56:30 PM UTC-5, surfnet3 wrote: Hi, I tried the websocket (comet_messaging.py) and followed the procedures inside, but got the following error in ajax_form(): ImportError: No module named gluon.contrib.comet_messaging How can I solve the problem? Thanks. -- --- 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: ImportError: No module named gluon.contrib.comet_messaging
Never mind, I found the solution. Stupid me, restarting the computer solves the problem :) On Friday, March 8, 2013 9:13:08 PM UTC-5, surfnet3 wrote: I'm still using an older version (2.0.9) On Friday, March 8, 2013 9:00:17 PM UTC-5, Anthony wrote: Should be websocket_messaging.py now. Anthony On Friday, March 8, 2013 6:56:30 PM UTC-5, surfnet3 wrote: Hi, I tried the websocket (comet_messaging.py) and followed the procedures inside, but got the following error in ajax_form(): ImportError: No module named gluon.contrib.comet_messaging How can I solve the problem? Thanks. -- --- 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] Small error in current online web2py book
I don't know if this is the correct place to post this: http://www.web2py.com/book/default/chapter/01#security Serves me: invalid function (default/chapter) Original page: http://web2py.com/init/default/what (containing the link) Greets Rene -- --- 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] postgres getting started (hello world)
Hi, Precisely today i have send a patch to Massimo for the book https://github.com/mdipierro/web2py-book/blob/master/sources/29-web2py-english/13.markmin You can review what you need to do Saludos, Alfonso de la Guarda Twitter: @alfonsodg Redes sociales: alfonsodg Telef. 991935157 1024D/B23B24A4 5469 ED92 75A3 BBDB FD6B 58A5 54A1 851D B23B 24A4 On Fri, Mar 8, 2013 at 6:19 PM, BlueShadow kevin.bet...@gmail.com wrote: I like to change my db to postgresql. So I installed it by the following guide: # setting up secure ssh adduser dbuser export EDITOR=nano visudo # add this to the end of the file # dbuser ALL=(ALL) ALL ssh-keygen -t rsa # fill everything out correctly scp ~/.ssh/id_rsa.pub dbu...@xxx.yyy.zzz.xyz:/home/dbuser/ mkdir /home/dbuser/.ssh mv /home/dbuser/id_rsa.pub /home/dbuser/.ssh/authorized_keys chown -R dbuser:dbuser /home/dbuser/.ssh chmod 700 /home/dbuser/.ssh/ chmod 600 /home/dbuser/.ssh/authorized_keys vi /etc/ssh/sshd_config #Be sure to check the following options. #Port 1234 --- change to a port of your choosing #Protocol 2 #PermitRootLogin yes #PasswordAuthentication no #X11Forwarding no #UsePAM no #UseDNS no #AllowUsers demo iptables -L # Yuck, we're allowing everything wget wget http://articles.slicehost.com/assets/2007/9/4/iptables.txt vi iptables.txt # **IMPORTANT!!** # Make sure to change the port for ssh 1234 # **IMPORTANT!!** mv iptables.txt /etc/iptables.up.rules iptables-restore /etc/iptables.up.rules iptables -L # much better, now make it permanent vi /etc/network/interfaces #... #auto lo #iface lo inet loopback #pre-up iptables-restore /etc/iptables.up.rules ## The primary network interface #... service ssh reload sudo apt-get update sudo apt-get upgrade sudo locale-gen en_US.UTF-8 sudo /usr/sbin/update-locale LANG=en_US.UTF-8 sudo apt-get install postgresql sudo apt-get install python-psycopg2 sudo vi /etc/postgresql/9.1/main/postgresql.conf #Find and uncomment/change these lines #... #listenaddress='localhost' #uncomment #... #track_counts = on#73% #... #autovacuum = on # Enable autovacuum subprocess? 'on' #... sudo /etc/init.d/postgresql restart sudo su - postgres #postgres@$ createuser -PE dbuser #answer no to superuser, create db, and create role. #postgres@$ createdb -O dbuser -E UTF8 testdb #postgres@$ exit sudo vi /etc/postgresql/9.1/main/pg_hba.conf #Find this part # TYPE DATABASEUSERCIDR-ADDRESS METHOD # local is for Unix domain socket connections only #local all all ident sameuser #Change the line to read #local all all md5 sudo /etc/init.d/postgresql restart #test it psql -U dbuser -d testdb #ctrl+d to exit the psql -U dbuser -d testdb didn't work: psql: FATAL: Peer authentication failed for user dbuser I had to try but obviously when I made a new welcome app(TestPostgres) where I changed the DAL line to: db = DAL('postgres://dbuser:testpw@localhost/testdb') I get this error page: invalid function (default/TestPostgres) no ticket or anything I also tried changing the md5 in pg_hba.conf # local is for Unix domain socket connections only #local all all md5 to password doesn't change a thing thanks -- --- 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. -- --- 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: Small error in current online web2py book
The error is a missing redirection as we moved the web2py host. Use this link: http://www.web2py.com/books/default/chapter/29/01#security On Friday, 8 March 2013 21:07:28 UTC-6, Rene Dohmen wrote: I don't know if this is the correct place to post this: http://www.web2py.com/book/default/chapter/01#security Serves me: invalid function (default/chapter) Original page: http://web2py.com/init/default/what (containing the link) Greets Rene -- --- 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] Deploy to openshift
Hi. I'm trying to generate a package to deploy my web2py application on an apache server but when I use the button Deploy to openshift the system tell me Requires Distuttils, but not installed. what can I do? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] WEB2PY CPANEL DPLOYING
Hi. Does someone knows how to deploy web2py over cpanel in an apache server? -- --- 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: Problem with uploading large file web2py version 2.3.2
I cannot reproduce the problem. It would help if you could isolate it. Do you see the memory increase during upload? After upload? During validation? After validation? When the form is successfully uploaded or only when there is error in the form? Can you reproduce it if there is only one field? massimo On Friday, 8 March 2013 19:55:35 UTC-6, Mạnh Trần Đức wrote: Hi,this is my db: db.define_table('clsb_product', Field('product_category', type = 'reference clsb_category', notnull = True, label = T('Category')), Field('product_type', type = 'reference clsb_product_type', notnull = True, label = T('Product Type')), Field('product_relation', type = 'reference clsb_relation', notnull = True, label = T('Product Relation')), Field('product_creator', type = 'reference clsb_dic_creator', notnull = True, label = T('Product Creator')), Field('product_publisher', type = 'reference clsb_dic_publisher', notnull = True, label = T('Product Publisher')), Field('product_title', type = 'string', notnull = True, label = T('Product Title')), Field('product_code', type = 'string', notnull = True, unique = True, label = T('Product Code')), Field('total_file', type = 'integer', label = T('Total File')), Field('product_cover', type = 'upload', requires = IS_IMAGE(extensions = 'png'), notnull = True, label = T('Cover Image')), Field('product_data', type = 'upload', requires = IS_UPLOAD_FILENAME(extension = 'zip'), notnull = True, label = T('Product Data')), auth.signature, format = '%(product_title)s') this is function in controller: def manager(): if request.args: table = 'clsb_' + request.args(0) if not table in db.tables(): redirect(URL('error')) form = SQLFORM.grid(db[table], args = request.args[:1], onupdate = auth.archive, showbuttontext = False, user_signature = False) return dict(form = form) return None Thank everyone for repling me :-) On Friday, March 8, 2013 12:41:47 AM UTC+7, Massimo Di Pierro wrote: Can you show us your code? Web2py is transparent to the upload and does not stores the uploaded file in ram but your app may do it and that may be a problem. On Wednesday, 6 March 2013 20:56:28 UTC-6, Mạnh Trần Đức wrote: When I upload a ~400Mb file: Firstly, After Chrome show upload 100% , the python progress jump from 50 -. 400 MB Then after few senconds, it jumps to max of RAM (Step by step, 1GB, 1.5GB, ... 2.5 GB) then my PC hang (Fully of RAM) On Monday, March 4, 2013 7:15:55 PM UTC+7, Phyo Arkar wrote: How much Ram it takes. Wont take alot more than 400mb i believe. -- --- 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: Deploy to openshift
You need to install distutils. Use ez_setup.py http://peak.telecommunity.com/dist/ez_setup.py On Friday, 8 March 2013 12:47:24 UTC-6, cor...@xionex.cl wrote: Hi. I'm trying to generate a package to deploy my web2py application on an apache server but when I use the button Deploy to openshift the system tell me Requires Distuttils, but not installed. what can I do? -- --- 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] gluon.http.HTTP default headers aren't `**response.headers`?
Why isn't the content-type inherited from response.headers in the HTTP object construction? def test(): response.headers['Content-Type'] = 'application/json' raise HTTP(500, json.dumps(dict(test=True)), **response.headers) HTTP/1.1 500 INTERNAL SERVER ERROR Path=/ Content-Type: text/html; charset=UTF-8 Date: Sat, 09 Mar 2013 05:05:19 GMT Server: Rocket 1.2.6 Python/2.7.3 Content-Length: 14 Connection: keep-alive {test: true} def test(): response.headers['Content-Type'] = 'application/json' raise HTTP(500, json.dumps(dict(test=True))) HTTP/1.1 500 INTERNAL SERVER ERROR Path=/ Content-Type: application/json X-Powered-By: web2py Date: Sat, 09 Mar 2013 05:05:33 GMT Server: Rocket 1.2.6 Python/2.7.3 Content-Length: 14 Connection: keep-alive {test: true} -- --- 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: gluon.http.HTTP default headers aren't `**response.headers`?
(pasted output was in reverse order .) On Sat, Mar 9, 2013 at 4:08 PM, Alec Taylor alec.tayl...@gmail.com wrote: Why isn't the content-type inherited from response.headers in the HTTP object construction? def test(): response.headers['Content-Type'] = 'application/json' raise HTTP(500, json.dumps(dict(test=True)), **response.headers) HTTP/1.1 500 INTERNAL SERVER ERROR Path=/ Content-Type: application/json X-Powered-By: web2py Date: Sat, 09 Mar 2013 05:05:33 GMT Server: Rocket 1.2.6 Python/2.7.3 Content-Length: 14 Connection: keep-alive def test(): response.headers['Content-Type'] = 'application/json' raise HTTP(500, json.dumps(dict(test=True))) HTTP/1.1 500 INTERNAL SERVER ERROR Path=/ Content-Type: text/html; charset=UTF-8 Date: Sat, 09 Mar 2013 05:05:19 GMT Server: Rocket 1.2.6 Python/2.7.3 Content-Length: 14 Connection: keep-alive {test: true} {test: true} -- --- 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.