Re: [web2py] Postpone a scheduler action

2018-07-11 Thread Manuele Pesenti




On 09/07/2018 09:56, Martin Weissenboeck wrote:

What I want to do:

I have a running scheduler action and I want to interrupt this action 
and postpone it for a later time. What would be the best solution?

consider to:

1. Setup the task in order to be re-tried till it will end up with success
2. Check if it's the case to postpone the task
3. if yes raise an exception an let fail the task

eventually if the task is retried too early raise another exception in 
order to wait the two minutes.


Could it fit your needs?

Cheers

    Manuele



Why? The scheduler starts to send a message by Telegram, but at this 
moment there is a dialog between the Telegram bot and the client (who 
is the receiver of message). Therefore the scheduler should not send 
the message and should try it e.g. 2 minutes later. And may repeat 
this process if necessary.


Thanks in advance, Martin


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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] Postpone a scheduler action

2018-07-11 Thread Martin Weissenboeck
Yes I think this solution could do the job. But I don't know if an
exception would produce a big overhead. Anybody who knows the answer?

Manuele Pesenti  schrieb am Mi., 11. Juli 2018,
10:29:

>
>
> On 09/07/2018 09:56, Martin Weissenboeck wrote:
> > What I want to do:
> >
> > I have a running scheduler action and I want to interrupt this action
> > and postpone it for a later time. What would be the best solution?
> consider to:
>
> 1. Setup the task in order to be re-tried till it will end up with success
> 2. Check if it's the case to postpone the task
> 3. if yes raise an exception an let fail the task
>
> eventually if the task is retried too early raise another exception in
> order to wait the two minutes.
>
> Could it fit your needs?
>
> Cheers
>
>  Manuele
>
> >
> > Why? The scheduler starts to send a message by Telegram, but at this
> > moment there is a dialog between the Telegram bot and the client (who
> > is the receiver of message). Therefore the scheduler should not send
> > the message and should try it e.g. 2 minutes later. And may repeat
> > this process if necessary.
> >
> > Thanks in advance, Martin
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.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] Share database connection between modules

2018-07-11 Thread Wei Ken Chang
Hi , I am web2py beginner...
I want to begin transaction (DB) in the controller then pass this dB connection 
to multiple modules ( each modules run different SQL insert/update/delete), if 
one of module action failed so I will revert back (dB connection) else (all 
modules success ) dB will commit.

Please help ...

Thank you

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


[web2py] Syntax Error "unknown app...."

2018-07-11 Thread fiubarc
Hello, i need help with this behavior

Steps to reproduce:

1) routes.py

domains = {   "app1.com" : "app1", "app2.com" : "app2"}

2) uninstall app1

3) the app2 can not be accessed, not even the admin interface. 

Web2py Log:

[Tue Jul 10 11:16:58 2018] [error]  mod_wsgi (pid=2115): Target WSGI script 
'/home/www-data/web2py/wsgihandler.py' cannot be loaded as Python module.
[Tue Jul 10 11:16:58 2018] [error]  mod_wsgi (pid=2115): Exception occurred 
processing WSGI script '/home/www-data/web2py/wsgihandler.py'.
[Tue Jul 10 11:16:58 2018] [error]  Traceback (most recent call last):
[Tue Jul 10 11:16:58 2018] [error]   File 
"/home/www-data/web2py/wsgihandler.py", line 33, in 
[Tue Jul 10 11:16:58 2018] [error] import gluon.main
[Tue Jul 10 11:16:58 2018] [error]   File 
"/home/www-data/web2py/gluon/main.py", line 128, in 
[Tue Jul 10 11:16:58 2018] [error]  load_routes()
[Tue Jul 10 11:16:58 2018] [error]File 
"/home/www-data/web2py/gluon/rewrite.py", line 381, in load
[Tue Jul 10 11:16:58 2018] [error]  load_routers(all_apps)
[Tue Jul 10 11:16:58 2018] [error]File 
"/home/www-data/web2py/gluon/rewrite.py", line 530, in load_routers
[Tue Jul 10 11:16:58 2018] [error]  raise SyntaxError("unknown app '%s' in 
domains" % app)
[Tue Jul 10 11:16:58 2018] [error]  SyntaxError: unknown app 'app1' in domains



4) remove app1 from domains in routes.py

