[web2py] Re: Change in application request.vars when switching from Rocket to Lighttpd+FastCGI

2015-02-26 Thread Niphlod
+1 for switching to nginx. actually, what I meant to write is 
request.env.get('QUERY_STRING')

On Friday, February 27, 2015 at 5:53:57 AM UTC+1, Mike wrote:



 On Wednesday, February 25, 2015 at 12:18:29 PM UTC-8, Niphlod wrote:

 reaally strange, although I don't use lighttpd since nginx came out. 
 request.vars are parsed out of request.QUERY_STRING. could you please 
 doublecheck what request.get('QUERY_STRING') dumps ?




 request.get('QUERY_STRING') is *None *

 I can't figure out the source of this issue, so I have switched to nginx, 
 and all is OK!

 Thanks for looking at this.



-- 
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: Scheduler exception when setting immediate=True: 'Deadlock found when trying to get lock...'

2015-02-26 Thread Osman Masood
Right. The purpose of using the console was to simulate what actually
happens in production.

On Thu, Feb 26, 2015 at 11:39 PM, Niphlod niph...@gmail.com wrote:

 you know that on console, after queue_task() you need to commit(), right ?
 If you leave the transaction hanging, no wonder that you're observing
 deadlocks!


 On Friday, February 27, 2015 at 3:38:19 AM UTC+1, Osman Masood wrote:

 I was actually able to easily reproduce this. Just open up 2 web2py
 consoles (which connect to the same DB), and do:

 scheduler.queue_task('myfunc', pvars=dict(), immediate=True)

 The first one will succeed, and the second one will hang there for some
 time, and then give the deadlock exception above.

 This kinda makes sense, looking at the above DB query  considering
 record-level locking. We have conditional writes on all records in the
 scheduler_worker table, so if two connections attempt this at the same
 time, it would follow that there is a deadlock. (Correct me if I'm wrong.)
 So I think the solution would be something like (on line 1303 of
 scheduler.py):

  if immediate:

 -self.db(self.db.scheduler_worker.is_ticker ==
 True).update(status=PICK)

 +scheduler_worker_tickers = 
 self.db(self.db.scheduler_worker.is_ticker
 == True).select()

 +for scheduler_worker_ticker in scheduler_worker_tickers:

 +scheduler_worker_ticker.update_record(status=PICK)


 On Thursday, February 26, 2015 at 3:54:47 PM UTC-8, Osman Masood wrote:

 Thanks for the quick response!

 I'm using Amazon RDS (just basically MySQL), on a pretty beefy instance
 (db.m3.large), 1000 IOPS. Would be pretty surprised if that were the
 problem.

 Running 5 scheduler workers with the default heartbeat (3s).

 On Thursday, February 26, 2015 at 3:35:41 PM UTC-8, Niphlod wrote:

 it seems to me that there is database contention although the
 exception **should** be trapped (i.e. try to set the status to PICK, if
 not, well it's not a fatal error), there's something wrong with your
 setup or your database is too much underpowered to do what you're asking.
 How many workers are running and with what heartbeat ?

 On Friday, February 27, 2015 at 12:28:28 AM UTC+1, Osman Masood wrote:

 Hello all,

 I keep getting this error when calling scheduler.queue_task() with
 immediate=True:

 class 'gluon.contrib.pymysql.err.InternalError' (1213, u'Deadlock
 found when trying to get lock; try restarting transaction')

 The stack trace shows this is the culprit:

   self.db(self.db.scheduler_worker.is_ticker == True).update(status=PICK)

 (This is a web application which uses the scheduler pretty extensively.) 
 Seems like multiple connections are competing for access to the same 
 scheduler_worker row.

 Seems to me like a web2py bug. Any help would be greatly 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/ZBv43p3w_MM/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Sorting contains results based on number of matches

2015-02-26 Thread James Burke
Is there a way to sort the query below by the number of search items found 
in each result?

def GET(*args,**vars):
search = [x for x in request.vars['search'].split(' ') if len(x)  
3]
result = []

if search:
query = db.question.heading.contains(search, all=False) | 
db.question.content.contains(search, all=False) | 
db.tag.tag.contains(search)
result = db(query).select(db.question.ALL, 
join=[db.question.on(db.question.id==db.question_tag.question_id), 
db.question_tag.on(db.question_tag.tag_id==db.tag.id)])

return response.json(result)

Basically I want to find the most relevant result, assuming the result that 
matches the most results is most relevant.

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/d/optout.


[web2py] Re: DAL for Insert Into with Select

2015-02-26 Thread Niphlod
why don't you just use db.table.insert()?

anyway, db.executesql() has a placeholders parameter that can pass quoted 
variables just fine!

On Friday, February 27, 2015 at 12:39:50 AM UTC+1, Mat Miles wrote:

 Is it possible to use the DAL to run an INSERT INTO with a select list? I 
 haven't figured out a way to make this work using db.executesql() because I 
 need to pass a date to the query. I don't see a way to pass a variable into 
 db.executesql().


-- 
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: Scheduler exception when setting immediate=True: 'Deadlock found when trying to get lock...'

2015-02-26 Thread Niphlod
you know that on console, after queue_task() you need to commit(), right ? 
If you leave the transaction hanging, no wonder that you're observing 
deadlocks!

On Friday, February 27, 2015 at 3:38:19 AM UTC+1, Osman Masood wrote:

 I was actually able to easily reproduce this. Just open up 2 web2py 
 consoles (which connect to the same DB), and do:

 scheduler.queue_task('myfunc', pvars=dict(), immediate=True)

 The first one will succeed, and the second one will hang there for some 
 time, and then give the deadlock exception above.

 This kinda makes sense, looking at the above DB query  considering 
 record-level locking. We have conditional writes on all records in the 
 scheduler_worker table, so if two connections attempt this at the same 
 time, it would follow that there is a deadlock. (Correct me if I'm wrong.) 
 So I think the solution would be something like (on line 1303 of 
 scheduler.py):

  if immediate:

 -self.db(self.db.scheduler_worker.is_ticker == 
 True).update(status=PICK)

 +scheduler_worker_tickers = 
 self.db(self.db.scheduler_worker.is_ticker == True).select()

 +for scheduler_worker_ticker in scheduler_worker_tickers:

 +scheduler_worker_ticker.update_record(status=PICK)


 On Thursday, February 26, 2015 at 3:54:47 PM UTC-8, Osman Masood wrote:

 Thanks for the quick response!

 I'm using Amazon RDS (just basically MySQL), on a pretty beefy instance 
 (db.m3.large), 1000 IOPS. Would be pretty surprised if that were the 
 problem.

 Running 5 scheduler workers with the default heartbeat (3s).

 On Thursday, February 26, 2015 at 3:35:41 PM UTC-8, Niphlod wrote:

 it seems to me that there is database contention although the 
 exception **should** be trapped (i.e. try to set the status to PICK, if 
 not, well it's not a fatal error), there's something wrong with your 
 setup or your database is too much underpowered to do what you're asking.
 How many workers are running and with what heartbeat ?

 On Friday, February 27, 2015 at 12:28:28 AM UTC+1, Osman Masood wrote:

 Hello all,

 I keep getting this error when calling scheduler.queue_task() with 
 immediate=True:

 class 'gluon.contrib.pymysql.err.InternalError' (1213, u'Deadlock 
 found when trying to get lock; try restarting transaction')

 The stack trace shows this is the culprit:

   self.db(self.db.scheduler_worker.is_ticker == True).update(status=PICK)

 (This is a web application which uses the scheduler pretty extensively.) 
 Seems like multiple connections are competing for access to the same 
 scheduler_worker row. 

 Seems to me like a web2py bug. Any help would be greatly 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: When not HTTPS i receive TypeError: 'NoneType' object is not callable

2015-02-26 Thread Leonel Câmara
I think this is probably a webserver (probably apache) configuration issue. 
Have you made any changes to the configuration recently?

-- 
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] change edit button link in SQLFORM?

2015-02-26 Thread LoveWeb2py

I think this should be pretty easy, but I couldn't find how to edit the 
SQLFORM buttons in the documentation: 
http://web2py.com/book/default/chapter/07#SQLFORM-grid-and-SQLFORM-smartgrid

Essentially I have a function I want the edit button to use instead of 
editing the record called in the SQLFORM. Is there a way to reassign the 
Edit button or am I better just creating a new button?

-- 
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: not web2py question - test timezone detection

2015-02-26 Thread Niphlod


On Wednesday, February 25, 2015 at 10:25:26 PM UTC+1, Dave S wrote:



 On Wednesday, February 25, 2015 at 7:45:03 AM UTC-8, Niphlod wrote:

 if a module is required, it is imported.


 What names can be be imported?  Must a 3rd-party module be renamed to fit 
 the plug-in scheme?  My understanding is no.
  

 if it's in two places, the same thing applies. why should it be an issue ?


 Updating all copies, but the OP seems to be on linux, so using links can 
 help with that.
  
 /dps


frankly, not. if a plugin is carrying a module to import, it's because it's 
tested (and fixed) on that module version. Having them fetch all from a 
central repo would resort in having django-like environments where a plugin 
requires version x.y.z and another x.y.z-1 , that gives pretty serious 
headaches.

The naming on plugins for web2py is just a standard convention (i.e. 
creating controllers that starts with plugin_*), to avoid interference 
between each others and the app they're installed into.
 

-- 
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] Is there a way to set breakpoints inside the gluon?

2015-02-26 Thread Richard Vézina
How do you import your file?

You may try to import it with web2py shell by hand you may get more insight
like that.

Richard



On Thu, Feb 26, 2015 at 9:41 AM, David Manns dgma...@gmail.com wrote:

 I'm trying to build a test database using csv_import_from_file to load an
 entire database (I successfully use csv_export_to_file to create a file
 from my application running in the GAE SDK; that database was copied from
 GAE production using bulk upload).

 However, the import process seems to run forever without terminating
 either successfully or with an error. I have let it run many hours.

 It may be a problem with database size, ~20k entities, but I would like to
 track progress by breakpointing at each table start to see if there is some
 other problem.

 I tried editing base.py to insert a breakpoint but then web2py then won't
 start - probably because the code is a class definition?

 Using the web2py online debugger I can breakpoint at the call to
 csv_import_from_file and then step in to the DAL code, but is there any way
 to set breakpoints inside the gluon?

 would be nice if one could set breakpoints on code displayed in the code
 window of the debugger page. or why can't the DAL modules be selected in
 the breakpoint screen?

 Thanks for any help.

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/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] pycharm python console

2015-02-26 Thread Richard Vézina
I can't see passing web2py init from command line with pdb, I try python -m
pdb web2py -a 'pwd' -i 127.0.0.1 -p 8001 -R AppName -M

But I just can see the os import, then the rocket server get started.

:(

Richard

On Thu, Feb 26, 2015 at 11:00 AM, Richard ml.richard.vez...@gmail.com
wrote:

 We may have more input here too :
 https://groups.google.com/d/msg/web2py/69ji7YH6Ufw/xRaFTBO9W0IJ

 :)

 Richard

 Le jeudi 26 février 2015 10:57:49 UTC-5, Richard a écrit :

 Though I don't think environnement is defined...

 On Thu, Feb 26, 2015 at 10:56 AM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 I would try to use run_models_in so far it seems that this is the
 function/method that will generate python import models in compiledapp.py



 On Thu, Feb 26, 2015 at 10:50 AM, António Ramos ramstei...@gmail.com
 wrote:

 dont i have to force it to do

 python web2py.py - S myapp

 at startup ?

 2015-02-26 15:39 GMT+00:00 Richard Vézina ml.richard.vez...@gmail.com
 :

 Things are in gluon/shell.py...

 Richard

 On Thu, Feb 26, 2015 at 10:08 AM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Don't use it :D

 No, I am kidding...

 Here settings for python console : https://www.jetbrains.com/
 pycharm/help/console-python-console.html

 I don't how someone can lunch pycharm embed python console with
 command line web2py option...

 Another option could be to import web2py stuff once the console is up
 and running, though I really don't know if this is possible and how. But
 reading web2py code about command line triggering behaviour and
 initilization of python interpreter may help to figure out, I guess...

 Or we can ask Massimo??

 :)

 Richard

 On Thu, Feb 26, 2015 at 7:41 AM, António Ramos ramstei...@gmail.com
 wrote:

 To the ones that use pycharm with web2py.

 How can i interact with my models from the python console ?

 it does not recognize my models.


 Regards
 António

 --
 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.



  --
 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.


  --
 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.



  --
 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.


-- 
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] pycharm python console

2015-02-26 Thread Richard Vézina
Though I don't think environnement is defined...

On Thu, Feb 26, 2015 at 10:56 AM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 I would try to use run_models_in so far it seems that this is the
 function/method that will generate python import models in compiledapp.py



 On Thu, Feb 26, 2015 at 10:50 AM, António Ramos ramstei...@gmail.com
 wrote:

 dont i have to force it to do

 python web2py.py - S myapp

 at startup ?

 2015-02-26 15:39 GMT+00:00 Richard Vézina ml.richard.vez...@gmail.com:

 Things are in gluon/shell.py...

 Richard

 On Thu, Feb 26, 2015 at 10:08 AM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Don't use it :D

 No, I am kidding...

 Here settings for python console :
 https://www.jetbrains.com/pycharm/help/console-python-console.html

 I don't how someone can lunch pycharm embed python console with command
 line web2py option...

 Another option could be to import web2py stuff once the console is up
 and running, though I really don't know if this is possible and how. But
 reading web2py code about command line triggering behaviour and
 initilization of python interpreter may help to figure out, I guess...

 Or we can ask Massimo??

 :)

 Richard

 On Thu, Feb 26, 2015 at 7:41 AM, António Ramos ramstei...@gmail.com
 wrote:

 To the ones that use pycharm with web2py.

 How can i interact with my models from the python console ?

 it does not recognize my models.


 Regards
 António

 --
 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.



  --
 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.


  --
 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.




