[web2py] Select image path and content from a db(table).select()
Hello, I was wondering how to do a web service (json) to select all rows from a table, where there's an 'upload' field type and return them in JSON, with "upload" field data (images) encoded in base64. The problem I'm having is that when I do the db(table_name).select() I'm only getting the image path but not the conten. It would be nice to get that in a few lines of code instead of having to build my own logic. Hope it makes sense to you. Thanks in advance! -- 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] SQLFORM.smartgrid() ui does not accept elements customization through dict() (SQLFORM.grid does)
Hello! I tried to apply some css classes to smartgrid elements with no success. It seems that smartgrid ignores ui argument but grid does my controller: def index(): """ example action using the internationalization operator T and flash rendered by views/default/index.html or views/generic.html if you need a simple wiki simply replace the two lines below with: return auth.wiki() """ form = SQLFORM.smartgrid(db.citizen, user_signature=False, ui = dict(widget='', header='', content='', default='', cornerall='', cornertop='', cornerbottom='', button='btn btn-default button', buttontext='buttontext button', buttonadd='glyphicon glyphicon-plus space-after btn-primary', buttonback='glyphicon glyphicon-arrow-left space-after', buttonexport='glyphicon glyphicon-download space-after', buttondelete='glyphicon glyphicon-trash space-after', buttonedit='glyphicon glyphicon-pencil space-after', buttontable='glyphicon glyphicon-arrow-right space-after', buttonview='glyphicon glyphicon-arrow-zoom-in space-after')) return dict(form=form) If I change some css class names, smartgrid ignores them and uses the default ones. But if I use grid instead of smartgrid, css changes takes effect. How can I use ui argument on smartgrid too?. Thanks in advance! P.S.: I'm using web2py 2.14.6-stable+timestamp.2016.05.10.00.21.47 -- 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: Smartgrid search: How do I search on integers and linked tables?
On Tuesday, September 6, 2016 at 11:37:00 AM UTC-3, Massimo Di Pierro wrote: > > You can customize smartgrid and make your own search function. By default > you cannot. > Thanks Massimo! > > On Thursday, 1 September 2016 20:34:27 UTC-5, Luciano Laporta Podazza > wrote: >> >> Hello, >> >> 1. I noted that Smartgrid does not search on integers unless I select >> that specific field on the dropdown search widget menu, so I would like to >> know how to "enable" this by default so users can search by numbers too. >> >> 2. On the other hand, I would like to search on linked tables too. >> >> Is all this possible?, thanks in advance! >> > -- 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] Smartgrid search: How do I search on integers and linked tables?
Hello, 1. I noted that Smartgrid does not search on integers unless I select that specific field on the dropdown search widget menu, so I would like to know how to "enable" this by default so users can search by numbers too. 2. On the other hand, I would like to search on linked tables too. Is all this possible?, thanks in advance! -- 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] Bug?: Spanish formatted dates won't store on database(english ones do)
Hello, I'm working on a simple case file project and realized that working with english date format has no issues but if I use spanish ones(taking advantage of internacionalization) they don't get stored on database. Here is my controller: @auth.requires_login() def index(): """ example action using the internationalization operator T and flash rendered by views/default/index.html or views/generic.html if you need a simple wiki simply replace the two lines below with: return auth.wiki() """ form = SQLFORM.smartgrid(db.case_file) return dict(form=form) Here is my model: db.define_table('case_file', Field('auth_user_id', db.auth_user), Field('case_file_number', 'integer', label=T("Case Number"), requires= IS_NOT_EMPTY()), Field('case_file_code', 'integer', label=T("Case Code"), requires= IS_NOT_EMPTY()), Field('case_file_letter', 'string', label=T("Case Letter"), requires= IS_NOT_EMPTY()), Field('case_file_year', 'date', label=T("Case Year"), requires= IS_NOT_EMPTY()), Field('case_file_subject', 'string', label=T("Case Subject"), requires= IS_NOT_EMPTY()), ) db.define_table('case_file_history', Field('case_file_id', db.case_file), Field('created_by', 'string', label=T("Created By"), requires= IS_NOT_EMPTY()), Field('case_file_ingress', 'date', label=T("Case Ingress"), requires= IS_NOT_EMPTY()), Field('case_file_egress', 'date', label=T("Case Egress"), requires= IS_NOT_EMPTY()), Field('case_file_to', 'string', label=T("Case To"), requires= IS_NOT_EMPTY()), Field('case_file_status', 'string', label=T("Case Status"), requires= IS_NOT_EMPTY()), ) To recreate this issue, create a new project, use my code and set your browser to spanish. It won't store any field of date type on database, but if browser is set up in english language, it will. I'm using web2py 2.14.6-stable+timestamp.2016.05.10.00.21.47 on Mac OS X El Capitan and sqlite or mysql(issue repeats on both databases). Any help will be appreciated. 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.
Re: [web2py] Re: nginx setup: [Errno 13] Permission denied: '/root/.python-eggs'
Hello again, So I did recreate the VPS and everythng worked as expected :/ Even so, it still throws the "setup.sh: 5: setup.sh: [[: not found". I just logged in as r...@mydomain.com and call the setup.sh script. Thanks a lot for your help!!! :) On Thu, Oct 22, 2015 at 6:22 PM, Niphlod <niph...@gmail.com> wrote: > this log smells about a not-so-fresh installation (seems more like a > second run of the same script). > Apart from that (drop the VPS and recreate a fresh one), there is a weird > error at the top which points to being in an unusual environment (setup.sh: > 5: setup.sh: [[: not found) > > how did you get in that shell ? > sudo su - ? > > -- > 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/S4DcLQ1MEAQ/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. > -- Atte Luciano Laporta Podazza -- 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: db.commit() taking too long to update records
Thanks for the headsup Anthony!, luckly it's not my case. Cheers! On Thu, Oct 23, 2014 at 2:18 PM, Anthony abasta...@gmail.com wrote: On Thursday, October 23, 2014 12:52:33 PM UTC-4, Leonel Câmara wrote: Doesn't the database take care of that? I mean isn't db session handling inside a transaction anyway? Yes, but that doesn't help across requests (e.g., request A reads session request B reads session request A updates session request B overwrites request A's update). The session table in the db does include a locked field, but as far as I can tell, it is not actually used. Another option would be to do a select-for-update, which would result in the db locking the record until the transaction completes (though in the case of SQLite, I think the whole db gets locked). 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/6z13PTcZ5io/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. -- Atte Luciano Laporta Podazza -- 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: db.commit() taking too long to update records
Hi Anthony!, Indeed, the ajax call was the issue, after reading this: http://web2py.com/books/default/chapter/29/04#session I realised that storing sessions in database solved my problem(there's no more blocking calls issue). Thanks a lot for your help Cheers. On Thu, Oct 23, 2014 at 1:01 AM, Anthony abasta...@gmail.com wrote: Instead of checking the timings in the console, check the timings during the actual Ajax request (maybe return the timings in some HTML and display it in the browser instead of just returning OK; or print the timings to the console). Are there any other Ajax requests that get fired before this one that could be causing a delay? If you are using file based sessions, a prior Ajax request would block a new request while waiting for the session file to be unlocked (unless you call session.forget(response)). Anthony On Wednesday, October 22, 2014 9:30:50 PM UTC-4, Luciano Laporta Podazza wrote: Hi Niphlod, I did what you say and if I try doing the query through console it works perfectly and fast: db._timings [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328)] db((db.alerts.alerts_id==1)(db.alerts.archived != True)).update( archived=True, crime=Robo, operator_id=1) 23 db._timings [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328), (UPDATE alerts SET archived='T',operator_id=1,crime='Robo' WHERE ((alerts.alerts_id = 1) AND (alerts.archived 'T'));, 0.010937213897705078)] db.commit() db._timings [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328), (UPDATE alerts SET archived='T',operator_id=1,crime='Robo' WHERE ((alerts.alerts_id = 1) AND (alerts.archived 'T'));, 0.010937213897705078)] But again, if I try sending the ajax request(a simple one, really), it gets stucked as I mentioned before, then after 20-30seconds the record gets updated. I'm using MySQL 5.5 with less than 50 records on the affected table. Any help will be appreciated. Thanks On Wednesday, September 10, 2014 6:20:47 AM UTC-3, Niphlod wrote: BTW, log somewhere db._timings before returning and try to replay the query in mysql to see what's going on. On Wednesday, September 10, 2014 12:54:03 AM UTC+2, Leonel Câmara wrote: Well that's true, but web2py automatically calls db.commit for you after running the controller. That would not cause the slowdown anyway. -- 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/6z13PTcZ5io/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. -- Atte Luciano Laporta Podazza -- 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: db.commit() taking too long to update records
Hi Niphlod, I did what you say and if I try doing the query through console it works perfectly and fast: db._timings [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328)] db((db.alerts.alerts_id==1)(db.alerts.archived != True)).update( archived=True, crime=Robo, operator_id=1) 23 db._timings [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328), (UPDATE alerts SET archived='T',operator_id=1,crime='Robo' WHERE ((alerts.alerts_id = 1) AND (alerts.archived 'T'));, 0.010937213897705078)] db.commit() db._timings [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328), (UPDATE alerts SET archived='T',operator_id=1,crime='Robo' WHERE ((alerts.alerts_id = 1) AND (alerts.archived 'T'));, 0.010937213897705078)] But again, if I try sending the ajax request(a simple one, really), it gets stucked as I mentioned before, then after 20-30seconds the record gets updated. I'm using MySQL 5.5 with less than 50 records on the affected table. Any help will be appreciated. Thanks On Wednesday, September 10, 2014 6:20:47 AM UTC-3, Niphlod wrote: BTW, log somewhere db._timings before returning and try to replay the query in mysql to see what's going on. On Wednesday, September 10, 2014 12:54:03 AM UTC+2, Leonel Câmara wrote: Well that's true, but web2py automatically calls db.commit for you after running the controller. That would not cause the slowdown anyway. -- 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: db.commit() taking too long to update records
By the way, I've already tried the SQL query manually and it works perfectly. I'm using Web2py 2.9.11 and I'm starting to think that perhaps there's an issue with web2py services. Any ideas?. Thanks On Wed, Oct 22, 2014 at 10:30 PM, Luciano Laporta Podazza lucianopoda...@gmail.com wrote: Hi Niphlod, I did what you say and if I try doing the query through console it works perfectly and fast: db._timings [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328)] db((db.alerts.alerts_id==1)(db.alerts.archived != True)).update( archived=True, crime=Robo, operator_id=1) 23 db._timings [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328), (UPDATE alerts SET archived='T',operator_id=1,crime='Robo' WHERE ((alerts.alerts_id = 1) AND (alerts.archived 'T'));, 0.010937213897705078)] db.commit() db._timings [('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), (SET sql_mode='NO_BACKSLASH_ESCAPES';, 0.0002338886260986328), (UPDATE alerts SET archived='T',operator_id=1,crime='Robo' WHERE ((alerts.alerts_id = 1) AND (alerts.archived 'T'));, 0.010937213897705078)] But again, if I try sending the ajax request(a simple one, really), it gets stucked as I mentioned before, then after 20-30seconds the record gets updated. I'm using MySQL 5.5 with less than 50 records on the affected table. Any help will be appreciated. Thanks On Wednesday, September 10, 2014 6:20:47 AM UTC-3, Niphlod wrote: BTW, log somewhere db._timings before returning and try to replay the query in mysql to see what's going on. On Wednesday, September 10, 2014 12:54:03 AM UTC+2, Leonel Câmara wrote: Well that's true, but web2py automatically calls db.commit for you after running the controller. That would not cause the slowdown anyway. -- 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/6z13PTcZ5io/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. -- Atte Luciano Laporta Podazza -- 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: Item in ``from list'' not a string (custom_import.py) web2py 2.9.11
Hi again, So a friend of mine helped me solving the issue, on gluon/custom_import.py, on line 82 we have to replace this line: modules_prefix, globals, locals, [itemname], level) With this one: modules_prefix, globals, locals, [itemname*.encode('utf-8')*], level) And that's all!. Thanks for your support! On Mon, Oct 13, 2014 at 4:36 PM, Luciano Laporta Podazza lucianopoda...@gmail.com wrote: Thanks Niphlod, I've just managed to make any python version work ( 2.7.5), web2py runs the Python version I want but the error still remains. It's weird 'cause on my Mac, with Python *2.7.5 (default, Mar 9 2014, 22:15:05) *it works like a charm. I'll keep the research but this is driving me nuts. On Mon, Oct 13, 2014 at 4:28 PM, Niphlod niph...@gmail.com wrote: it's not a web2py issue but it seems something with the Shopify lib and that bug that isn't going very well as of web2py starts with something else you need to check your setup web2py can't choose what python version to run at runtime On Sunday, October 12, 2014 7:39:16 PM UTC+2, Luciano Laporta Podazza wrote: It seems to. I've tried using pyenv to switch to Python 2.7.5 (the one it works), declared it as global and verified that works running 'python', reinstalled web2py 2.9.11 on server but web2py it still uses Python *2.7.6*. On the other hand I've tried to apply the patch with no luck (actually I'm learning how to do it :P) Any suggestions?. Thanks! On Sun, Oct 12, 2014 at 10:07 AM, Niphlod nip...@gmail.com wrote: uhm, could be something related to http://bugs.python.org/issue21720 On Sunday, October 12, 2014 1:53:40 AM UTC+2, Luciano Laporta Podazza wrote: Hello, I'm using locally web2py (*2.9.8*) + Shopify API (2.0.4) on Mac OS X 10.9.5 (Python *2.7.5*) and this code works perfectly: from gluon.tools import Service service = Service() import gluon.contrib.simplejson as json def call(): session.forget() return service() @service.json def create_order(): data = json.loads(request.body.read()) import shopify #(API Key, Password) shop_url = https://%s:%s...@myshop.myshopify.com/admin; % ('key', 'secret') shopify.ShopifyResource.set_site(shop_url) shop = shopify.Shop.current orders = shopify.Order.find(financial_status='pending') new_order = shopify.Order() for order in orders: if order.order_number == data['order_number']: clone_order(order, new_order, order.attributes) def clone_order(objfrom, objto, names): for n in names: if hasattr(objfrom, n): if n in [source_name, cart_token, id, token, name, checkout_token, checkout_id]: objto.n = None elif n == line_items: v = getattr(objfrom, n) setattr(objto, n, v) if objto.line_items[-1].title != Cargo por COD: objto.line_items.append({variant_id : 972802884, quantity : 1, price: 2.5, title: Cargo por COD}) elif n == order_number: v = getattr(objfrom, n) objto.note = Agregado COD, numero de orden vieja: # + str(objfrom.order_number) else: v = getattr(objfrom, n) setattr(objto, n, v) objto.order_number = 1198 try: objto.save() objfrom.cancel() objfrom.close() return Success except Exception, e: return Fail But when deploying to server (Ubuntu 14.04 with Web2py *2.9.11* / Python *2.7.6 -note the different python and web2py version-*) I get this error: Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 224, in restricted exec ccode in environment File /home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py, line 49, in module File /home/www-data/web2py/gluon/globals.py, line 392, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py, line 7, in call return service() File /home/www-data/web2py/gluon/tools.py, line 5138, in __call__ return self.serve_json(request.args[1:]) File /home/www-data/web2py/gluon/tools.py, line 4815, in serve_json s = universal_caller(self.json_procedures[args[0]], *args[1:], **d) File /home/www-data/web2py/gluon/tools.py, line 4474, in universal_caller return f(**arg_dict) File /home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py, line 17, in create_order orders = shopify.Order.find(financial_status='pending') File /usr/local/lib/python2.7/dist-packages
Re: [web2py] Re: Item in ``from list'' not a string (custom_import.py) web2py 2.9.11
Thanks Niphlod, I've just managed to make any python version work ( 2.7.5), web2py runs the Python version I want but the error still remains. It's weird 'cause on my Mac, with Python *2.7.5 (default, Mar 9 2014, 22:15:05) *it works like a charm. I'll keep the research but this is driving me nuts. On Mon, Oct 13, 2014 at 4:28 PM, Niphlod niph...@gmail.com wrote: it's not a web2py issue but it seems something with the Shopify lib and that bug that isn't going very well as of web2py starts with something else you need to check your setup web2py can't choose what python version to run at runtime On Sunday, October 12, 2014 7:39:16 PM UTC+2, Luciano Laporta Podazza wrote: It seems to. I've tried using pyenv to switch to Python 2.7.5 (the one it works), declared it as global and verified that works running 'python', reinstalled web2py 2.9.11 on server but web2py it still uses Python *2.7.6*. On the other hand I've tried to apply the patch with no luck (actually I'm learning how to do it :P) Any suggestions?. Thanks! On Sun, Oct 12, 2014 at 10:07 AM, Niphlod nip...@gmail.com wrote: uhm, could be something related to http://bugs.python.org/issue21720 On Sunday, October 12, 2014 1:53:40 AM UTC+2, Luciano Laporta Podazza wrote: Hello, I'm using locally web2py (*2.9.8*) + Shopify API (2.0.4) on Mac OS X 10.9.5 (Python *2.7.5*) and this code works perfectly: from gluon.tools import Service service = Service() import gluon.contrib.simplejson as json def call(): session.forget() return service() @service.json def create_order(): data = json.loads(request.body.read()) import shopify #(API Key, Password) shop_url = https://%s:%s...@myshop.myshopify.com/admin; % ('key', 'secret') shopify.ShopifyResource.set_site(shop_url) shop = shopify.Shop.current orders = shopify.Order.find(financial_status='pending') new_order = shopify.Order() for order in orders: if order.order_number == data['order_number']: clone_order(order, new_order, order.attributes) def clone_order(objfrom, objto, names): for n in names: if hasattr(objfrom, n): if n in [source_name, cart_token, id, token, name , checkout_token, checkout_id]: objto.n = None elif n == line_items: v = getattr(objfrom, n) setattr(objto, n, v) if objto.line_items[-1].title != Cargo por COD: objto.line_items.append({variant_id : 972802884, quantity : 1, price: 2.5, title: Cargo por COD}) elif n == order_number: v = getattr(objfrom, n) objto.note = Agregado COD, numero de orden vieja: # + str(objfrom.order_number) else: v = getattr(objfrom, n) setattr(objto, n, v) objto.order_number = 1198 try: objto.save() objfrom.cancel() objfrom.close() return Success except Exception, e: return Fail But when deploying to server (Ubuntu 14.04 with Web2py *2.9.11* / Python *2.7.6 -note the different python and web2py version-*) I get this error: Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 224, in restricted exec ccode in environment File /home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py, line 49, in module File /home/www-data/web2py/gluon/globals.py, line 392, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py, line 7, in call return service() File /home/www-data/web2py/gluon/tools.py, line 5138, in __call__ return self.serve_json(request.args[1:]) File /home/www-data/web2py/gluon/tools.py, line 4815, in serve_json s = universal_caller(self.json_procedures[args[0]], *args[1:], **d) File /home/www-data/web2py/gluon/tools.py, line 4474, in universal_caller return f(**arg_dict) File /home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py, line 17, in create_order orders = shopify.Order.find(financial_status='pending') File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 385, in find return cls._find_every(from_=from_, **kwargs) File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 524, in _find_every prefix_options) File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 555, in _build_list resources.append(cls(element, prefix_options)) File build/bdist.linux
Re: [web2py] Re: Item in ``from list'' not a string (custom_import.py) web2py 2.9.11
It seems to. I've tried using pyenv to switch to Python 2.7.5 (the one it works), declared it as global and verified that works running 'python', reinstalled web2py 2.9.11 on server but web2py it still uses Python *2.7.6*. On the other hand I've tried to apply the patch with no luck (actually I'm learning how to do it :P) Any suggestions?. Thanks! On Sun, Oct 12, 2014 at 10:07 AM, Niphlod niph...@gmail.com wrote: uhm, could be something related to http://bugs.python.org/issue21720 On Sunday, October 12, 2014 1:53:40 AM UTC+2, Luciano Laporta Podazza wrote: Hello, I'm using locally web2py (*2.9.8*) + Shopify API (2.0.4) on Mac OS X 10.9.5 (Python *2.7.5*) and this code works perfectly: from gluon.tools import Service service = Service() import gluon.contrib.simplejson as json def call(): session.forget() return service() @service.json def create_order(): data = json.loads(request.body.read()) import shopify #(API Key, Password) shop_url = https://%s:%s...@myshop.myshopify.com/admin; % ('key', 'secret') shopify.ShopifyResource.set_site(shop_url) shop = shopify.Shop.current orders = shopify.Order.find(financial_status='pending') new_order = shopify.Order() for order in orders: if order.order_number == data['order_number']: clone_order(order, new_order, order.attributes) def clone_order(objfrom, objto, names): for n in names: if hasattr(objfrom, n): if n in [source_name, cart_token, id, token, name, checkout_token, checkout_id]: objto.n = None elif n == line_items: v = getattr(objfrom, n) setattr(objto, n, v) if objto.line_items[-1].title != Cargo por COD: objto.line_items.append({variant_id : 972802884, quantity : 1, price: 2.5, title: Cargo por COD}) elif n == order_number: v = getattr(objfrom, n) objto.note = Agregado COD, numero de orden vieja: # + str(objfrom.order_number) else: v = getattr(objfrom, n) setattr(objto, n, v) objto.order_number = 1198 try: objto.save() objfrom.cancel() objfrom.close() return Success except Exception, e: return Fail But when deploying to server (Ubuntu 14.04 with Web2py *2.9.11* / Python *2.7.6 -note the different python and web2py version-*) I get this error: Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 224, in restricted exec ccode in environment File /home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py, line 49, in module File /home/www-data/web2py/gluon/globals.py, line 392, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py, line 7, in call return service() File /home/www-data/web2py/gluon/tools.py, line 5138, in __call__ return self.serve_json(request.args[1:]) File /home/www-data/web2py/gluon/tools.py, line 4815, in serve_json s = universal_caller(self.json_procedures[args[0]], *args[1:], **d) File /home/www-data/web2py/gluon/tools.py, line 4474, in universal_caller return f(**arg_dict) File /home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py, line 17, in create_order orders = shopify.Order.find(financial_status='pending') File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 385, in find return cls._find_every(from_=from_, **kwargs) File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 524, in _find_every prefix_options) File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 555, in _build_list resources.append(cls(element, prefix_options)) File build/bdist.linux-i686/egg/shopify/base.py, line 130, in __init__ return super(ShopifyResource, self).__init__(attributes, prefix_options) File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 362, in __init__ self._update(attributes) File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 952, in _update klass = self._find_class_for(key) File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 1016, in _find_class_for __import__('.'.join([module.__name__, element_name])) File /home/www-data/web2py/gluon/custom_import.py, line 82, in custom_importer modules_prefix, globals, locals, [itemname], level
[web2py] Item in ``from list'' not a string (custom_import.py) web2py 2.9.11
Hello, I'm using locally web2py (*2.9.8*) + Shopify API (2.0.4) on Mac OS X 10.9.5 (Python *2.7.5*) and this code works perfectly: from gluon.tools import Service service = Service() import gluon.contrib.simplejson as json def call(): session.forget() return service() @service.json def create_order(): data = json.loads(request.body.read()) import shopify #(API Key, Password) shop_url = https://%s:%s...@myshop.myshopify.com/admin; % ('key','secret') shopify.ShopifyResource.set_site(shop_url) shop = shopify.Shop.current orders = shopify.Order.find(financial_status='pending') new_order = shopify.Order() for order in orders: if order.order_number == data['order_number']: clone_order(order, new_order, order.attributes) def clone_order(objfrom, objto, names): for n in names: if hasattr(objfrom, n): if n in [source_name, cart_token, id, token, name, checkout_token, checkout_id]: objto.n = None elif n == line_items: v = getattr(objfrom, n) setattr(objto, n, v) if objto.line_items[-1].title != Cargo por COD: objto.line_items.append({variant_id : 972802884, quantity : 1, price: 2.5, title: Cargo por COD}) elif n == order_number: v = getattr(objfrom, n) objto.note = Agregado COD, numero de orden vieja: # + str( objfrom.order_number) else: v = getattr(objfrom, n) setattr(objto, n, v) objto.order_number = 1198 try: objto.save() objfrom.cancel() objfrom.close() return Success except Exception, e: return Fail But when deploying to server (Ubuntu 14.04 with Web2py *2.9.11* / Python *2.7.6 -note the different python and web2py version-*) I get this error: Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 224, in restricted exec ccode in environment File /home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py, line 49, in module File /home/www-data/web2py/gluon/globals.py, line 392, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py, line 7, in call return service() File /home/www-data/web2py/gluon/tools.py, line 5138, in __call__ return self.serve_json(request.args[1:]) File /home/www-data/web2py/gluon/tools.py, line 4815, in serve_json s = universal_caller(self.json_procedures[args[0]], *args[1:], **d) File /home/www-data/web2py/gluon/tools.py, line 4474, in universal_caller return f(**arg_dict) File /home/www-data/web2py/applications/mascotanube/controllers/cash_on_delivery.py https://activecrime.com/admin/default/edit/mascotanube/controllers/cash_on_delivery.py, line 17, in create_order orders = shopify.Order.find(financial_status='pending') File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 385, in find return cls._find_every(from_=from_, **kwargs) File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 524, in _find_every prefix_options) File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 555, in _build_list resources.append(cls(element, prefix_options)) File build/bdist.linux-i686/egg/shopify/base.py, line 130, in __init__ return super(ShopifyResource, self).__init__(attributes, prefix_options) File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 362, in __init__ self._update(attributes) File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 952, in _update klass = self._find_class_for(key) File /usr/local/lib/python2.7/dist-packages/pyactiveresource/activeresource.py, line 1016, in _find_class_for __import__('.'.join([module.__name__, element_name])) File /home/www-data/web2py/gluon/custom_import.py, line 82, in custom_importer modules_prefix, globals, locals, [itemname], level) TypeError: Item in ``from list'' not a string I also tested it with web2py 2.9.11 *locally *and it works fine too so I can't figure it out where the issue is. Any help will be appreciated. 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: Customize SQLFORM.grid
Thanks guys! Anthony's hint help me out to solve this. If somebody is interested on how I did it, here's the code: def search(): users = SQLFORM.grid(db.users, fields=[db.users.id, db.users.facebook_id, db.users.first_name, db. users.last_name, db.users.birthday], sortable=False, deletable=False, editable=False, create=False, csv=False, paginate=20) users.element('.web2py_grid')['_id'] = 'root' #giving an id to the grid container for personal purposes users.element('.web2py_grid')['_class'] = 'row' #giving a class name to the grid container for personal purposes users.element('.web2py_counter')[0] = '' #i dont want the 'X results found' message users[0].element('.web2py_console')['_class'] = '' #full width search input users[0][1][0][1] = '' #remove search button users[0][1][0][2] = '' #remove clear button users[0][1][0][0]['_onfocus'] = None #remove event from input users[0][1][0][0]['_placeholder'] = 'Buscar usuarios...' users[0][1][1] = '' table_div = users.element('.web2py_table') table_div[0] = '' table_div['_class'] = 'row' try: users[2] #checking that pagination exists except Exception, e: #if it does not exists for i in range(0, len(users.rows)): table_div.insert(-1, DIV( A(IMG(_src=http://graph.facebook.com/+ str(users.rows[ i].facebook_id)+/picture?type=large,_class=media-object,_width=100, _height=100) ,_class=pull-left,_href=URL('operator','user_profile', args=users.rows[i].id)), DIV(H4(users.rows[i].first_name+' '+users.rows[i]. last_name), SPAN(users.rows[i].birthday,_class=birthday),' años', BR(), A('Ver detalles',_href=URL('operator','user_profile' ,args=users.rows[i].id),_class=btn btn-primary, _role=button), _class=media-body) ,_class=media col-md-4,_style=margin-top:0px;) ) else: #pagination exists! users[2][0]['_class'] = 'pagination' for i in range(0, len(users.rows)): table_div.insert(-1, DIV( A(IMG(_src=http://graph.facebook.com/+ str(users.rows[ i].facebook_id)+/picture?type=large,_class=media-object,_width=100, _height=100) ,_class=pull-left,_href=URL('operator','user_profile', args=users.rows[i].id)), DIV(H4(users.rows[i].first_name+' '+users.rows[i]. last_name), SPAN(users.rows[i].birthday,_class=birthday),' años', BR(), A('Ver detalles',_href=URL('operator','user_profile' ,args=users.rows[i].id),_class=btn btn-primary, _role=button), _class=media-body) ,_class=media col-md-4,_style=margin-top:0px;) ) return dict(users=users) And this is how it looks (I changed my mind and ended using media-objects instead of thumbnails for users long names situations): With pagination(I forced paginate=1 'cause I have only three users): https://lh5.googleusercontent.com/-Pfwad2y2wHg/VBEUxvMxAsI/BYs/aEAO0VKYPvs/s1600/Screen%2BShot%2B2014-09-11%2Bat%2B00.18.23.png Without pagination: https://lh6.googleusercontent.com/-jo7oy8j-pco/VBEWkxst6hI/BY0/t1VHx73j4_4/s1600/Screen%2BShot%2B2014-09-11%2Bat%2B00.27.02.png Thanks a lot for your help! Cheers! On Wednesday, September 10, 2014 11:36:06 AM UTC-3, Anthony wrote: Are you saying you don't want each record in an HTML table row but instead want to display each record as a card? There's no built-in way to do that, but you can hack the returned grid object and replace the HTML table with your own DOM: def my_custom_grid_layout(rows): [code to produce the desired DOM from a DAL Rows object] grid = SQLFORM.grid(db.mytable) table_div = grid.element('.web2py_table') if table_div: table_div[0] = my_custom_grid_layout(grid.rows) You'll have to write your own code to generate the layout you want. Anthony On Wednesday, September 10, 2014 1:35:12 AM UTC-4, Luciano Laporta Podazza wrote: Hello, I would like to take advantage of SQLFORM.grid search, listing and pagination capabilities to generate a listing from a table, but I need to customize the resulting rows like this: https://lh3.googleusercontent.com/-TbnhU4p9EOw/VA_hxFcXi_I/BYI/Ti2JNW4AdAg/s1600/Screen%2BShot%2B2014-09-10%2Bat%2B02.23.35.png Until now I only have this: users = SQLFORM.grid(db.users,fields=[db.users.id, db.users.first_name, db.users.last_name], headers={'users.id':'id','users.first_name':'Nombre', 'users.last_name':'Apellido'}, sortable=False, deletable=False, editable=False, create=False, csv=False, formstyle=div) Which results into this: https://lh4.googleusercontent.com/-E7cySzUy2Bw/VA_iuQU_5CI/BYQ
[web2py] db.commit() taking too long to update records
Hello, I'm having a strange issue, I have a website that queries data through an ajax call from the server using web2py json services every *5 seconds*. Then from the client I can update some data to the server with this: @service.json def block_user(): data = json.loads(request.body.read()) user = db(db.users.id==data['id']).select().first() user.update_record(banned=True, banned_by=auth.user_id) alerts = db(db.alerts.alerts_id==data['id']).update(archived=True) db.commit() return ok There's like 10 records in the database to be updated but the query takes like 15-30seconds to process. I have no idea why is happening this. Any help will be appreciated. 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.
Re: [web2py] Re: db.commit() taking too long to update records
Sorry, I forgot to mention that I'm using MySQL as db engine. Thanks. On Tue, Sep 9, 2014 at 6:45 PM, Leonel Câmara leonelcam...@gmail.com wrote: My guess would be that you're using sqlite and the database is locking you. Which is easy to happen if you have a few people requesting updates every 5 seconds and you're trying to write on it, as the write will only go forward once sqlite gets its process an EXCLUSIVE lock which requires all readers which have SHARED locks to stop reading first. One thing you can do is to cache the result returned in the first case so it doesn't hit the database. Then you can clear the cache when you make changes that would change the result. If this doesn't work then it's time to change databases. -- 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/6z13PTcZ5io/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. -- Atte Luciano Laporta Podazza -- 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: db.commit() taking too long to update records
Thanks for your help Leonel. I didn't tried it but I'm talking about a dead simple db structure, it's just updating a few records( like 10 rows or so) on a single table. On Tue, Sep 9, 2014 at 7:24 PM, Leonel Câmara leonelcam...@gmail.com wrote: Then I'm sorry but I have no idea why it's taking so long. You need to profile it. It may just be a question of tuning MySQL, optimizing the tables, etc. Have you tried mysqltuner? -- 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/6z13PTcZ5io/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. -- Atte Luciano Laporta Podazza -- 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: db.commit() taking too long to update records
Perhaps I misunderstood this, but following the web2py manual it says that no recordset is updated until you do db.commit(). Is that right?. On Tue, Sep 9, 2014 at 7:29 PM, villas villa...@gmail.com wrote: If this is in a controller, do you need the line: db.commit() ?? -- 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/6z13PTcZ5io/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. -- Atte Luciano Laporta Podazza -- 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] Customize SQLFORM.grid
Hello, I would like to take advantage of SQLFORM.grid search, listing and pagination capabilities to generate a listing from a table, but I need to customize the resulting rows like this: https://lh3.googleusercontent.com/-TbnhU4p9EOw/VA_hxFcXi_I/BYI/Ti2JNW4AdAg/s1600/Screen%2BShot%2B2014-09-10%2Bat%2B02.23.35.png Until now I only have this: users = SQLFORM.grid(db.users,fields=[db.users.id, db.users.first_name, db.users.last_name], headers={'users.id':'id','users.first_name':'Nombre', 'users.last_name':'Apellido'}, sortable=False, deletable=False, editable=False, create=False, csv=False, formstyle=div) Which results into this: https://lh4.googleusercontent.com/-E7cySzUy2Bw/VA_iuQU_5CI/BYQ/n5mLgALWJcs/s1600/Screen%2BShot%2B2014-09-10%2Bat%2B02.33.16.png I'm using Bootstrap 3. Any help will be appreciated. -- 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: Appadmin redirect after upgrading to 2.9.7
Tested, works like a charm!. Thanks! On Sep 7, 2014 12:34 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: This is now solved in 2.9.8 On Sunday, 7 September 2014 03:45:45 UTC-5, olivier hubert wrote: I encounter exactly the same issue if you try to open the db administration page in a app. Le dimanche 7 septembre 2014 01:19:31 UTC+2, Luciano Laporta Podazza a écrit : Same issue :(, as mentioned before, tried testing default apps and my app and it redirects to admin page. On Sat, Sep 6, 2014 at 8:14 PM, Luciano Laporta Podazza luciano...@gmail.com wrote: Right now! :), I'll get back to you with results. Cheers. On Sat, Sep 6, 2014 at 8:11 PM, Massimo Di Pierro massimo@gmail.com wrote: Possible fix in trunk. Can you help test it? On Saturday, 6 September 2014 06:56:54 UTC-5, Niphlod wrote: ok. it hasn't anything to do with the more security change. It has to do with the new session storage behaviour. Filing an issue right now, shouldn't be hard to fix On Saturday, September 6, 2014 1:23:00 AM UTC+2, Dragan Matic wrote: +1 Here. It does the same thing to me, 2.9.7 appadmin redirects to web2py admin. 2.9.6 is working correctly. On Friday, September 5, 2014 10:06:24 PM UTC+2, Niphlod wrote: because the only change we made was making the access to appadmin more secure when web2py is behind a proxy. However, if you get redirected to admin it shouldn't matter, as the change would affect you accessing admin also. Seeing the code of appadmin.py (assuming is the latest from 2.9.7) the redirection is made on line 54. Look at those conditions and add a few log (or print) statements to pinpoint the root cause. On Friday, September 5, 2014 10:00:01 PM UTC+2, Luciano Laporta Podazza wrote: Hi Niphlod, No, I'm working locally and no proxies at all. Why you ask? On Fri, Sep 5, 2014 at 4:58 PM, Niphlod nip...@gmail.com wrote: are you behind a proxy ? On Friday, September 5, 2014 9:34:12 PM UTC+2, Luciano Laporta Podazza wrote: Hello, I was developing an application with web2py 2.9.5-trunk+timestamp.2014.03.29.21.54.41 and appadmin worked fine until I upgraded to latest 2.9.7. Now when I access appadmin for ANY app(welcome, examples, my app, etc) it redirects to admin and nothing happens. Tried cleaning everything, even deleting the entire database and starting from scratch and nothing happened. Any ideas about this?. Thanks in advance. -- 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/9kXd30hW3j0/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Atte Luciano Laporta Podazza -- 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/9kXd30hW3j0/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Atte Luciano Laporta Podazza -- Atte Luciano Laporta Podazza -- 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/9kXd30hW3j0/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: Appadmin redirect after upgrading to 2.9.7
Right now! :), I'll get back to you with results. Cheers. On Sat, Sep 6, 2014 at 8:11 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Possible fix in trunk. Can you help test it? On Saturday, 6 September 2014 06:56:54 UTC-5, Niphlod wrote: ok. it hasn't anything to do with the more security change. It has to do with the new session storage behaviour. Filing an issue right now, shouldn't be hard to fix On Saturday, September 6, 2014 1:23:00 AM UTC+2, Dragan Matic wrote: +1 Here. It does the same thing to me, 2.9.7 appadmin redirects to web2py admin. 2.9.6 is working correctly. On Friday, September 5, 2014 10:06:24 PM UTC+2, Niphlod wrote: because the only change we made was making the access to appadmin more secure when web2py is behind a proxy. However, if you get redirected to admin it shouldn't matter, as the change would affect you accessing admin also. Seeing the code of appadmin.py (assuming is the latest from 2.9.7) the redirection is made on line 54. Look at those conditions and add a few log (or print) statements to pinpoint the root cause. On Friday, September 5, 2014 10:00:01 PM UTC+2, Luciano Laporta Podazza wrote: Hi Niphlod, No, I'm working locally and no proxies at all. Why you ask? On Fri, Sep 5, 2014 at 4:58 PM, Niphlod nip...@gmail.com wrote: are you behind a proxy ? On Friday, September 5, 2014 9:34:12 PM UTC+2, Luciano Laporta Podazza wrote: Hello, I was developing an application with web2py 2.9.5-trunk+timestamp.2014.03.29.21.54.41 and appadmin worked fine until I upgraded to latest 2.9.7. Now when I access appadmin for ANY app(welcome, examples, my app, etc) it redirects to admin and nothing happens. Tried cleaning everything, even deleting the entire database and starting from scratch and nothing happened. Any ideas about this?. Thanks in advance. -- 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/9kXd30hW3j0/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Atte Luciano Laporta Podazza -- 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/9kXd30hW3j0/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. -- Atte Luciano Laporta Podazza -- 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: Appadmin redirect after upgrading to 2.9.7
Same issue :(, as mentioned before, tried testing default apps and my app and it redirects to admin page. On Sat, Sep 6, 2014 at 8:14 PM, Luciano Laporta Podazza lucianopoda...@gmail.com wrote: Right now! :), I'll get back to you with results. Cheers. On Sat, Sep 6, 2014 at 8:11 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Possible fix in trunk. Can you help test it? On Saturday, 6 September 2014 06:56:54 UTC-5, Niphlod wrote: ok. it hasn't anything to do with the more security change. It has to do with the new session storage behaviour. Filing an issue right now, shouldn't be hard to fix On Saturday, September 6, 2014 1:23:00 AM UTC+2, Dragan Matic wrote: +1 Here. It does the same thing to me, 2.9.7 appadmin redirects to web2py admin. 2.9.6 is working correctly. On Friday, September 5, 2014 10:06:24 PM UTC+2, Niphlod wrote: because the only change we made was making the access to appadmin more secure when web2py is behind a proxy. However, if you get redirected to admin it shouldn't matter, as the change would affect you accessing admin also. Seeing the code of appadmin.py (assuming is the latest from 2.9.7) the redirection is made on line 54. Look at those conditions and add a few log (or print) statements to pinpoint the root cause. On Friday, September 5, 2014 10:00:01 PM UTC+2, Luciano Laporta Podazza wrote: Hi Niphlod, No, I'm working locally and no proxies at all. Why you ask? On Fri, Sep 5, 2014 at 4:58 PM, Niphlod nip...@gmail.com wrote: are you behind a proxy ? On Friday, September 5, 2014 9:34:12 PM UTC+2, Luciano Laporta Podazza wrote: Hello, I was developing an application with web2py 2.9.5-trunk+timestamp.2014.03.29.21.54.41 and appadmin worked fine until I upgraded to latest 2.9.7. Now when I access appadmin for ANY app(welcome, examples, my app, etc) it redirects to admin and nothing happens. Tried cleaning everything, even deleting the entire database and starting from scratch and nothing happened. Any ideas about this?. Thanks in advance. -- 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/9kXd30hW3j0/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Atte Luciano Laporta Podazza -- 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/9kXd30hW3j0/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. -- Atte Luciano Laporta Podazza -- Atte Luciano Laporta Podazza -- 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] Appadmin redirect after upgrading to 2.9.7
Hello, I was developing an application with web2py 2.9.5-trunk+timestamp.2014.03.29.21.54.41 and appadmin worked fine until I upgraded to latest 2.9.7. Now when I access appadmin for ANY app(welcome, examples, my app, etc) it redirects to admin and nothing happens. Tried cleaning everything, even deleting the entire database and starting from scratch and nothing happened. Any ideas about this?. Thanks in advance. -- 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: Appadmin redirect after upgrading to 2.9.7
Hi Niphlod, No, I'm working locally and no proxies at all. Why you ask? On Fri, Sep 5, 2014 at 4:58 PM, Niphlod niph...@gmail.com wrote: are you behind a proxy ? On Friday, September 5, 2014 9:34:12 PM UTC+2, Luciano Laporta Podazza wrote: Hello, I was developing an application with web2py 2.9.5-trunk+timestamp.2014.03.29.21.54.41 and appadmin worked fine until I upgraded to latest 2.9.7. Now when I access appadmin for ANY app(welcome, examples, my app, etc) it redirects to admin and nothing happens. Tried cleaning everything, even deleting the entire database and starting from scratch and nothing happened. Any ideas about this?. Thanks in advance. -- 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/9kXd30hW3j0/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. -- Atte Luciano Laporta Podazza -- 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: Appadmin redirect after upgrading to 2.9.7
I've just get back to 2.9.5 and appadmin works. I'm confused :P On Fri, Sep 5, 2014 at 4:59 PM, Luciano Laporta Podazza lucianopoda...@gmail.com wrote: Hi Niphlod, No, I'm working locally and no proxies at all. Why you ask? On Fri, Sep 5, 2014 at 4:58 PM, Niphlod niph...@gmail.com wrote: are you behind a proxy ? On Friday, September 5, 2014 9:34:12 PM UTC+2, Luciano Laporta Podazza wrote: Hello, I was developing an application with web2py 2.9.5-trunk+timestamp.2014.03.29.21.54.41 and appadmin worked fine until I upgraded to latest 2.9.7. Now when I access appadmin for ANY app(welcome, examples, my app, etc) it redirects to admin and nothing happens. Tried cleaning everything, even deleting the entire database and starting from scratch and nothing happened. Any ideas about this?. Thanks in advance. -- 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/9kXd30hW3j0/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. -- Atte Luciano Laporta Podazza -- Atte Luciano Laporta Podazza -- 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: Social Login - Twitter logs out plus some other issues- web2py 2.8.2 / Mac OS X 10.9.1
Hi Tito, Actually yes but I forgot to tell you guys :P I don't know if it's the best, compliant way of doing it but it works for me. I just ended up using flags taking advantage of 'session' and under the db.py. For instance: *db.py:* if session.facebook == 1: auth.settings.login_form = FaceBookAccount() elif session.facebook == 0: pass *controller.py:* def index(): session.facebook = 0 def facebook(): session.facebook = 1 return dict(form=auth()) And that's all, whenever the user hits myapp/default/facebook it will redirect the user to facebook auth, login, and register it leaving the regular login/register intact and totally functional :) Hope it makes sense and that it helps you. Cheers On Mon, Feb 17, 2014 at 7:07 PM, Tito Garrido titogarr...@gmail.com wrote: Hi Luciano, Did you find a way to use auth.settings.login_form in the controllers? I am facing the same issue. Regards, Tito On Mon, Dec 23, 2013 at 2:06 PM, Luciano Laporta Podazza lucianopoda...@gmail.com wrote: Thanks for the advice Leonel!, You're totally right, I should change the workflow, for instance, register the user using web2py auth and then asking for Facebook/Twitter permissions to access their API. On the other hand, I'm still having some issues if I change the workflow: Web2py stores Facebook user's data only if I set *auth.settings.login_form *in *db.py *and I trigger /user/login. Otherwise it does not work as expected. This is the code I'm currently using: *db.py:* auth_table = db.define_table( auth.settings.table_user_name, Field('name', length=128, default=), 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_id', length=128, default= , writable=False,readable =False), Field('registration_key', length=128, default= , writable=False,readable =False)) auth_table.username.requires = IS_NOT_IN_DB(db, auth_table.username) auth.define_tables(username=False, signature=False) ## configure email mail = auth.settings.mailer mail.settings.server = 'logging' or 'smtp.gmail.com:587' mail.settings.sender = 'y...@gmail.com' mail.settings.login = 'username:password' ## configure auth policy auth.settings.registration_requires_verification = False auth.settings.registration_requires_approval = False auth.settings.reset_password_requires_verification = True ## Define oauth application id and secret. FB_CLIENT_ID='my_id' FB_CLIENT_SECRET=my_secret # import required modules try: import json except ImportError: from gluon.contrib import simplejson as json from facebook import GraphAPI, GraphAPIError from gluon.contrib.login_methods.oauth20_account import OAuthAccount ## extend the OAUthAccount class class FaceBookAccount(OAuthAccount): OAuth impl for FaceBook AUTH_URL=https://graph.facebook.com/oauth/authorize; 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, friends_hometown, friends_location,friends_photos', 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'] if not user.has_key('email'): email = '%s.fakemail' %(user['id']) else: email = user['email'] return dict(first_name = user['first_name'], last_name = user['last_name'], username = username, email = '%s' %(email) ) # auth.settings.login_form=FaceBookAccount() crud.settings.auth = None import oauth2 as oauth from gluon.contrib.login_methods.oauth10a_account import OAuthAccount as OAuthAccount10a consumer_key = my_key consumer_secret
[web2py] New record creates on Select?
Hello, I created a form(SQLFORM) to perform a search(without using crud.search) and for some reason, every time I do a search, a new record is created with default values. I really don't know if I'm doing something wrong or is it a bug. Tested with Web2py 2.8.2 on Mac OS X 10.9.1 and MySQL 5. All data created from scratch. Here is the *db.py*: from gluon.tools import Auth, Crud, Service, PluginManager, prettydate auth = Auth(db) crud, service, plugins = Crud(db), Service(), PluginManager() auth.settings.extra_fields['auth_user']= [ Field('facebook_id', 'string'), Field('calle', 'string'), Field('numero', 'integer'), Field('ciudad', 'string'), Field('provincia', 'string'), Field('pais', 'string'), Field('telefono', 'string'), Field('celular', 'string'), Field('first_time', 'boolean', default=1), Field('asociacion', 'boolean', default=1), Field('nombre_asociacion', 'string'), Field('email_asociacion', 'string'), Field('telefono_asociacion', 'string'), ] ## create all tables needed by auth if not custom tables auth.define_tables(username=False, signature=False) db.define_table('especies', Field('nombre_especie', 'string', requires=IS_IN_SET(['Canino','Felino' ], zero=None)), Field('nombre_raza', 'string'), ) db.define_table('mascotas', Field('mascotas_id', db.auth_user), Field('foto_mascota', 'upload'), Field('nombre', 'string'), Field('especie', 'string', requires=IS_IN_SET(['Canino','Felino'], zero= None)), Field('raza_canino', db.especies, label=Raza), Field('raza_felino', db.especies, label=Raza), Field('color', 'string'), Field('nacimiento', 'date'), Field('genero', 'string', requires=IS_IN_SET(['Macho','Hembra'] , zero= None)), Field('cruza', 'boolean', default=0), Field('adopcion', 'boolean', default=0), Field('pedigree', 'boolean', default=0), ) db.mascotas.raza_canino.requires = IS_EMPTY_OR(IS_IN_DB(db(db.especies. nombre_especie=='Canino'), db.especies.id,'%(nombre_raza)s', zero='Elegir raza')) db.mascotas.raza_felino.requires = IS_EMPTY_OR(IS_IN_DB(db(db.especies. nombre_especie=='Felino'), db.especies.id,'%(nombre_raza)s', zero='Elegir raza')) Table *especies *is where I add some pet species(cats or dogs) and their races. Here is the search on *controller.py*: def search(): search = SQLFORM(db.mascotas, fields=[ 'especie', 'raza_canino', 'raza_felino', 'genero']) if search.process().accepted: query = db((db.auth_user.id==db.mascotas.mascotas_id) (db.mascotas.especie==search.vars.especie) ((db.mascotas.raza_canino==search.vars.raza_canino)| (db.mascotas.raza_felino==search.vars.raza_felino)) (db.mascotas.genero==search.vars.genero)).select(db.mascotas. nombre, db.mascotas.nacimiento, db.auth_user.id,db.mascotas.id) return dict(query=query,search=search) elif search.errors: response.flash = 'form has errors' else: response.flash = 'please fill out the form' query='' return dict(search=search,query=query) Thanks for you help. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: New record creates on Select?
Oh guys, I'm terribly ashamed, sorry for such a lame post from me. Thanks for your time and consideration. As always, you rock guys :) Cheers! On Saturday, January 25, 2014 8:35:33 PM UTC-3, Anthony wrote: SQLFORM is designed for inserting records into the database, so this is not a bug. By default, SQLFORM.process() does an insert. To avoid that, you could do SQLFORM.process(..., dbio=False), or just do SQLFORM.validate() instead (.validate doesn't do an insert by default). Anthony On Saturday, January 25, 2014 5:57:58 PM UTC-5, Luciano Laporta Podazza wrote: Hello, I created a form(SQLFORM) to perform a search(without using crud.search) and for some reason, every time I do a search, a new record is created with default values. I really don't know if I'm doing something wrong or is it a bug. Tested with Web2py 2.8.2 on Mac OS X 10.9.1 and MySQL 5. All data created from scratch. Here is the *db.py*: from gluon.tools import Auth, Crud, Service, PluginManager, prettydate auth = Auth(db) crud, service, plugins = Crud(db), Service(), PluginManager() auth.settings.extra_fields['auth_user']= [ Field('facebook_id', 'string'), Field('calle', 'string'), Field('numero', 'integer'), Field('ciudad', 'string'), Field('provincia', 'string'), Field('pais', 'string'), Field('telefono', 'string'), Field('celular', 'string'), Field('first_time', 'boolean', default=1), Field('asociacion', 'boolean', default=1), Field('nombre_asociacion', 'string'), Field('email_asociacion', 'string'), Field('telefono_asociacion', 'string'), ] ## create all tables needed by auth if not custom tables auth.define_tables(username=False, signature=False) db.define_table('especies', Field('nombre_especie', 'string', requires=IS_IN_SET(['Canino', 'Felino'], zero=None)), Field('nombre_raza', 'string'), ) db.define_table('mascotas', Field('mascotas_id', db.auth_user), Field('foto_mascota', 'upload'), Field('nombre', 'string'), Field('especie', 'string', requires=IS_IN_SET(['Canino','Felino'],zero =None)), Field('raza_canino', db.especies, label=Raza), Field('raza_felino', db.especies, label=Raza), Field('color', 'string'), Field('nacimiento', 'date'), Field('genero', 'string', requires=IS_IN_SET(['Macho','Hembra'] ,zero =None)), Field('cruza', 'boolean', default=0), Field('adopcion', 'boolean', default=0), Field('pedigree', 'boolean', default=0), ) db.mascotas.raza_canino.requires = IS_EMPTY_OR(IS_IN_DB(db(db.especies. nombre_especie=='Canino'), db.especies.id,'%(nombre_raza)s', zero='Elegir raza')) db.mascotas.raza_felino.requires = IS_EMPTY_OR(IS_IN_DB(db(db.especies. nombre_especie=='Felino'), db.especies.id,'%(nombre_raza)s', zero='Elegir raza')) Table *especies *is where I add some pet species(cats or dogs) and their races. Here is the search on *controller.py*: def search(): search = SQLFORM(db.mascotas, fields=[ 'especie', 'raza_canino', 'raza_felino', 'genero']) if search.process().accepted: query = db((db.auth_user.id==db.mascotas.mascotas_id) (db.mascotas.especie==search.vars.especie) ((db.mascotas.raza_canino==search.vars.raza_canino)| (db.mascotas.raza_felino==search.vars.raza_felino)) (db.mascotas.genero==search.vars.genero)).select(db.mascotas. nombre, db.mascotas.nacimiento, db.auth_user.id,db.mascotas.id) return dict(query=query,search=search) elif search.errors: response.flash = 'form has errors' else: response.flash = 'please fill out the form' query='' return dict(search=search,query=query) Thanks for you help. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Social Login - Twitter logs out plus some other issues- web2py 2.8.2 / Mac OS X 10.9.1
Hello, I'm trying to implement Social Login following this example exactly as it shows here: https://groups.google.com/forum/#!topic/web2py/S9ukjWz6qMA Facebook works well, but I'm having some issues: 1. Twitter login works fine, but when it returns from twitter's login page to my web2py app(through the callback url), it happens two things: 1.1 My web2py app automatically redirects to 'logout' method, leaving me in the default/index page and logging me out, even if twitter auth succeed. 1.2 Twitter user's data(like name, id, etc) is not stored in DB(Facebook login did store it) Notes: To login with Twitter I use the regular login url(default/user/login) which redirects me to twitter auth so I set the Callback URL to be the same url. 2. I want to use Facebook/Twitter/Web2py auth simultaneously (and if possible merge all accounts through email address or username) but I can't figure it out how to set auth.settings.login_form dynamically. Currently i'm setting it in db.py and can't be overdiden it in the controller. In other words, I'm facing the same issue JungHyun Kim is experiencing. 3. I don't want to use Janrain. Thanks a lot for your help, I've already tried with a lot of outdated examples and it's driving me nuts :P Cheers. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] OAuth2 + Twitter 'module' object has no attribute 'Consumer' error
Hello, I've been trying to integrate Facebook/Twitter login with Web2py 2.8.2-stable and OAuth2(the built-in oauth20_account.py) using this example: https://groups.google.com/forum/#!topic/web2py/S9ukjWz6qMA Facebook login works but when I try the Twitter example I get this traceback: Traceback (most recent call last): File /Users/keniobats/Downloads/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /Users/keniobats/Downloads/web2py/applications/dugnading/models/db.py http://localhost:8000/admin/default/edit/dugnading/models/db.py, line 167, in module twitter_login = TwitterAccount(globals()) File /Users/keniobats/Downloads/web2py/applications/dugnading/models/db.py http://localhost:8000/admin/default/edit/dugnading/models/db.py, line 155, in __init__ self.ACCESS_TOKEN_URL) File /Users/keniobats/Downloads/web2py/gluon/contrib/login_methods/oauth10a_account.py, line 125, in __init__ self.consumer = oauth.Consumer(self.client_id, self.client_secret) AttributeError: 'module' object has no attribute 'Consumer' I've tried including the oauth2 module in web2py/sites-package and myapp/modules and still get the same error. Also, I don't know why in the twitter example oauth2 is imported if Twitter is supposed to use oauth 1.0: import oauth2 as oauth I love web2py but i'm still a newbie. Any help will be appreciated. Thanks in advance. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] OAuth2 + Twitter 'module' object has no attribute 'Consumer' error
Hello Michele!, Well, it seems that I casually rebooted my Mac(OS X 10.9.1) and now magically works :P print consumer class 'oauth2.Consumer' Now i'm facing some issues with forms at Twitter/Facebook login so perhaps you'll see another new post from me. Just in case, do you have some good(newer) examples of integrating multiple login methods? Lot of thanks!. On Saturday, December 21, 2013 8:39:43 PM UTC-3, Michele Comitini wrote: oauth2 is an unfortunate name chosen for a module that actually implements oauth1.0a: see https://pypi.python.org/pypi/oauth2 About the error check that you have installed the above package on your system. You can do so in a python shell: $ python import oauth2 consumer = oauth2.Consumer print consumer 2013/12/21 Luciano Laporta Podazza luciano...@gmail.com javascript: Hello, I've been trying to integrate Facebook/Twitter login with Web2py 2.8.2-stable and OAuth2(the built-in oauth20_account.py) using this example: https://groups.google.com/forum/#!topic/web2py/S9ukjWz6qMA Facebook login works but when I try the Twitter example I get this traceback: Traceback (most recent call last): File /Users/keniobats/Downloads/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /Users/keniobats/Downloads/web2py/applications/dugnading/models/db.py http://localhost:8000/admin/default/edit/dugnading/models/db.py, line 167, in module twitter_login = TwitterAccount(globals()) File /Users/keniobats/Downloads/web2py/applications/dugnading/models/db.py http://localhost:8000/admin/default/edit/dugnading/models/db.py, line 155, in __init__ self.ACCESS_TOKEN_URL) File /Users/keniobats/Downloads/web2py/gluon/contrib/login_methods/oauth10a_account.py, line 125, in __init__ self.consumer = oauth.Consumer(self.client_id, self.client_secret) AttributeError: 'module' object has no attribute 'Consumer' I've tried including the oauth2 module in web2py/sites-package and myapp/modules and still get the same error. Also, I don't know why in the twitter example oauth2 is imported if Twitter is supposed to use oauth 1.0: import oauth2 as oauth I love web2py but i'm still a newbie. Any help will be appreciated. Thanks in advance. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: web2py + exceptions(tickets) service?
Whenever I think web2py can't surprise me with cool stuff it happens again :P Thanks Niphlod, you rock :D On Fri, Feb 15, 2013 at 7:00 AM, Niphlod niph...@gmail.com wrote: Thanks for the answer Niphlod, but didn't understand the last part about being alerted(besides taking a look at the admin app). Cheers! http://web2py.com/books/default/chapter/29/13#Collecting-tickets and https://github.com/web2py/web2py/blob/master/scripts/tickets2email.py If you need additional features contribute back some code (or at least the ideas :P) -- --- You received this message because you are 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. -- Atte Luciano Laporta Podazza -- --- You received this message because you are 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(tickets) service?
Hello!, I would like to know if there's something like http://www.exceptional.io but with support for web2py?. 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: web2py + exceptions(tickets) service?
On Thursday, February 14, 2013 4:39:14 PM UTC-3, Niphlod wrote: as far as I'm concerned no, but adding support shouldn't be that difficult if you have time to spend on it. PS: If you just need to be alerted as soon as an exception has been fired by your app, web2py has already all the bits you need. Thanks for the answer Niphlod, but didn't understand the last part about being alerted(besides taking a look at the admin app). Cheers! On Thursday, February 14, 2013 5:00:24 PM UTC+1, Luciano Laporta Podazza wrote: Hello!, I would like to know if there's something like http://www.exceptional.iobut with support for web2py?. 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] Compare row objects inside a for... in loop
Hello, I've been searching a lot about this but couldn't find anything so sorry for this basic question. How can I compare an actual row object with the next one inside a for...in loop? Thanks in advance! --
Re: [web2py] Re: Compare row objects inside a for... in loop
Hi Anthony!, Yes, a friend of mine just gave me the same solution and I can't believe I didn't thought about that :P. Thanks a lot!!! On Tue, Jan 22, 2013 at 11:10 AM, Anthony abasta...@gmail.com wrote: I suppose you could do something like: rows = db(query).select() for i in range(len(rows)-1): code comparing rows[i] to rows[i+1] Anthony On Tuesday, January 22, 2013 8:17:10 AM UTC-5, Luciano Laporta Podazza wrote: Hello, I've been searching a lot about this but couldn't find anything so sorry for this basic question. How can I compare an actual row object with the next one inside a for...in loop? Thanks in advance! -- -- Atte Luciano Laporta Podazza --
Re: [web2py] Re: Strange behavior storing data - web2py 2.3.2 - Mac OS X 10.7.5
Hi guys, You were right, first I've removed the try/except so the error tickets appeared. birthday= datetime.strptime(data['birthday'],'%d/%m/%Y' ).strftime('%Y-%m-%d'), ---this is the problem. The issue was involved with dates format(locale), due that facebook users can be es_LA, es_ES, en_US, etc; the date formats are different so now I'm doing some research about how to deal with them and convert them automatically to db 'date' format: -MM-DD. Lot of thanks for your help :) -- Atte Luciano Laporta Podazza --
[web2py] Strange behavior storing data - web2py 2.3.2 - Mac OS X 10.7.5
Hello, I've been experimenting a really annoying issue that came up from nowhere 'cause the app was working perfectly. This is the scenario: A mobile app user(iOS) enter his credentials on Facebook and gets the corresponding auth token and personal data(JSON). The mobile app sends for the first time that data(name,last name, token, etc) to the server in JSON and the server processes it and store it if no errors occurred. This is the code(yes, it's really ugly but I'm a n00b): Controller: @service.json def first_time(): data = gluon.contrib.simplejson.loads(request.body.read()) graph = GraphAPI(data['token']) #We check that email and token exists and are valid, otherwise we store it for the first time. mail_check = db(db.auth_user.email==data['email']).select() if mail_check: token = db((db.auth_user.facebook_token!=data['token'])(db. auth_user.email==data['email'])).select() if token: try: profile = graph.get_object(me) if profile: id = db(db.auth_user.email==data['email']).update( facebook_token=data['token']) return token_updated except: return invalid_token1 else: #We create a new user! try: profile = graph.get_object(me) if profile: new = db.auth_user.insert( first_name=data['first_name'], last_name=data['last_name'], birthday= datetime.strptime(data['birthday'],'%d/%m/%Y' ).strftime('%Y-%m-%d'), email=data['email'], facebook_id=data['id'], facebook_token=data['token'], wizard=data['wizard']) return new_user except: return ivalid_token2 return user_exists db.py: from gluon.tools import Auth auth = Auth(db, hmac_key=Auth.get_or_create_key()) auth.settings.extra_fields['auth_user']= [ Field('birthday', 'date'), Field('facebook_id', 'string'), Field('facebook_token', 'string'), Field('wizard', 'boolean'), ] JSON: { first_name: Luciano, last_name: Laporta Podazza, country : Argentina, date : 2013-01-14, email : m...@hotmail.com, province : Tucumán, timestamp : 2013-01-14 06:13:45, token : (token) } This was actually working and I didn't modified anything(really). Now, the issue that I have is that with valid information the data isn't stored in the DB and get the invalid_token2 error. Notes: - Facebook data is valid(specially tokens), I've tested all of them externally with GraphAPI and they work. - If I comment the whole .insert I get the new_user string, which is what I'm looking for. So this makes me think that something with the insert is wrong - All tables and fields are correct, they have been tested and working before this issue. - I've tried changing database adapters(I was using mysql and now sqlite and still get the same error). - All facebook accounts are valid and verified. - For some reason, some times it stores the data, and some times not, it's kind of random. Any suggestions?. Thanks in advance! --
Re: [web2py] Strange behavior storing data - web2py 2.3.2 - Mac OS X 10.7.5
On Jan 14, 2013, at 2:45 PM, Massimo Di Pierro wrote: You say This was actually working and I didn't modified anything(really). did you upgrade or did it simply stopped working? It simply stopped working. On Monday, 14 January 2013 05:19:05 UTC-6, Luciano Laporta Podazza wrote: Hello, I've been experimenting a really annoying issue that came up from nowhere 'cause the app was working perfectly. This is the scenario: A mobile app user(iOS) enter his credentials on Facebook and gets the corresponding auth token and personal data(JSON). The mobile app sends for the first time that data(name,last name, token, etc) to the server in JSON and the server processes it and store it if no errors occurred. This is the code(yes, it's really ugly but I'm a n00b): Controller: @service.json def first_time(): data = gluon.contrib.simplejson.loads(request.body.read()) graph = GraphAPI(data['token']) #We check that email and token exists and are valid, otherwise we store it for the first time. mail_check = db(db.auth_user.email==data['email']).select() if mail_check: token = db((db.auth_user.facebook_token!=data['token'])(db.auth_user.email==data['email'])).select() if token: try: profile = graph.get_object(me) if profile: id = db(db.auth_user.email==data['email']).update(facebook_token=data['token']) return token_updated except: return invalid_token1 else: #We create a new user! try: profile = graph.get_object(me) if profile: new = db.auth_user.insert( first_name=data['first_name'], last_name=data['last_name'], birthday= datetime.strptime(data['birthday'],'%d/%m/%Y').strftime('%Y-%m-%d'), email=data['email'], facebook_id=data['id'], facebook_token=data['token'], wizard=data['wizard']) return new_user except: return ivalid_token2 return user_exists db.py: from gluon.tools import Auth auth = Auth(db, hmac_key=Auth.get_or_create_key()) auth.settings.extra_fields['auth_user']= [ Field('birthday', 'date'), Field('facebook_id', 'string'), Field('facebook_token', 'string'), Field('wizard', 'boolean'), ] JSON: { first_name: Luciano, last_name: Laporta Podazza, country : Argentina, date : 2013-01-14, email : ma...@hotmail.com, province : Tucumán, timestamp : 2013-01-14 06:13:45, token : (token) } This was actually working and I didn't modified anything(really). Now, the issue that I have is that with valid information the data isn't stored in the DB and get the invalid_token2 error. Notes: Facebook data is valid(specially tokens), I've tested all of them externally with GraphAPI and they work. If I comment the whole .insert I get the new_user string, which is what I'm looking for. So this makes me think that something with the insert is wrong All tables and fields are correct, they have been tested and working before this issue. I've tried changing database adapters(I was using mysql and now sqlite and still get the same error). All facebook accounts are valid and verified. For some reason, some times it stores the data, and some times not, it's kind of random. Any suggestions?. Thanks in advance! -- --
[web2py] Re: Loading modules fails - web2py 2.1.1(and earlier) / python 2.7.1 / Mac OS X
Hello Massimo!, comments inline. On Saturday, October 20, 2012 11:43:43 AM UTC-3, Massimo Di Pierro wrote: I am very puzzled but this. It should not be necessary. Does the code below work for you? $ python web2py.py -S welcome (InteractiveConsole) import simplejson If I use web2py.app(Mac OS) it doesn't work: Silver-2:Resources keniobats$ pwd /Users/keniobats/Downloads/web2py/web2py.app/Contents/Resources Silver-2:Resources keniobats$ python web2py.py -S welcome Traceback (most recent call last): File web2py.py, line 16, in module import gluon.widget ImportError: No module named gluon.widget Silver-2:Resources keniobats$ If I use the source version it works well: Silver-2:web2py 2 keniobats$ python web2py.py -S welcome web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2012 Version 2.0.9 (2012-09-13 23:51:30) stable Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), IMAP(imaplib) WARNING:web2py:import IPython error; use default python shell Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type help, copyright, credits or license for more information. (InteractiveConsole) import simplejson Do you have a module called simplejson in yourapp/modules/? I have nothing but my facebook.py module there. From a normal python shell, shat happens if you do? import simplejson Silver-2:~ keniobats$ pwd /Users/keniobats Silver-2:~ keniobats$ python Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type help, copyright, credits or license for more information. import simplejson It works as usual :) Hope it helps, thanks Massimo! --
Re: [web2py] Re: Loading modules fails - web2py 2.1.1(and earlier) / python 2.7.1 / Mac OS X
On Sat, Oct 20, 2012 at 7:35 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I just tried this (using OSX binary distribution -nightly built) and I cannot reproduce it. Could you try it? Sure!, I'll do it right now and get back to you. Massimo On Saturday, 20 October 2012 11:32:55 UTC-5, Luciano Laporta Podazza wrote: Hello Massimo!, comments inline. On Saturday, October 20, 2012 11:43:43 AM UTC-3, Massimo Di Pierro wrote: I am very puzzled but this. It should not be necessary. Does the code below work for you? $ python web2py.py -S welcome (InteractiveConsole) import simplejson If I use web2py.app(Mac OS) it doesn't work: Silver-2:Resources keniobats$ pwd /Users/keniobats/Downloads/**web2py/web2py.app/Contents/**Resources Silver-2:Resources keniobats$ python web2py.py -S welcome Traceback (most recent call last): File web2py.py, line 16, in module import gluon.widget ImportError: No module named gluon.widget Silver-2:Resources keniobats$ If I use the source version it works well: Silver-2:web2py 2 keniobats$ python web2py.py -S welcome web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2012 Version 2.0.9 (2012-09-13 23:51:30) stable Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), IMAP(imaplib) WARNING:web2py:import IPython error; use default python shell Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type help, copyright, credits or license for more information. (InteractiveConsole) import simplejson Do you have a module called simplejson in yourapp/modules/? I have nothing but my facebook.py module there. From a normal python shell, shat happens if you do? import simplejson Silver-2:~ keniobats$ pwd /Users/keniobats Silver-2:~ keniobats$ python Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type help, copyright, credits or license for more information. import simplejson It works as usual :) Hope it helps, thanks Massimo! -- -- Atte Luciano Laporta Podazza --
[web2py] Re: Loading modules fails - web2py 2.1.1(and earlier) / python 2.7.1 / Mac OS X
Well it seems that after a lot of research and specially after posting this question that I found the solution. I've tried facebook-sdk module and had to modify just one line to make it work: facebook.py, line 49: # Find a JSON parser try: import simplejson as json To # Find a JSON parser try: import gluon.contrib.simplejson as json And that's all. Hope it helps anybody! On Thursday, October 18, 2012 1:43:29 PM UTC-3, Luciano Laporta Podazza wrote: Hello, first of all thank you Massimo and you people for this awesome framework! I'm in love with it! :D I've tried to load some facebook modules and none of them works, at least on Mac OS. This is what I did: 1. Get facebook api from one of these repos: https://github.com/sciyoshi/pyfacebook/ https://github.com/jgorset/facepy https://github.com/pythonforfacebook/facebook-sdk 2. Copy them on modules/ like this: modules/facebook-api-folder/files.py 3. Load it from the controller, e.g. facepy module: def index(): from facepy import graph_api It doesn't matter what I try, I always get some errors: - type 'exceptions.ImportError' No module named facepy (or other module's name) - With facebook-sdk it says that simplejson can't be loaded 'cause it doesn't exists(and it exists and works!) - it doesn't matter the way I put the module folder under modules/, for example modules/facebookmodule/sub-dir/module.py and then from facebookmodule.subdir import module. I always get the error that the module does not exists. - I even tried copying the module under site-packages and it seems to load the module(I get no errors about it) but then I get the error that simplejson doesn't exists(and this is not true). A friend of mine tried this on GNU/Linux and modules works perfectly, so it seems the issue is related with Mac OS. Any ideas?. please note that I'm a newbie with python and web2py. LOT of thanks in advance :) --
[web2py] Loading modules fails - web2py 2.1.1(and earlier) / python 2.7.1 / Mac OS X
Hello, first of all thank you Massimo and you people for this awesome framework! I'm in love with it! :D I've tried to load some facebook modules and none of them works, at least on Mac OS. This is what I did: 1. Get facebook api from one of these repos: https://github.com/sciyoshi/pyfacebook/ https://github.com/jgorset/facepy https://github.com/pythonforfacebook/facebook-sdk 2. Copy them on modules/ like this: modules/facebook-api-folder/files.py 3. Load it from the controller, e.g. facepy module: def index(): from facepy import graph_api It doesn't matter what I try, I always get some errors: - type 'exceptions.ImportError' No module named facepy (or other module's name) - With facebook-sdk it says that simplejson can't be loaded 'cause it doesn't exists(and it exists and works!) - it doesn't matter the way I put the module folder under modules/, for example modules/facebookmodule/sub-dir/module.py and then from facebookmodule.subdir import module. I always get the error that the module does not exists. - I even tried copying the module under site-packages and it seems to load the module(I get no errors about it) but then I get the error that simplejson doesn't exists(and this is not true). A friend of mine tried this on GNU/Linux and modules works perfectly, so it seems the issue is related with Mac OS. Any ideas?. please note that I'm a newbie with python and web2py. LOT of thanks in advance :) --