5) problem resolved

The question is whether there is any way to catch the error so that the 
other installed applications can continue running without editing routes.py

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: Share database connection between modules

2018-07-11 Thread Anthony
On Wednesday, July 11, 2018 at 9:46:32 AM UTC-4, Wei Ken Chang wrote:
>
> Hi , I am web2py beginner... 
> I want to begin transaction (DB) in the controller then pass this dB 
> connection to multiple modules ( each modules run different SQL 
> insert/update/delete), if one of module action failed so I will revert back 
> (dB connection) else (all modules success ) dB will commit.
>

If this is all happening within a single HTTP request, web2py already wraps 
the whole request inside a transaction, so no need to do anything explicit 
on your part (you don't even have to call db.commit(), and if the HTTP 
request ultimately results in an error, web2py will also automatically call 
db.rollback()).

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] Re: Syntax Error "unknown app...."

2018-07-11 Thread Anthony
routes.py is just Python code, so you can write code that will dynamically 
generate the "domains" dictionary based on folders found in the 
/applications folder. However, whenever you make a change, you will still 
need to reload routes.py (or restart the web server), as routes.py is only 
executed once upon startup.

Anthony

On Wednesday, July 11, 2018 at 9:47:30 AM UTC-4, fiubarc wrote:
>
> Hello, i need help with this behavior
>
> Steps to reproduce:
>
> 1) routes.py
>
> domains = {   "app1.com" : "app1", "app2.com" : "app2"}
>
> 2) uninstall app1
>
> 3) the app2 can not be accessed, not even the admin interface. 
>
> Web2py Log:
>
> [Tue Jul 10 11:16:58 2018] [error]  mod_wsgi (pid=2115): Target WSGI script 
> '/home/www-data/web2py/wsgihandler.py' cannot be loaded as Python module.
> [Tue Jul 10 11:16:58 2018] [error]  mod_wsgi (pid=2115): Exception occurred 
> processing WSGI script '/home/www-data/web2py/wsgihandler.py'.
> [Tue Jul 10 11:16:58 2018] [error]  Traceback (most recent call last):
> [Tue Jul 10 11:16:58 2018] [error]   File 
> "/home/www-data/web2py/wsgihandler.py", line 33, in 
> [Tue Jul 10 11:16:58 2018] [error] import gluon.main
> [Tue Jul 10 11:16:58 2018] [error]   File 
> "/home/www-data/web2py/gluon/main.py", line 128, in 
> [Tue Jul 10 11:16:58 2018] [error]  load_routes()
> [Tue Jul 10 11:16:58 2018] [error]File 
> "/home/www-data/web2py/gluon/rewrite.py", line 381, in load
> [Tue Jul 10 11:16:58 2018] [error]  load_routers(all_apps)
> [Tue Jul 10 11:16:58 2018] [error]File 
> "/home/www-data/web2py/gluon/rewrite.py", line 530, in load_routers
> [Tue Jul 10 11:16:58 2018] [error]  raise SyntaxError("unknown app '%s' 
> in domains" % app)
> [Tue Jul 10 11:16:58 2018] [error]  SyntaxError: unknown app 'app1' in domains
>
>
>
> 4) remove app1 from domains in routes.py
>
> 5) problem resolved
>
> The question is whether there is any way to catch the error so that the 
> other installed applications can continue running without editing routes.py
>
> 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] Payment integration documentation needs update

2018-07-11 Thread Peter Woolf
Hello,

I'm exploring ways to integrate a payment option into a web2py application 
and see that part of the documentation is quite outdated.

http://web2py.com/books/default/chapter/29/14?search=payment#Accepting-credit-card-payments

In particular, the section on Level 2 integration with Google Checkout. 
 Google Checkout was discontinued in 2013:

https://en.wikipedia.org/wiki/Google_Checkout

