Re: [web2py] Re: how does search work on sql grid? (search over a whole table instead of a field)
Thank you! your customer search function example answers my question. just curious, does SQL grid search function work same way as your search function example? On Sun, May 10, 2015 at 11:47 PM, Anthony abasta...@gmail.com wrote: Basically I have 5 fields (last_name, middle_name, first_name, mother_full_name, father_full_name) in a table called names, When I search a keyword john, I would like to search it on a whole table. For example, is there any way to just do db(db.names.contains(%john%)) and it gives a list of rows with a searched keyword stored in it instead of doing this == db((db.names.last_name.contains(%john%)(db.names.first_name.contains(%john%)(db.names.mother_full_name.contains(%john%))) db.names.contains(...) is not valid DAL code nor would it be able to produce valid SQL (i.e., you have to specify fields). So, you need something like your second example, but replace all the operators with |. Anyway, there is no need to do that, because the grid search already does exactly that, which is why all you have to do is disable the Javascript search widget (as described in the linked post) to get the behavior you want. Alternatively, you can code your own search function: def mysearch(sfields, keywords): keywords = keywords.strip() return reduce(lambda a, b: a | b, [field.contains(keywords) for field in db.names]) Then pass that as the searchable argument to the grid. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/MKKxc41Nq7w/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: MSSQL and auth.signature
this is a well-known bug . MSSQL doesn't support creating references with cascades that reference something else that cascades (i.e. only one is allowed). There's a workaround : it's all documented here : http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#MSSQL--Microsoft-SQL-Server- On Saturday, May 9, 2015 at 3:06:00 PM UTC+2, Paolo Valleri wrote: that's odd. Can you open an issue on github ( https://github.com/web2py/pydal/issues) with a simple example to reproduce it? I'll have a look in the next few days Paolo On Saturday, May 9, 2015 at 11:54:30 AM UTC+2, Claudinei Fernandes wrote: Hi, Has anyone used auth.signature attribute with MSSQL database? For me it is returning the following error: class 'gluon.contrib.pypyodbc.ProgrammingError' (u'42000', u[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Introducing FOREIGN KEY constraint 'signature_test_modified_by__constraint' on table 'signature_test' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.) Can anyone help me please? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: how does search work on sql grid? (search over a whole table instead of a field)
Hi Anthony, Thank you for your reply as always. I believe the forwarded post is about how to show only a search option for searching throught a whole table. so unfortunately that post doesn't answer my question. Do you know how the search works behind of sql grid form? Thank you. On Sunday, May 10, 2015 at 12:55:30 AM UTC-4, Anthony wrote: See https://groups.google.com/d/msg/web2py/WvGH9XAH160/TjzYVCDBzQ0J Anthony On Saturday, May 9, 2015 at 9:57:03 PM UTC-4, Kenneth wrote: I am curious how I can implement the search widget used on sql grid. It seems to me that sql grid searche widget searches a keword over a whole table and show the result. Can anyone tell me how to create a search widget to search a keyword on a table instead of selecting fields? Thank you. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: how does search work on sql grid? (search over a whole table instead of a field)
Basically I have 5 fields (last_name, middle_name, first_name, mother_full_name, father_full_name) in a table called names, When I search a keyword john, I would like to search it on a whole table. For example, is there any way to just do db(db.names.contains(%john%)) and it gives a list of rows with a searched keyword stored in it instead of doing this == db((db.names.last_name.contains(%john%)(db.names.first_name.contains(%john%)(db.names.mother_full_name.contains(%john%))) db.names.contains(...) is not valid DAL code nor would it be able to produce valid SQL (i.e., you have to specify fields). So, you need something like your second example, but replace all the operators with |. Anyway, there is no need to do that, because the grid search already does exactly that, which is why all you have to do is disable the Javascript search widget (as described in the linked post) to get the behavior you want. Alternatively, you can code your own search function: def mysearch(sfields, keywords): keywords = keywords.strip() return reduce(lambda a, b: a | b, [field.contains(keywords) for field in db.names]) Then pass that as the searchable argument to the grid. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] auth_permission for group of records based on column value?
is there a way to use auth_permission to allow user to modify a large number of records based upon field value? right now in auth_permission we can only specify one record_id in a table. what about all records in a table whose field matches: organization_id = 'IBM'? is there a way to allow user to only modify those records? thanks Alex Glaros -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: auth_permission for group of records based on column value?
if there was a way to make only specific tables multi-tenant, that would work as well -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: auth_permission for group of records based on column value?
Prefer not to address permissions in controller. One problem is in grid, user can change the parms in the address bar and start editing another user's data Tried doing a record-by-record check below in grid but creates false positive each time db.auth_group.organizationID.represent = lambda value,row: DIV(redirect(URL ('default','siteMap', args=[row.organizationID, request.get_vars. specificOrganizationID]))) if row.organizationID != request.get_vars.specificOrganizationID else '' resulting args in view are correct but somehow the logic doesn't take User is not creator, so can't use signature technique. Tried this: is_authorizer = (lambda row: row.organizationID == request.get_vars. specificOrganizationID) ..., editable = is_authorizer, ... Other alternative, would be to put in a for loop and just granularly handle one record at a time -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: how does search work on sql grid? (search over a whole table instead of a field)
Hope this clarifies my question. Basically I have 5 fields (last_name, middle_name, first_name, mother_full_name, father_full_name) in a table called names, When I search a keyword john, I would like to search it on a whole table. For example, is there any way to just do db(db.names.contains(%john%)) and it gives a list of rows with a searched keyword stored in it instead of doing this == db((db.names.last_name.contains(%john%)(db.names.first_name.contains(%john%)(db.names.mother_full_name.contains(%john%))) Thank you. On Sunday, May 10, 2015 at 11:15:21 PM UTC-4, Anthony wrote: Sorry, you said you want to search a keyword on a table instead of selecting fields? Perhaps you can clarify what you are trying to achieve. Anthony On Sunday, May 10, 2015 at 11:07:49 PM UTC-4, Kenneth wrote: Hi Anthony, Thank you for your reply as always. I believe the forwarded post is about how to show only a search option for searching throught a whole table. so unfortunately that post doesn't answer my question. Do you know how the search works behind of sql grid form? Thank you. On Sunday, May 10, 2015 at 12:55:30 AM UTC-4, Anthony wrote: See https://groups.google.com/d/msg/web2py/WvGH9XAH160/TjzYVCDBzQ0J Anthony On Saturday, May 9, 2015 at 9:57:03 PM UTC-4, Kenneth wrote: I am curious how I can implement the search widget used on sql grid. It seems to me that sql grid searche widget searches a keword over a whole table and show the result. Can anyone tell me how to create a search widget to search a keyword on a table instead of selecting fields? Thank you. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Bootstrap datepicker plugin
Hi Leonel I was trying out your widget but hit a problem... maybe there is a bug? Best regards, D Traceback (most recent call last): File C:\Users\David\Documents\GitHub\web2py\gluon\restricted.py, line 227, in restricted exec ccode in environment File C:/Users/David/Documents/GitHub/web2py/applications/prearrival/controllers/default.py http://localhost:8000/admin/default/edit/prearrival/controllers/default.py, line 160, in module File C:\Users\David\Documents\GitHub\web2py\gluon\globals.py, line 393, in lambda self._caller = lambda f: f() File C:\Users\David\Documents\GitHub\web2py\gluon\tools.py, line 3440, in f return action(*a, **b) File C:/Users/David/Documents/GitHub/web2py/applications/prearrival/controllers/default.py http://localhost:8000/admin/default/edit/prearrival/controllers/default.py, line 150, in passports details = False, File C:\Users\David\Documents\GitHub\web2py\gluon\sqlhtml.py, line 2232, in grid create_form = SQLFORM(table, **sqlformargs) File C:\Users\David\Documents\GitHub\web2py\gluon\sqlhtml.py, line 1229, in __init__ inp = field.widget(field, default) TypeError: bsdatepicker_widget() takes at most 1 argument (2 given) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: how does search work on sql grid? (search over a whole table instead of a field)
Sorry, you said you want to search a keyword on a table instead of selecting fields? Perhaps you can clarify what you are trying to achieve. Anthony On Sunday, May 10, 2015 at 11:07:49 PM UTC-4, Kenneth wrote: Hi Anthony, Thank you for your reply as always. I believe the forwarded post is about how to show only a search option for searching throught a whole table. so unfortunately that post doesn't answer my question. Do you know how the search works behind of sql grid form? Thank you. On Sunday, May 10, 2015 at 12:55:30 AM UTC-4, Anthony wrote: See https://groups.google.com/d/msg/web2py/WvGH9XAH160/TjzYVCDBzQ0J Anthony On Saturday, May 9, 2015 at 9:57:03 PM UTC-4, Kenneth wrote: I am curious how I can implement the search widget used on sql grid. It seems to me that sql grid searche widget searches a keword over a whole table and show the result. Can anyone tell me how to create a search widget to search a keyword on a table instead of selecting fields? Thank you. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: web2pyslices down
Web2pysplices.com is on sale Cool! And what about web2pyslices.com, is it on sale also? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] DAL and Json query
Hi all, How DAL is supported json query? My test is on Web2py by source code v.2.10.3, PostgreSQL 9.4: db.define_table('person', Field('name','string'), Field('jdata','json')) db.person.insert(name='Adam',jdata='{age:30}') print db.executesql('SELECT * FROM person WHERE (jdata - age) 20;') I get this error: Traceback (most recent call last): File E:\GDriver\web2py\gluon\restricted.py, line 227, in restricted exec ccode in environment File E:/GDriver/web2py/applications/form/models/db.py http://127.0.0.1:8000/admin/default/edit/form/models/db.py, line 103, in module print db.executesql('SELECT * FROM hoso WHERE (jdata - age) 20;') File E:\GDriver\web2py\gluon\packages\dal\pydal\base.py, line 1028, in executesql adapter.execute(query) File E:\GDriver\web2py\gluon\packages\dal\pydal\adapters\base.py, line 1326, in execute return self.log_execute(*a, **b) File E:\GDriver\web2py\gluon\packages\dal\pydal\adapters\base.py, line 1320, in log_execute ret = self.cursor.execute(command, *a[1:], **b) File E:\GDriver\web2py\gluon\contrib\pg8000\core.py, line 573, in execute self._c.execute(self, operation, args) File E:\GDriver\web2py\gluon\contrib\pg8000\core.py, line 1626, in execute self.handle_messages(cursor) File E:\GDriver\web2py\gluon\contrib\pg8000\core.py, line 1774, in handle_messages raise self.error ProgrammingError: ('ERROR', '42703', 'column age does not exist') -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] About Leonel's threaded comment example
Ron's question about the app posted at https://groups.google.com/d/msg/web2py/sbgzu1zUAqY/8h1P7-6boSgJ by Leonel Do you know if its possible to implement this app without using any javascript and nested structure but just applying pymongo freature? Does pymongo provide client-side features? I don't think so. To handle the data stored at the database you need client logic. You can avoid coding javascript by using only html forms and css. @Ron Please, this is the place for asking questions about web2py for free and supported by all the users, I don't do web2py consulting for a living, as you already know. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Replacing layout.html with an AdminLTE dashboard
AdminLTE is a beautiful dashboard https://www.almsaeedstudio.com/preview template. Using it in my current project, and I've posted it to Github at AdminLTE-web2py https://github.com/tomcam/AdminLTE-web2py. Let me know what egregious mistakes I've made. I did follow along with my tutorial to make sure it worked, but deciding what to strip out for the demo and what to leave in was nonobvious. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Creating a grid based on queries pertaining to a primary db table, and a table that references it
Another way: tc = t.with_alias('chairs') q = (tc.name == 'chair') q = q (t.name == 'table') q = q (t.owner_id == tc.owner_id) q = q (p.id == tc.owner_id) print db(q).select(*fields, distinct=True, orderby=p.first_name) On Sat, May 9, 2015 at 9:24 PM, Spokes spokes8...@gmail.com wrote: Thanks, Massimiliano. I was also considering an approach involving creating a list of IDs from the 'thing' table, but I'm not sure that this would be feasible in this case. They may be tens, possibly hundreds of IDs corresponding to the given criteria, and the grid based on these queries is part of the site's front page (i.e. it will be generated very often), so I'm not sure that this approach is necessarily efficient enough. I can't help thinking that there's a more straightforward and efficient way to accomplish this task. On Saturday, May 9, 2015 at 8:14:51 AM UTC-5, Massimiliano wrote: Maybe something like that? db.define_table('person', Field('first_name'), Field('last_name'), format='%(first_name)s') db.define_table('thing', Field('name'), Field('owner_id', 'reference person'), format='%(name)s') t = db.thing p = db.person fields = [p.first_name, p.last_name] q = ((t.owner_id == p.id) (t.name == 'chair')) ids_people_with_chair = [a.id for a in db(q).select(p.id)] query = (t.owner_id == p.id) query = query (t.owner_id.belongs(ids_people_with_chair)) query = query (t.name == 'table') print db(query).select(*fields, distinct=True, orderby=p.first_name) On Fri, May 8, 2015 at 10:49 PM, Spokes spoke...@gmail.com wrote: Hi, Dave. Yes, that seems to be an accurate summary of what I was attempting to do. On Friday, May 8, 2015 at 3:25:24 PM UTC-5, Dave S wrote: On Friday, May 8, 2015 at 11:55:13 AM UTC-7, Spokes wrote: I'd like to create a grid based on criteria relating to a primary table, and a table that references that primary table. Slightly modifying the example from the web2py docs, let's say the primary table is 't_person', and it's referenced by the table, 't_thing'. I'd like the grid to list 't_person' entries that are referenced by a 't_thing' entry with a value 'table' for the 'name' field, and by a 't_thing' entry with value 'chair' for the name field (that is, entries that meet both criteria, not one or the other). Let's see if I understand this. You want to use the set A of t_things that have value 'table' and the set B of t_things that have value 'chair' and find those members of t_person that are referenced by both sets? Sort of for a in A where a.owner_id == b.owner_id for b in B, select p from t_person where p.id == a.owner_id ? /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Massimiliano -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Massimiliano -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: invalid literal for int() with base 10: running mongodb
I take this back. I believe I need to pass comment ids instead of string. On Sunday, May 10, 2015 at 12:11:25 PM UTC-4, Ron Chatterjee wrote: I will. Thanks Paolo. Regards, Ron On Sunday, May 10, 2015 at 11:49:37 AM UTC-4, Paolo Valleri wrote: Hi Ron, please open an issue on https://github.com/web2py/pydal/issues it seems that mongo adapter doesn't support list:reference table yet On Sunday, May 10, 2015 at 4:09:51 PM UTC+2, Ron Chatterjee wrote: I have the following in model. I get an error invalide literal for int when I add the line Field(comments, list: reference comment). Otherwise it works fine db.define_table('Post', Field('author'), Field('content','Text'), Field(tags,list:string), Field(comments,list:reference comment), Field('date', 'datetime',default=request.now)) db.define_table(comment, Field(created_on,datetime,default=request.now), Field(body,text), Field(author,reference auth_user)) posts = db._adapter.connection.posts_three --- Below is the error I get. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. Traceback (most recent call last): File C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\restricted.py, line 227, in restricted exec ccode in environment File C:/Users/Ron/Desktop/web2py_new/web2py_new/applications/mongo_example1/controllers/appadmin.py http://127.0.0.1:8000/admin/default/edit/mongo_example1/controllers/appadmin.py, line 704, in module File C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\globals.py, line 393, in lambda self._caller = lambda f: f() File C:/Users/Ron/Desktop/web2py_new/web2py_new/applications/mongo_example1/controllers/appadmin.py http://127.0.0.1:8000/admin/default/edit/mongo_example1/controllers/appadmin.py, line 151, in insert if form.accepts(request.vars, session): File C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\sqlhtml.py, line 1679, in accepts self.vars.id = self.table.insert(**fields) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\objects.py, line 737, in insert ret = self._db._adapter.insert(self, self._listify(fields)) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\mongo.py, line 359, in insert values[fieldname] = self.represent(v, fieldtype) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\mongo.py, line 146, in represent value = NoSQLAdapter.represent(self, obj, fieldtype) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\base.py, line 1795, in represent return map(int,obj) ValueError: invalid literal for int() with base 10: 'comment one' -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] invalid literal for int() with base 10: running mongodb
I have the following in model. I get an error invalide literal for int when I add the line Field(comments, list: reference comment). Otherwise it works fine db.define_table('Post', Field('author'), Field('content','Text'), Field(tags,list:string), Field(comments,list:reference comment), Field('date', 'datetime',default=request.now)) db.define_table(comment, Field(created_on,datetime,default=request.now), Field(body,text), Field(author,reference auth_user)) posts = db._adapter.connection.posts_three --- Below is the error I get. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. Traceback (most recent call last): File C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\restricted.py, line 227, in restricted exec ccode in environment File C:/Users/Ron/Desktop/web2py_new/web2py_new/applications/mongo_example1/controllers/appadmin.py http://127.0.0.1:8000/admin/default/edit/mongo_example1/controllers/appadmin.py, line 704, in module File C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\globals.py, line 393, in lambda self._caller = lambda f: f() File C:/Users/Ron/Desktop/web2py_new/web2py_new/applications/mongo_example1/controllers/appadmin.py http://127.0.0.1:8000/admin/default/edit/mongo_example1/controllers/appadmin.py, line 151, in insert if form.accepts(request.vars, session): File C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\sqlhtml.py, line 1679, in accepts self.vars.id = self.table.insert(**fields) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\objects.py, line 737, in insert ret = self._db._adapter.insert(self, self._listify(fields)) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\mongo.py, line 359, in insert values[fieldname] = self.represent(v, fieldtype) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\mongo.py, line 146, in represent value = NoSQLAdapter.represent(self, obj, fieldtype) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\base.py, line 1795, in represent return map(int,obj) ValueError: invalid literal for int() with base 10: 'comment one' -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: custom form validation doesn't work
That doesn't necessarily sound like the same issue. Please show some code and explain what you expect and what you see instead (maybe start a new thread). On Sunday, May 10, 2015 at 10:01:54 AM UTC-4, Thomas Sitter wrote: Hi Massimo, I am getting this same issue (onvalidation function not getting called), but I am use SQLFORM and not Crud so the solution posted does not apply to me. Has this been resolved elsewhere? Thanks. Tom On Saturday, 15 December 2012 18:27:51 UTC-5, jonas wrote: Hi. I have a default form that is passed in view: {{=form}} using this validation and insertion works. but when I use a custom form none of that works. why? Also form.process().accepted works only when using default form. My second question is: when submitting the form I redirect to index, and all entries in the db are returned. Is that because i reuse the index function? Is there any way to clear all fields after a successful submit? the code: default.py: def index(): query=db.blog.id0 res=db(query).select(orderby=~db.blog.date) query=db.about.id0 about=db(query).select() query=db.comments.post_id0 com=db(query).select(orderby=~db.comments.created_on) return dict(res=res,about=about,com=com,message=T('Everything should be made as simple as possible, but not simpler')) def comment(): create comment form. Every comment is id locked to the specific post post=db(db.blog.id==request.args(0)).select().first() db.comments.post_id.default=post.id form=crud.create(db.comments) if form.process().accepted: print 'form accepted' redirect(URL('index')) else: print 'not accepted' return dict(form=form) index.html: {{=A(TAG.i(_class=icon-plus-sign), _rel=tooltip, _title=testing, _class=btn, _href='#', _onclick=jQuery('#uc').toggle();)}} div id=uc {{=LOAD('default','comment.load',args=result.id,ajax=True)}} /div comment.load: {{=form}} thanks -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] web2pyslicesgate
I forgot I was the web2pyslices app admin :P To all users complaining about their articles not being shown on the site, please, don't sue me. BTW: there seem to be some issue about the web2pyslices.com domain, since the one that is working is web2pyslices.pythonanywhere.com -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: invalid literal for int() with base 10: running mongodb
Hi Ron, please open an issue on https://github.com/web2py/pydal/issues it seems that mongo adapter doesn't support list:reference table yet On Sunday, May 10, 2015 at 4:09:51 PM UTC+2, Ron Chatterjee wrote: I have the following in model. I get an error invalide literal for int when I add the line Field(comments, list: reference comment). Otherwise it works fine db.define_table('Post', Field('author'), Field('content','Text'), Field(tags,list:string), Field(comments,list:reference comment), Field('date', 'datetime',default=request.now)) db.define_table(comment, Field(created_on,datetime,default=request.now), Field(body,text), Field(author,reference auth_user)) posts = db._adapter.connection.posts_three --- Below is the error I get. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. Traceback (most recent call last): File C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\restricted.py, line 227, in restricted exec ccode in environment File C:/Users/Ron/Desktop/web2py_new/web2py_new/applications/mongo_example1/controllers/appadmin.py http://127.0.0.1:8000/admin/default/edit/mongo_example1/controllers/appadmin.py, line 704, in module File C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\globals.py, line 393, in lambda self._caller = lambda f: f() File C:/Users/Ron/Desktop/web2py_new/web2py_new/applications/mongo_example1/controllers/appadmin.py http://127.0.0.1:8000/admin/default/edit/mongo_example1/controllers/appadmin.py, line 151, in insert if form.accepts(request.vars, session): File C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\sqlhtml.py, line 1679, in accepts self.vars.id = self.table.insert(**fields) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\objects.py, line 737, in insert ret = self._db._adapter.insert(self, self._listify(fields)) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\mongo.py, line 359, in insert values[fieldname] = self.represent(v, fieldtype) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\mongo.py, line 146, in represent value = NoSQLAdapter.represent(self, obj, fieldtype) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\base.py, line 1795, in represent return map(int,obj) ValueError: invalid literal for int() with base 10: 'comment one' -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Something went wrong when I copied the web2py folder
I offten create back ups for my web2py folder, copying the entire folder from mu computer to an external hard disc. During the last back up something interesting happened. When I try to manage and edit one of the apps in the back up folder on the external disc, I get this error msg: *SyntaxError: CRLF Injection Detected* Of course, this can’t be correct but now, for some reason, I am unable to delete the back up web2py folder from that hard disc. When I attempt to delete the folder I get this msg: *The file name you specified is not valid or too long. Specify a different file name*.I even tried to delete the folder using the command prompt but it's impossible to delete it. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: web2pyslices down
Thank you. Hope web2pyslices finds new home soon. On Saturday, May 9, 2015 at 9:33:36 AM UTC-4, Michael Beller wrote: In the meantime ... http://web2pyslices.pythonanywhere.com/ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: SQLFORM.smartgrid and constraint
it works!. Thankyou.I have another question.What if there are multiple queries.What is the syntax? eg: query1= db.posts.created_by==auth.user_id query2=db.posts.gender=='male' (assume there is a field called gender) On Mon, May 4, 2015 at 9:15 AM, 黄祥 steve.van.chris...@gmail.com wrote: e.g. def view(): constraints = db.posts.created_by == auth.user_id grid=SQLFORM.smartgrid(db.posts, constraints = constraints) return locals() ref: https://groups.google.com/forum/#!topic/web2py/mtbhY19aAEA best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/cNMqkf9hmKo/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: custom form validation doesn't work
Hi Massimo, I am getting this same issue (onvalidation function not getting called), but I am use SQLFORM and not Crud so the solution posted does not apply to me. Has this been resolved elsewhere? Thanks. Tom On Saturday, 15 December 2012 18:27:51 UTC-5, jonas wrote: Hi. I have a default form that is passed in view: {{=form}} using this validation and insertion works. but when I use a custom form none of that works. why? Also form.process().accepted works only when using default form. My second question is: when submitting the form I redirect to index, and all entries in the db are returned. Is that because i reuse the index function? Is there any way to clear all fields after a successful submit? the code: default.py: def index(): query=db.blog.id0 res=db(query).select(orderby=~db.blog.date) query=db.about.id0 about=db(query).select() query=db.comments.post_id0 com=db(query).select(orderby=~db.comments.created_on) return dict(res=res,about=about,com=com,message=T('Everything should be made as simple as possible, but not simpler')) def comment(): create comment form. Every comment is id locked to the specific post post=db(db.blog.id==request.args(0)).select().first() db.comments.post_id.default=post.id form=crud.create(db.comments) if form.process().accepted: print 'form accepted' redirect(URL('index')) else: print 'not accepted' return dict(form=form) index.html: {{=A(TAG.i(_class=icon-plus-sign), _rel=tooltip, _title=testing, _class=btn, _href='#', _onclick=jQuery('#uc').toggle();)}} div id=uc {{=LOAD('default','comment.load',args=result.id,ajax=True)}} /div comment.load: {{=form}} thanks -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: invalid literal for int() with base 10: running mongodb
I will. Thanks Paolo. Regards, Ron On Sunday, May 10, 2015 at 11:49:37 AM UTC-4, Paolo Valleri wrote: Hi Ron, please open an issue on https://github.com/web2py/pydal/issues it seems that mongo adapter doesn't support list:reference table yet On Sunday, May 10, 2015 at 4:09:51 PM UTC+2, Ron Chatterjee wrote: I have the following in model. I get an error invalide literal for int when I add the line Field(comments, list: reference comment). Otherwise it works fine db.define_table('Post', Field('author'), Field('content','Text'), Field(tags,list:string), Field(comments,list:reference comment), Field('date', 'datetime',default=request.now)) db.define_table(comment, Field(created_on,datetime,default=request.now), Field(body,text), Field(author,reference auth_user)) posts = db._adapter.connection.posts_three --- Below is the error I get. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. Traceback (most recent call last): File C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\restricted.py, line 227, in restricted exec ccode in environment File C:/Users/Ron/Desktop/web2py_new/web2py_new/applications/mongo_example1/controllers/appadmin.py http://127.0.0.1:8000/admin/default/edit/mongo_example1/controllers/appadmin.py, line 704, in module File C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\globals.py, line 393, in lambda self._caller = lambda f: f() File C:/Users/Ron/Desktop/web2py_new/web2py_new/applications/mongo_example1/controllers/appadmin.py http://127.0.0.1:8000/admin/default/edit/mongo_example1/controllers/appadmin.py, line 151, in insert if form.accepts(request.vars, session): File C:\Users\Ron\Desktop\web2py_new\web2py_new\gluon\sqlhtml.py, line 1679, in accepts self.vars.id = self.table.insert(**fields) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\objects.py, line 737, in insert ret = self._db._adapter.insert(self, self._listify(fields)) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\mongo.py, line 359, in insert values[fieldname] = self.represent(v, fieldtype) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\mongo.py, line 146, in represent value = NoSQLAdapter.represent(self, obj, fieldtype) File C:\Users\Ron\AppData\Local\Enthought\Canopy\User\lib\site-packages\pydal-15.02.27-py2.7.egg\pydal\adapters\base.py, line 1795, in represent return map(int,obj) ValueError: invalid literal for int() with base 10: 'comment one' -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: SQLFORM.smartgrid and constraint
please check the book ref: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Logical-operators best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.