-- 
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] web2py menu and CTRL+Click redirect both actual and new tab

2015-02-26 Thread Richard Vézina
On Wed, Feb 25, 2015 at 5:15 PM, Dave S snidely@gmail.com wrote:



 On Wednesday, February 25, 2015 at 11:25:06 AM UTC-8, Richard wrote:

 Hello,

 I am not sure where is it from, but I notice and change in the behavior
 of CTRL + Click over main web2py menu and submenu entry which in the pass
 were only open an new tab conducting the user on the requested page base on
 menu entry link. But now, when doing CTRL + Click over menu and submenu
 entry new tab still get create and pointing over the proper location, but
 the actual page also get redirecting...

 Any idea?

 I will open a issue on github if you think that actually a regression
 issue?



 Past behavior  was  open top-level menu item, highlight entry for submenu,
 CTRL+click opens new tab which takes you to page corresponding to top-level
 item?

 New behavior -- the tab opens as before, but the tab you started on also
 changes to that location?


YES, both tab get redirect to the link address which make useless the
CTRL+Click...

It may be related to a missing .stopPropagation() jQuery related to some
recent change, I start looking to commit history, but I really don't know
where to check exactly. About .stopPropagation() :
http://stackoverflow.com/questions/26167017/how-to-open-new-tab-with-ctrlclick-instead-of-redirect-current-tab-in-jquery