I'm hunting for an easy way to charge for a web service--seems a basic 
function of many web2py sites.  I'm a bit frustrated that the first way the 
documentation directed me to was shuttered years ago, but hopefully some of 
the other paths will be more fruitful!

Thanks,
--Peter

--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: Payment integration documentation needs update

2018-07-11 Thread Anthony
Feel free to make a pull request to update the 
docs: https://github.com/web2py/web2py-book

Anthony

On Wednesday, July 11, 2018 at 10:32:42 AM UTC-4, Peter Woolf wrote:
>
> Hello,
>
> I'm exploring ways to integrate a payment option into a web2py application 
> and see that part of the documentation is quite outdated.
>
>
> http://web2py.com/books/default/chapter/29/14?search=payment#Accepting-credit-card-payments
>
> In particular, the section on Level 2 integration with Google Checkout. 
>  Google Checkout was discontinued in 2013:
>
> https://en.wikipedia.org/wiki/Google_Checkout
>
> I'm hunting for an easy way to charge for a web service--seems a basic 
> function of many web2py sites.  I'm a bit frustrated that the first way the 
> documentation directed me to was shuttered years ago, but hopefully some of 
> the other paths will be more fruitful!
>
> Thanks,
> --Peter
>
> --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: Scheduler workers crash on usage of urllib

2018-07-11 Thread Oasis Agano
I ended up importing my self in gluon/packages/dal/pydal/base.py.

with

import urllib



On Wednesday, December 6, 2017 at 5:39:11 PM UTC+2, Ryan Herbert wrote:
>
> Hello,
> I am currently experiencing an issue with my scheduler workers crashing on 
> startup with the following error:
>
> Exception in thread Thread-1:
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
> self.run()
>   File "/usr/share/vidjil/server/web2py/gluon/scheduler.py", line 637, in 
> run
> self.send_heartbeat(counter)
>   File "/usr/share/vidjil/server/web2py/gluon/scheduler.py", line 1161, in 
> send_heartbeat
> self.db._uri, folder=self.db._adapter.folder, decode_credentials=True)
>   File "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/base.py", 
> line 169, in __call__
> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>   File "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/base.py", 
> line 474, in __init__
> "Failure to connect, tried %d times:\n%s" % (attempts, tb)
> RuntimeError: Failure to connect, tried 5 times:
> Traceback (most recent call last):
>   File "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/base.py", 
> line 454, in __init__
> self._adapter = adapter(**kwargs)
>   File 
> "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/adapters/__init__.py"
> , line 40, in __call__
> obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>   File 
> "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/adapters/base.py"
> , line 368, in __init__
> super(SQLAdapter, self).__init__(*args, **kwargs)
>   File 
> "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/adapters/base.py"
> , line 50, in __init__
> self._initialize_(do_connect)
>   File 
> "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/adapters/mysql.py"
> , line 24, in _initialize_
> user = self.credential_decoder(m.group('user'))
>   File "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/base.py", 
> line 403, in 
> credential_decoder = lambda cred: urllib.unquote(cred)
> NameError: global name 'urllib' is not defined
>
> The workers are running inside a docker container and are started with the 
> following command:
> /usr/local/bin/gosu www-data python web2py.py -K myapp
>
>
> I have made sure urllib is correctly installed, and as far as I can tell, 
> it is. Or at least running a python shell and importing the module works. 
> Does anyone have any insight as to why this might be happening ?
>
> 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] web2py + gevent

2018-07-11 Thread Artem
Dear All ,
Anybody using gevent with web2py ?
I always getting error :
>> greenlet.error: cannot switch to a different thread



>>gevent.exceptions.LoopExit: This operation would block forever
>> Hub: >0x119e9ba20 
thread_ident=0x123145489817600>>> threadpool=> 
>>thread_ident=0x7b2d2000>
>> Handles: []

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


[web2py] Re: web2py + gevent

2018-07-11 Thread 黄祥
did you use gevent as web server using anyserver.py?
if yes, perhaps this thread can give any clue:
https://groups.google.com/forum/#!topic/web2py/VP6KiNkR4OY

best regards,
stifan

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