I maybe also completly wrong about .stopPropagartion()...

Richard



 /dps

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+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] pycharm python console

2015-02-26 Thread Richard Vézina
Things are in gluon/shell.py...

Richard

On Thu, Feb 26, 2015 at 10:08 AM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 Don't use it :D

 No, I am kidding...

 Here settings for python console :
 https://www.jetbrains.com/pycharm/help/console-python-console.html

 I don't how someone can lunch pycharm embed python console with command
 line web2py option...

 Another option could be to import web2py stuff once the console is up and
 running, though I really don't know if this is possible and how. But
 reading web2py code about command line triggering behaviour and
 initilization of python interpreter may help to figure out, I guess...

 Or we can ask Massimo??

 :)

 Richard

 On Thu, Feb 26, 2015 at 7:41 AM, António Ramos ramstei...@gmail.com
 wrote:

 To the ones that use pycharm with web2py.

 How can i interact with my models from the python console ?

 it does not recognize my models.


 Regards
 António

 --
 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.




-- 
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] pycharm python console

2015-02-26 Thread Richard Vézina
I would try to use run_models_in so far it seems that this is the
function/method that will generate python import models in compiledapp.py



On Thu, Feb 26, 2015 at 10:50 AM, António Ramos ramstei...@gmail.com
wrote:

 dont i have to force it to do

 python web2py.py - S myapp

 at startup ?

 2015-02-26 15:39 GMT+00:00 Richard Vézina ml.richard.vez...@gmail.com:

 Things are in gluon/shell.py...

 Richard

 On Thu, Feb 26, 2015 at 10:08 AM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Don't use it :D

 No, I am kidding...

 Here settings for python console :
 https://www.jetbrains.com/pycharm/help/console-python-console.html

 I don't how someone can lunch pycharm embed python console with command
 line web2py option...

 Another option could be to import web2py stuff once the console is up
 and running, though I really don't know if this is possible and how. But
 reading web2py code about command line triggering behaviour and
 initilization of python interpreter may help to figure out, I guess...

 Or we can ask Massimo??

 :)

 Richard

 On Thu, Feb 26, 2015 at 7:41 AM, António Ramos ramstei...@gmail.com
 wrote:

 To the ones that use pycharm with web2py.

 How can i interact with my models from the python console ?

 it does not recognize my models.


 Regards
 António

 --
 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.



  --
 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.


  --
 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.


-- 
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] pycharm python console

2015-02-26 Thread Richard Vézina
Don't use it :D

No, I am kidding...

Here settings for python console :
https://www.jetbrains.com/pycharm/help/console-python-console.html

I don't how someone can lunch pycharm embed python console with command
line web2py option...

Another option could be to import web2py stuff once the console is up and
running, though I really don't know if this is possible and how. But
reading web2py code about command line triggering behaviour and
initilization of python interpreter may help to figure out, I guess...

Or we can ask Massimo??

:)

Richard

On Thu, Feb 26, 2015 at 7:41 AM, António Ramos ramstei...@gmail.com wrote:

 To the ones that use pycharm with web2py.

 How can i interact with my models from the python console ?

 it does not recognize my models.


 Regards
 António

 --
 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.


-- 
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] pycharm python console

2015-02-26 Thread António Ramos
it already does this at init

import sys; print('Python %s on %s' % (sys.version, sys.platform))
sys.path.extend(['C:\\web2pyGit\\web2py2\\applications\\teste1',
'C:\\web2pyGit\\web2py2\\gluon'])


2015-02-26 15:08 GMT+00:00 Richard Vézina ml.richard.vez...@gmail.com:

 Don't use it :D

 No, I am kidding...

 Here settings for python console :
 https://www.jetbrains.com/pycharm/help/console-python-console.html

 I don't how someone can lunch pycharm embed python console with command
 line web2py option...

 Another option could be to import web2py stuff once the console is up and
 running, though I really don't know if this is possible and how. But
 reading web2py code about command line triggering behaviour and
 initilization of python interpreter may help to figure out, I guess...

 Or we can ask Massimo??

 :)

 Richard

 On Thu, Feb 26, 2015 at 7:41 AM, António Ramos ramstei...@gmail.com
 wrote:

 To the ones that use pycharm with web2py.

 How can i interact with my models from the python console ?

 it does not recognize my models.


 Regards
 António

 --
 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.


  --
 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.


-- 
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] pycharm python console

2015-02-26 Thread António Ramos
dont i have to force it to do

python web2py.py - S myapp

at startup ?

2015-02-26 15:39 GMT+00:00 Richard Vézina ml.richard.vez...@gmail.com:

 Things are in gluon/shell.py...

 Richard

 On Thu, Feb 26, 2015 at 10:08 AM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Don't use it :D

 No, I am kidding...

 Here settings for python console :
 https://www.jetbrains.com/pycharm/help/console-python-console.html

 I don't how someone can lunch pycharm embed python console with command
 line web2py option...

 Another option could be to import web2py stuff once the console is up and
 running, though I really don't know if this is possible and how. But
 reading web2py code about command line triggering behaviour and
 initilization of python interpreter may help to figure out, I guess...

 Or we can ask Massimo??

 :)

 Richard

 On Thu, Feb 26, 2015 at 7:41 AM, António Ramos ramstei...@gmail.com
 wrote:

 To the ones that use pycharm with web2py.

 How can i interact with my models from the python console ?

 it does not recognize my models.


 Regards
 António

 --
 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.



  --
 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.


-- 
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] Could we start web2py form python shell

2015-02-26 Thread Richard
Hello,

Is it possible to acheive the starting of web2py from python shell?

It could be interresting to be able to start web2py env as command line do, 
but from python shell in order to lunch web2py environnement inside running 
python console like the one available in PyCharm... 

This thread is related to Antonio question here : 
https://groups.google.com/d/msg/web2py/-sprzyOTi1w/V2z2V_4Upl4J

Richard

-- 
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] pycharm python console

2015-02-26 Thread Richard
We may have more input here too 
: https://groups.google.com/d/msg/web2py/69ji7YH6Ufw/xRaFTBO9W0IJ

:)

Richard

Le jeudi 26 février 2015 10:57:49 UTC-5, Richard a écrit :

 Though I don't think environnement is defined...

 On Thu, Feb 26, 2015 at 10:56 AM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 I would try to use run_models_in so far it seems that this is the 
 function/method that will generate python import models in compiledapp.py



 On Thu, Feb 26, 2015 at 10:50 AM, António Ramos ramstei...@gmail.com 
 wrote:

 dont i have to force it to do 

 python web2py.py - S myapp

 at startup ?

 2015-02-26 15:39 GMT+00:00 Richard Vézina ml.richard.vez...@gmail.com:

 Things are in gluon/shell.py...

 Richard

 On Thu, Feb 26, 2015 at 10:08 AM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Don't use it :D

 No, I am kidding...

 Here settings for python console : 
 https://www.jetbrains.com/pycharm/help/console-python-console.html

 I don't how someone can lunch pycharm embed python console with 
 command line web2py option...

 Another option could be to import web2py stuff once the console is up 
 and running, though I really don't know if this is possible and how. But 
 reading web2py code about command line triggering behaviour and 
 initilization of python interpreter may help to figure out, I guess...

 Or we can ask Massimo??

 :)

 Richard

 On Thu, Feb 26, 2015 at 7:41 AM, António Ramos ramstei...@gmail.com 
 wrote:

 To the ones that use pycharm with web2py.

 How can i interact with my models from the python console ?

 it does not recognize my models.


 Regards
 António

 -- 
 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.



  -- 
 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.


  -- 
 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.





-- 
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: gluon.validators.IS_LENGTH object at 0x7ff634bd0

2015-02-26 Thread Leonel Câmara
I don't see how this is happening unless you're redefining the requires for 
that field somewhere to IS_LENGTH.

Can you search your code for db.table.URL.requires (replacing table with 
the name).

How do you know that's there for that field? Show us some code :)

-- 
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: Function being called twice from one button click

2015-02-26 Thread Anthony
In any case, you should probably have some code that prevents double 
booking (i.e., the first time you receive a request with the confirmation, 
make some change in the session or db that prevents the same order from 
being confirmed/fulfilled twice).

Anthony

On Thursday, February 26, 2015 at 7:46:15 AM UTC-5, Leonel Câmara wrote:

 I don't see how it can happen. Your costumer probably has a virus or 
 something. It may also be a buggy browser extension (tell him to try with 
 the browser in private mode so the extensions are off).


-- 
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] pycharm python console

2015-02-26 Thread António Ramos
To the ones that use pycharm with web2py.

How can i interact with my models from the python console ?

it does not recognize my models.


Regards
António

-- 
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: Function being called twice from one button click

2015-02-26 Thread Leonel Câmara
I don't see how it can happen. Your costumer probably has a virus or 
something. It may also be a buggy browser extension (tell him to try with 
the browser in private mode so the extensions are off).

-- 
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] Routes pattern and args / query strings

2015-02-26 Thread Anthony
On Thursday, February 26, 2015 at 3:35:50 AM UTC-5, Louis Amon wrote:

 That’s actually what I ended up doing, but it isn’t something you can rely 
 on in a big project…


 Why not?


 Because you’d have to document very clearly the fact that some specific 
 rules need to be organized in a precise order among the list.
 If you have hundreds of URLs managed in your routes.py and if 10 of them 
 need to be organized in specific orders then if you want to add an URL you 
 need a very clear view of exactly where you need to put the rule to match 
 it.

 Now imagine an intern takes over the routing… this whole order-based 
 routing would be an epic mess.


That's entirely a function of the nature of your routing scheme and would 
apply to any pattern based system. An alternative is to come up with much 
more complicated regexes, but you still have the problem of needing to 
update the regexes as your app grows/changes. This is the advantage of 
keeping the routing more simple and straightforward (i.e., sticking with 
the default routing, plus some of the tweaks allowed by the parameter based 
system).

 I was hoping there would be an alternative, but I guess regular 
 expressions are indeed the only option to do things properly.


 Did you have a particular API in mind? The parameter-based system is 
 designed to be much simpler while cover the most common use cases, but if 
 you want something highly customized, there will inevitably be some 
 complexity to the rules you set up.


 I was thinking about something like $args or $vars that would be pre-coded 
 with the right regex to match one or no args and/or a query string.


It would at least be helpful to document some examples of these patterns. 
Note, once you have the relevant regex, you can assign it to a variable in 
routes.py and re-use it.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Is there a way to set breakpoints inside the gluon?

2015-02-26 Thread David Manns
I'm trying to build a test database using csv_import_from_file to load an 
entire database (I successfully use csv_export_to_file to create a file 
from my application running in the GAE SDK; that database was copied from 
GAE production using bulk upload).

However, the import process seems to run forever without terminating either 
successfully or with an error. I have let it run many hours.

It may be a problem with database size, ~20k entities, but I would like to 
track progress by breakpointing at each table start to see if there is some 
other problem.

I tried editing base.py to insert a breakpoint but then web2py then won't 
start - probably because the code is a class definition?

Using the web2py online debugger I can breakpoint at the call to 
csv_import_from_file and then step in to the DAL code, but is there any way 
to set breakpoints inside the gluon?

would be nice if one could set breakpoints on code displayed in the code 
window of the debugger page. or why can't the DAL modules be selected in 
the breakpoint screen?

Thanks for any help.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: change edit button link in SQLFORM?

2015-02-26 Thread Niphlod
you have two methods:

- set editable=False and use your own links=
- check for 'edit' in request.args and override accordingly

On Thursday, February 26, 2015 at 3:30:07 PM UTC+1, LoveWeb2py wrote:


 I think this should be pretty easy, but I couldn't find how to edit the 
 SQLFORM buttons in the documentation: 
 http://web2py.com/book/default/chapter/07#SQLFORM-grid-and-SQLFORM-smartgrid

 Essentially I have a function I want the edit button to use instead of 
 editing the record called in the SQLFORM. Is there a way to reassign the 
 Edit button or am I better just creating a new button?


-- 
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: Websocket doesn't work on stable version

2015-02-26 Thread Jose de Soto
Hi,

It looks that in Tornado 4.X has been included: * check_origin*, here more 
info:

http://tornado.readthedocs.org/en/latest/websocket.html#tornado.websocket.WebSocketHandler.check_origin

In the DistributeHandler, you can insert the next code:

*def check_origin(self, origin):*
*return True*

Like this:






*class DistributeHandler(tornado.websocket.WebSocketHandler):def 
check_origin(self, origin):return True  def open(self, 
params):*

I have tested and it works for me, I hope it helps...

On Sunday, January 4, 2015 at 4:09:20 PM UTC-5, Tito Garrido wrote:

 Hi Folks,

 I am using 2.9.11 and when I try to use $.web2py.web2py_websocket('ws://
 127.0.0.1:/realtime/mygroup', function(e){alert(e.data)}) I receive 
 error 403 Forbidden from the server.

 Chrome: WebSocket connection to 'ws://127.0.0.1:/realtime/mygroup' 
 failed: Error during WebSocket handshake: Unexpected response code: 403

 Firefox: 
 Firefox can't establish a connection to the server at ws://127.0.0.1
 :/realtime/mygroup.

 var ws = new WebSocket(url);


 From python terminal it works: 
  from gluon.contrib.websocket_messaging import websocket_send
  websocket_send('http://127.0.0.1:', 'Hello World', 'mykey', 
 'mygroup')
 ''
  

 What am I missing?

 Regards,

 Tito

 -- 

 Linux User #387870
 .
  _/_õ|__|
 ..º[ .-.___.-._| . . . .
 .__( o)__( o).:___
  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: change edit button link in SQLFORM?

2015-02-26 Thread LoveWeb2py
Went with option #1, Niphlod. Thanks!

On Thursday, February 26, 2015 at 12:02:05 PM UTC-5, Niphlod wrote:

 you have two methods:

 - set editable=False and use your own links=
 - check for 'edit' in request.args and override accordingly

 On Thursday, February 26, 2015 at 3:30:07 PM UTC+1, LoveWeb2py wrote:


 I think this should be pretty easy, but I couldn't find how to edit the 
 SQLFORM buttons in the documentation: 
 http://web2py.com/book/default/chapter/07#SQLFORM-grid-and-SQLFORM-smartgrid

 Essentially I have a function I want the edit button to use instead of 
 editing the record called in the SQLFORM. Is there a way to reassign the 
 Edit button or am I better just creating a new button?



-- 
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: Function being called twice from one button click

2015-02-26 Thread peter
Thanks for your replies. I guess you are right Anthony, one should handle 
unlikely events even if they are normally rare. The site did already does 
this for paying bookings, but I did not expect the duplicates on 
reservations.

I have now prevented multiple reservations from a single confirm.

Peter

-- 
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: Function being called twice from one button click

2015-02-26 Thread Dave S


On Thursday, February 26, 2015 at 9:50:26 AM UTC-8, peter wrote:

 Thanks for your replies. I guess you are right Anthony, one should handle 
 unlikely events even if they are normally rare. The site did already does 
 this for paying bookings, but I did not expect the duplicates on 
 reservations.

 I have now prevented multiple reservations from a single confirm.


Which will allow you to log those events and see if you can identify a 
cause   :-)

/dps
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Routes pattern and args / query strings

2015-02-26 Thread Louis Amon
 That’s actually what I ended up doing, but it isn’t something you can rely on 
 in a big project…
 
 Why not?

Because you’d have to document very clearly the fact that some specific rules 
need to be organized in a precise order among the list.
If you have hundreds of URLs managed in your routes.py and if 10 of them need 
to be organized in specific orders then if you want to add an URL you need a 
very clear view of exactly where you need to put the rule to match it.

Now imagine an intern takes over the routing… this whole order-based routing 
would be an epic mess.

 I was hoping there would be an alternative, but I guess regular expressions 
 are indeed the only option to do things properly.
 
 Did you have a particular API in mind? The parameter-based system is designed 
 to be much simpler while cover the most common use cases, but if you want 
 something highly customized, there will inevitably be some complexity to the 
 rules you set up.

I was thinking about something like $args or $vars that would be pre-coded with 
the right regex to match one or no args and/or a query string.


 Le 25 févr. 2015 à 20:57, Anthony abasta...@gmail.com a écrit :
 
 On Wednesday, February 25, 2015 at 7:54:36 AM UTC-5, Louis Amon wrote:
 Anyway, the rules are processed in order, so you should be able to include a 
 rule mapping static to static, and then include the /s$anything rule (which 
 won't be matched to static because the static rule will already have 
 matched).
 
 
 That’s actually what I ended up doing, but it isn’t something you can rely on 
 in a big project…
 
 Why not?
  
 In some cases, $anything isn't powerful enough, and you need to use regular 
 expressions.
 
 I was hoping there would be an alternative, but I guess regular expressions 
 are indeed the only option to do things properly.
 
 Did you have a particular API in mind? The parameter-based system is designed 
 to be much simpler while cover the most common use cases, but if you want 
 something highly customized, there will inevitably be some complexity to the 
 rules you set up.
 
 Anthony
 
 -- 
 Resources:
 - http://web2py.com http://web2py.com/
 - http://web2py.com/book http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py http://github.com/web2py/web2py (Source 
 code)
 - https://code.google.com/p/web2py/issues/list 
 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/sMPkRPjZWrg/unsubscribe 
 https://groups.google.com/d/topic/web2py/sMPkRPjZWrg/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+unsubscr...@googlegroups.com 
 mailto:web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout 
 https://groups.google.com/d/optout.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Using CAS for non web2py apps

2015-02-26 Thread Kenneth
Hello,

I'm trying to get an Drupal with the Drupal CAS module to authenticate 
against an web2py app. 

When I test to go with browser to the user/cas/login adress on my site I 
get the following message: not authorized

Can anyone explain how to get this working?

How do I return some user parameters to Drupal?


Kenneth

-- 
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: Google Cloud Storage in GAE refresh token access

2015-02-26 Thread Jacinto Parga
Well, I have made a little progress 
: 
https://developers.google.com/api-client-library/python/guide/google_app_engine#Credentials

But, now the only question is how to get the modules:

type 'exceptions.ImportError' No module named appengine.api



El jueves, 26 de febrero de 2015, 8:48:46 (UTC+1), Jacinto Parga escribió:

 Hi, 

 I am using Google Cloud Storage (GCS) with web2py.

 I've implemented ( 
 https://cloud.google.com/storage/docs/json_api/v1/json-api-python-samples 
 ) it works fine in localhost or in systems where you can write in the 
 filesystem.

 But in Google App Engine (GAE) you can not write in the filesystem so it 
 doesn't create nor update *sample.dat*

  # If the credentials don't exist or are invalid run through the native client
   # flow. The Storage object will ensure that if successful the good
   # credentials will get written back to the file.
   storage = file.Storage('sample.dat')
   credentials = storage.get()
   if credentials is None or credentials.invalid:
 credentials = tools.run_flow(FLOW, storage, flags)

   # Create an httplib2.Http object to handle our HTTP requests and authorize 
 it

   # with our good Credentials.
   http = httplib2.Http()
   http = credentials.authorize(http)

   # Construct the service object for the interacting with the Cloud Storage 
 API.
   service = discovery.build('storage', _API_VERSION, http=http)


 The result is that anytime I deploy it in GAE it works fine until the 
 *token* stored in *sample.dat * expires. As soon as it expires it cannot 
 update the file so the access is revoked.

 Maybe I can change the file *sample.dat*  for a variable stored in a 
 table, something like this. 

 db.define_table('t_sample',
 Field('f_sampledat', type='text',  label=T('Mensaje')))

 But I haven't found how to do it right, how to store the content of 
 sample.dat and to access it in the same way. Any suggestion.

 The sample.dat file is like this:

 {_module: oauth2client.client, token_expiry: 2015-02-25T20:17:48Z,
  access_token: , 
 token_uri: https://accounts.google.com/o/oauth2/token;, invalid: 
 false, token_response: {access_token: 
 x, token_type:
  Bearer, expires_in: 3600}, client_id: 
 xx.apps.googleusercontent.com, id_token
 : null, client_secret: xxx, revoke_uri: 
 https://accounts.google.com/o/oauth2/revoke;, _class: 
 OAuth2Credentials, refresh_token: 
 x, 
 user_agent: null}



-- 
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] Function being called twice from one button click

2015-02-26 Thread peter
I have a baffling problem. I have written a ticket booking system for a 
jazz club, in Web2py. (Web2py has been great for this site). It has been 
functioning very well for a number of years. When reserving seats with the 
system, the user  is shown a summary of their reservations and clicks a 
confirm button. This then calls a web2py function that sends a confirmation 
email and books the seats in the database.

A user claims it is double booking him even though he only clicks confirm 
once. The strange thing is it only does this for him and it has done it 
three weeks running. 

Has anyone any ideas how an 'A' link 

{{=A('Confirm',_href=URL('reservation_confirmed', 
args=request.args),_style=color:#ff3300;font-size:20px;background-color:#ff;padding:5px;border:1px
 
solid #99)}}

can cause a routine to called twice with one button click?

Any ideas welcome

Thanks
Peter

-- 
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] pycharm python console

2015-02-26 Thread 'Diogene Laerce' via web2py-users

On 02/26/2015 01:41 PM, António Ramos wrote:
 To the ones that use pycharm with web2py.

 How can i interact with my models from the python console ?

I don't think that it is different from the shell outside of pycharm.

 it does not recognize my models.

What do you mean by that ?

Regards,

-- 
“One original thought is worth a thousand mindless quotings.”
“Le vrai n'est pas plus sûr que le probable.”

  Diogene Laerce


-- 
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.


signature.asc
Description: OpenPGP digital signature


[web2py] Re: request.uri_language

2015-02-26 Thread Bas van Wetten
I realize this is an old thread but I was experiencing similar problems 
with web2py and it's custom language behavior. 
The problem is with the next assignment. The parameter passed to the 
'read_possible_languages' function is not the correct path for the language 
files.

possible_languages = read_possible_languages(abspath('applications', app))

I was able to fix this problem by changing the instruction above to :

possible_languages = read_possible_languages(abspath('applications', app, 
'languages'))

Now I can correctly override the language in my url using :

*http://127.0.0.1:8000/MyApp/nl/default/index* or 
*http://127.0.0.1:8000/MyApp/du/default/index*

I hope this helps other people with the same issue; again sorry for 
necromancing this thread!

On Friday, January 10, 2014 at 1:32:19 PM UTC+1, Gael Princivalle wrote:

 Hello all.

 I'm in trouble with language management.
 Here is my routes.py at web2py root (standard):
 routers = dict(

 # base router
 BASE=dict(
 default_application='welcome',
 ),
 )

 Here is my routes.py in the test application (standard).
 from fileutils import abspath
 from languages import read_possible_languages

 possible_languages = read_possible_languages(abspath('applications', app))

 routers = {
 app: dict(
 default_language = possible_languages['default'][0],
 languages = [lang for lang in possible_languages
if lang != 'default']
 )
 }

 In the test application, I've add this code at the end of the model db.py 
 file:
 if request.uri_language: T.force(request.uri_language)

 And in my test application I've create this mypage page:
 In controller:
 def mypage():
 request_uri_language = request.uri_language
 return locals()

 In view:
 {{extend 'layout.html'}}
 h1Template default/mypage.html/h1
 {{=BEAUTIFY(response._vars)}}

 If I try with mydomain.com/test/mypage
 request_uri_language = en

 If I try with mydomain.com/test/it/mypage I've got this error:
 invalid function (default/it)

 Someone can help me ?

 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] DAL for Insert Into with Select

2015-02-26 Thread Mat Miles
Is it possible to use the DAL to run an INSERT INTO with a select list? I 
haven't figured out a way to make this work using db.executesql() because I 
need to pass a date to the query. I don't see a way to pass a variable into 
db.executesql().

-- 
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: [Bulk] [web2py] Re: Use DAL as standalone

2015-02-26 Thread 'Diogene Laerce' via web2py-users

On 02/21/2015 12:56 AM, Cássio Botaro wrote:
 Do you clone the repository or use stable version?

 I dont have problems here running Version
 2.9.12-stable+timestamp.2015.02.13.23.31.09 in linux ubuntu 14.04

But I do have some with the Web2py Version is
2.9.12-stable+timestamp.2015.01.17.06.11.03
in Debian Wheezy..

-- 
“One original thought is worth a thousand mindless quotings.”
“Le vrai n'est pas plus sûr que le probable.”

  Diogene Laerce


-- 
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.


signature.asc
Description: OpenPGP digital signature


[web2py] Re: Use DAL as standalone

2015-02-26 Thread 'Diogene Laerce' via web2py-users


On 02/20/2015 10:05 PM, Michael Lam wrote:
 Massimo seems to had ported much of web2py components to other frameworks:
 
 https://github.com/mdipierro/gluino
 
 It hadn't seen updates since 2 years ago but it might serve as a
 starting point?

Yeah.. But it seems a bit heavy just to benefit of the DAL library.

But thanks anyway.

-- 
“One original thought is worth a thousand mindless quotings.”
“Le vrai n'est pas plus sûr que le probable.”

  Diogene Laerce

-- 
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.


signature.asc
Description: OpenPGP digital signature


Re: [web2py] Re: Function being called twice from one button click

2015-02-26 Thread Carlos Costa
Use the browser console to investigate.
Look at the Network tab if it performs two actions with that URL.
Another thing that may sound stupid but it is not uncommon and I have
already seen it.
Some people double click buttons, icons in the web too.
I saw a case that a delay between clicks was need.
Another thing to look is the page delay. If it delays too much the person
may click again.

2015-02-26 9:46 GMT-03:00 Leonel Câmara leonelcam...@gmail.com:

 I don't see how it can happen. Your costumer probably has a virus or
 something. It may also be a buggy browser extension (tell him to try with
 the browser in private mode so the extensions are off).

 --
 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.




-- 


Carlos J. Costa
Cientista da Computação  | BS Computer Science
Esp. Gestão em Telecom   | PgC Telecom Mangement
º))

-- 
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] DePy 2015

2015-02-26 Thread Massimo Di Pierro
Hello everybody,

I am happy to announce DePy 2015. A conference on Python hosted at DePaul 
on May 29  30. The conference will focus specifically on Data Analysis, 
Machine Learning and Web Development. No need to emphasize, there will be a 
heavy web2py component.

http://mdp.cdm.depaul.edu/DePy2015

We have limited space so, if you are interested, please register asap. When 
you register you also have the option to propose yourself as a speaker. If 
you want to suggest a speaker other then yourself, let me know and, if 
approved we will try invite the speaker.

If you know companies that may want to sponsor the event, also let me know.

We already have some sponsors and a nice venue that can host about 300 
people.

Massimo 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Reset Password Not Working in Production

2015-02-26 Thread Vinicius Assef
Which web2py version are you using?

 On Wed, 25 Feb 2015 13:19:31 -0300 Neil Oswald  wrote  
Hi,


Good day!


After clicking the reset_password link I received from email,

I got redirected to the homepage not on the reset password page.


The strange thing is that this problem only occur in my production
site. The reset works perfectly in my local machine.


I've done some checking in firebug and it said something like
a 303 See Other error.


Any help is appreciated. 


Thanks.


Neil Oswald







 
 -- 
 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.
 

-- 
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: Scheduler exception when setting immediate=True: 'Deadlock found when trying to get lock...'

2015-02-26 Thread Niphlod
it seems to me that there is database contention although the 
exception **should** be trapped (i.e. try to set the status to PICK, if 
not, well it's not a fatal error), there's something wrong with your 
setup or your database is too much underpowered to do what you're asking.
How many workers are running and with what heartbeat ?

On Friday, February 27, 2015 at 12:28:28 AM UTC+1, Osman Masood wrote:

 Hello all,

 I keep getting this error when calling scheduler.queue_task() with 
 immediate=True:

 class 'gluon.contrib.pymysql.err.InternalError' (1213, u'Deadlock found 
 when trying to get lock; try restarting transaction')

 The stack trace shows this is the culprit:

   self.db(self.db.scheduler_worker.is_ticker == True).update(status=PICK)

 (This is a web application which uses the scheduler pretty extensively.) 
 Seems like multiple connections are competing for access to the same 
 scheduler_worker row. 

 Seems to me like a web2py bug. Any help would be greatly 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] social networking share button to rss feed

2015-02-26 Thread Abhijit Chatterjee
Trting to put social networking share button to my rss feed. Any help?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] pycharm python console

2015-02-26 Thread Tim Richardson
I use pycharm.

Often I do some quick and dirty testing in a module file where I have code 
using DAL features.

if __name__ == __main__:
#debug code

and I want to run that in the normal scope of web2py, i.e. the same as -S 
-M from the command line.
I set up a Pycharm debug configuration which executes web2py.py and I pass 
script parameters as in this example:

-S olap -M -R 
C:\Users\tim\web2py_dev\applications\olap\modules\update_appt_summary_table.py

I can then breakpoint within pycharm, run the pycharm console etc.
Models are initiated.
Does this 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/d/optout.


[web2py] avatar like feature as in instant press

2015-02-26 Thread Abhijit Chatterjee
I m trying to put avatar like feature as in instant press. Any help?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: avatar like feature as in instant press

2015-02-26 Thread Leonel Câmara
It's not very hard, here's a possibility that requires you to have pillow 
https://pillow.readthedocs.org/ installed.


auth.settings.extra_fields['auth_user'] = [
Field('photo', 'upload', label=T('Photo'), uploadseparate=True, requires
=[IS_EMPTY_OR(IS_IMAGE(error_message=T('This is not an image.'))), IS_LENGTH
(maxsize=1048576)]),
Field('avatar','upload', uploadseparate=True, readable=False, writable=
False, autodelete=True, compute=lambda row: SMARTHUMB('auth_user', row.photo
, (32, 32), name='avatar')),
]



def upload_fullpath(tablename, filename, makedirs=False):

Given a tablename and a filename return the full path
TODO: For now it assumes uploadseparate=True in the field definition,
  could be more versatile.

import os
from gluon import current
fieldname, img_uid = filename.split('.')[1:3]
path = os.path.join(current.request.folder, 'uploads', tablename + '.' + 
fieldname, img_uid[:2], filename)
if makedirs:
try:
os.makedirs(os.path.dirname(path))
except OSError:
print Skipping creation of %s because it exists already. % os.
path.dirname(path)
return path


def SMARTHUMB(tablename, image, box, fit=True, name=thumbnail):

Downsample the image.

http://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box

Modified to respect uploadseparate=True differences

 @param img: Image -  an Image-object
 @param box: tuple(x, y) - the bounding box of the result image
 @param fit: boolean - crop the image to fill the box

if image:
from PIL import Image
import os
from gluon.tools import current, web2py_uuid
request = current.request
img = Image.open(upload_fullpath(tablename, image))
#preresize image with factor 2, 4, 8 and fast algorithm
factor = 1
while img.size[0] / factor  2 * box[0] and img.size[1] * 2 / 
factor  2 * box[1]:
factor *= 2
if factor  1:
img.thumbnail((img.size[0] / factor, img.size[1] / factor), 
Image.ANTIALIAS)
 
#calculate the cropping box and get the cropped part
if fit:
x1 = y1 = 0
x2, y2 = img.size
wRatio = 1.0 * x2 / box[0]
hRatio = 1.0 * y2 / box[1]
if hRatio  wRatio:
y1 = int(y2 / 2 - box[1] * wRatio / 2)
y2 = int(y2 / 2 + box[1] * wRatio / 2)
else:
x1 = int(x2 / 2 - box[0] * hRatio / 2)
x2 = int(x2 / 2 + box[0] * hRatio / 2)
img = img.crop((x1, y1, x2, y2))
 
#Resize the image with best quality algorithm ANTI-ALIAS
img = img.resize(box, Image.ANTIALIAS)
 
root, ext = os.path.splitext(image)
thumbname = '%s.%s.%s.%s%s' % (tablename, name, web2py_uuid().
replace('-', '')[-16:], web2py_uuid().replace('-', '')[-16:], ext)
img.save(upload_fullpath(tablename, thumbname, makedirs=True)) 
   

return thumbname



-- 
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] Scheduler exception when setting immediate=True: 'Deadlock found when trying to get lock...'

2015-02-26 Thread Osman Masood
Hello all,

I keep getting this error when calling scheduler.queue_task() with 
immediate=True:

class 'gluon.contrib.pymysql.err.InternalError' (1213, u'Deadlock found 
when trying to get lock; try restarting transaction')

The stack trace shows this is the culprit:

  self.db(self.db.scheduler_worker.is_ticker == True).update(status=PICK)

(This is a web application which uses the scheduler pretty extensively.) Seems 
like multiple connections are competing for access to the same scheduler_worker 
row. 

Seems to me like a web2py bug. Any help would be greatly 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: Scheduler exception when setting immediate=True: 'Deadlock found when trying to get lock...'

2015-02-26 Thread Osman Masood
Thanks for the quick response!

I'm using Amazon RDS (just basically MySQL), on a pretty beefy instance 
(db.m3.large), 1000 IOPS. Would be pretty surprised if that were the 
problem.

Running 5 scheduler workers with the default heartbeat (3s).

On Thursday, February 26, 2015 at 3:35:41 PM UTC-8, Niphlod wrote:

 it seems to me that there is database contention although the 
 exception **should** be trapped (i.e. try to set the status to PICK, if 
 not, well it's not a fatal error), there's something wrong with your 
 setup or your database is too much underpowered to do what you're asking.
 How many workers are running and with what heartbeat ?

 On Friday, February 27, 2015 at 12:28:28 AM UTC+1, Osman Masood wrote:

 Hello all,

 I keep getting this error when calling scheduler.queue_task() with 
 immediate=True:

 class 'gluon.contrib.pymysql.err.InternalError' (1213, u'Deadlock found 
 when trying to get lock; try restarting transaction')

 The stack trace shows this is the culprit:

   self.db(self.db.scheduler_worker.is_ticker == True).update(status=PICK)

 (This is a web application which uses the scheduler pretty extensively.) 
 Seems like multiple connections are competing for access to the same 
 scheduler_worker row. 

 Seems to me like a web2py bug. Any help would be greatly 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: When not HTTPS i receive TypeError: 'NoneType' object is not callable

2015-02-26 Thread Massimo Di Pierro
At least three users have reported this problem with Apache. We need to set 
a time for a chat session and resolve this together since I cannot 
reproduce but I think I know the root cause. Can people make it on Monday 
at 10am CST?

On Thursday, 26 February 2015 06:39:31 UTC-6, Leonel Câmara wrote:

 I think this is probably a webserver (probably apache) configuration 
 issue. Have you made any changes to the configuration recently?


-- 
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: Function being called twice from one button click

2015-02-26 Thread Massimo Di Pierro
Here is what would cause this problem.  You have this link:

{{=A('Confirm',_href=URL('reservation_confirmed', 
args=request.args),_style=color:#ff3300;font-size:20px;background-color:#ff;padding:5px;border:1px
 
solid #99)}}

Now if in the view for reservation_confirmed you include an image or a css 
file or any other static file with the incomplete path, the browser may 
incorrectly request the page itself instead of the image. This happens when 
you use a stock template and you have broken src= in it. So the action is 
not called twice because of the click but because of the src.

Do I make sense? This may not be your problem. Just guessing because I have 
seen it many times.




On Thursday, 26 February 2015 04:58:24 UTC-6, peter wrote:

 I have a baffling problem. I have written a ticket booking system for a 
 jazz club, in Web2py. (Web2py has been great for this site). It has been 
 functioning very well for a number of years. When reserving seats with the 
 system, the user  is shown a summary of their reservations and clicks a 
 confirm button. This then calls a web2py function that sends a confirmation 
 email and books the seats in the database.

 A user claims it is double booking him even though he only clicks confirm 
 once. The strange thing is it only does this for him and it has done it 
 three weeks running. 

 Has anyone any ideas how an 'A' link 

 {{=A('Confirm',_href=URL('reservation_confirmed', 
 args=request.args),_style=color:#ff3300;font-size:20px;background-color:#ff;padding:5px;border:1px
  
 solid #99)}}

 can cause a routine to called twice with one button click?

 Any ideas welcome

 Thanks
 Peter



-- 
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: IRC Channel

2015-02-26 Thread Leonel Câmara
I think we pretty much just use this group.

-- 
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: Scheduler exception when setting immediate=True: 'Deadlock found when trying to get lock...'

2015-02-26 Thread Osman Masood
I was actually able to easily reproduce this. Just open up 2 web2py 
consoles (which connect to the same DB), and do:

scheduler.queue_task('myfunc', pvars=dict(), immediate=True)

The first one will succeed, and the second one will hang there for some 
time, and then give the deadlock exception above.

This kinda makes sense, looking at the above DB query  considering 
record-level locking. We have conditional writes on all records in the 
scheduler_worker table, so if two connections attempt this at the same 
time, it would follow that there is a deadlock. (Correct me if I'm wrong.) 
So I think the solution would be something like (on line 1303 of 
scheduler.py):

 if immediate:

-self.db(self.db.scheduler_worker.is_ticker == 
True).update(status=PICK)

+scheduler_worker_tickers = 
self.db(self.db.scheduler_worker.is_ticker == True).select()

+for scheduler_worker_ticker in scheduler_worker_tickers:

+scheduler_worker_ticker.update_record(status=PICK)


On Thursday, February 26, 2015 at 3:54:47 PM UTC-8, Osman Masood wrote:

 Thanks for the quick response!

 I'm using Amazon RDS (just basically MySQL), on a pretty beefy instance 
 (db.m3.large), 1000 IOPS. Would be pretty surprised if that were the 
 problem.

 Running 5 scheduler workers with the default heartbeat (3s).

 On Thursday, February 26, 2015 at 3:35:41 PM UTC-8, Niphlod wrote:

 it seems to me that there is database contention although the 
 exception **should** be trapped (i.e. try to set the status to PICK, if 
 not, well it's not a fatal error), there's something wrong with your 
 setup or your database is too much underpowered to do what you're asking.
 How many workers are running and with what heartbeat ?

 On Friday, February 27, 2015 at 12:28:28 AM UTC+1, Osman Masood wrote:

 Hello all,

 I keep getting this error when calling scheduler.queue_task() with 
 immediate=True:

 class 'gluon.contrib.pymysql.err.InternalError' (1213, u'Deadlock 
 found when trying to get lock; try restarting transaction')

 The stack trace shows this is the culprit:

   self.db(self.db.scheduler_worker.is_ticker == True).update(status=PICK)

 (This is a web application which uses the scheduler pretty extensively.) 
 Seems like multiple connections are competing for access to the same 
 scheduler_worker row. 

 Seems to me like a web2py bug. Any help would be greatly 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: Change in application request.vars when switching from Rocket to Lighttpd+FastCGI

2015-02-26 Thread Mike


On Wednesday, February 25, 2015 at 12:18:29 PM UTC-8, Niphlod wrote:

 reaally strange, although I don't use lighttpd since nginx came out. 
 request.vars are parsed out of request.QUERY_STRING. could you please 
 doublecheck what request.get('QUERY_STRING') dumps ?




request.get('QUERY_STRING') is *None *

I can't figure out the source of this issue, so I have switched to nginx, 
and all is OK!

Thanks for looking at this.

-- 
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] IRC Channel

2015-02-26 Thread KPlus
Hello

I Had a Quick Question Regarding Web2Py , I've looked for the fastest way 
to get a response from the community which is IRC Channel .
But sadly , it looks inactive channel .

is it #web2py on freenode ? or there are another channel ?

Regards,

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Customize incoming POST data

2015-02-26 Thread Jon M.
Greetings Web2Py fellows!

While working with the DAL and some views I faced wall when I looked at the 
POST constructor from API. So the first question is simple.

Is there any way to only catch a value from the POST constructor and do 
whatever I want inside the controller 'default.py' in order to keep using 
some queries needed to verify information and insert the data into the 
table with the appropiate values?

The second and last:

If the first one is doable, then what does an API method is supposed to 
return?

Eg.

 @request.restful()
 def api():

   def GET(*args,**vars):
 return dict()

   def POST(desired_value):
 if (some_controller_method(desired_value)):
   return something 
 else:
   ???
   return something_else

   def PUT(*args,**vars):
 return dict()

   def DELETE(*args,**vars):
 return dict()
  
   return locals()


That's all folks! Thank you very much for your time and attention. :D

-- 
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.