[web2py] How to bulid a fast responding service?

2016-11-15 Thread Martin Weissenboeck
​I want to implement the telegram inline-mode ( https://core.telegram.org/bots/api#inline-mode). The telegram server sends an URL request and the web2py server a) should decide which user wants an answer and b) should ​respond as fast as possible. a): I use a database table to store the "state". O

[web2py] lastName, firstName in form

2016-11-15 Thread 'Annet' via web2py-users
I have a form in which the user enter his name, for example: 'Thompson, Brian' When I execute the following query: rowset = db(db.vtx_vertex.name.ilike(nameform.vars.name)) This query return the correct result. However, when db.vtx_vertex.name is 'Thompson, Brian ' (a space after Brian) and na

[web2py] Re: Text area input field DAL question

2016-11-15 Thread 黄祥
yes, that's the way i use before, but my question is not the way to insert the value into the table but about the represent of text field that contain html tag. *e.g. SQLFORM.grid with XML(sanitize = False)* Dear Test, NAV Product NAV Date NAV per Unit (Rp.) Previous NAV per Unit (Rp.) Daily Ret

[web2py] Re: Text area input field DAL question

2016-11-15 Thread Dave S
On Tuesday, November 15, 2016 at 4:23:53 PM UTC-8, 黄祥 wrote: > > let say i have a text field that filled with the html tags, how should i > use the represent for that? > *e.g.* > db.define_table('mail_queue', > Field('mail_to', 'list:string'), > Field('subject'), > Field('messages', 'text'),

[web2py] Re: Text area input field DAL question

2016-11-15 Thread 黄祥
let say i have a text field that filled with the html tags, how should i use the represent for that? *e.g.* db.define_table('mail_queue', Field('mail_to', 'list:string'), Field('subject'), Field('messages', 'text'), Field('status'), format = lambda r: '%s - %s - %s' % (r.mail_to, r.subject, r

[web2py] expiration vs long_expiration

2016-11-15 Thread 黄祥
is there any difference between expiration and long_expiration? e.g. auth.settings.expiration = 60*60 auth.settings.long_expiration = 60*60 can both have the same value or not? thanks and best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://gi

[web2py] Re: Text area input field DAL question

2016-11-15 Thread Anthony
On Tuesday, November 15, 2016 at 1:25:11 PM UTC-5, Marlysson Silva wrote: > > try with {{=XML(event)}} > Don't use the above -- it won't help with the line breaks, and it is unsafe (as the user input will not be escaped, opening you up to an XSS attack). Instead, see http://stackoverflow.com/a/1

[web2py] Re: Equivalent of request.args(...) for request.vars(...)

2016-11-15 Thread Anthony
> For my usage, anyway, the "otherwise" parameter is just as relevant in > either case. I see args and vars as parallel to passing arguments to > Python functions by position and by keyword. > Understood, but because request.args are part of the URL path, it is more likely that they will be

[web2py] web2py as Grafana endpoint

2016-11-15 Thread Dave S
I'm trying to implement a simple json endpoint for Grafana. Does anyone here have experience with doing this? https://github.com/grafana/simple-json-datasource/blob/master/README.md> I'm looking at using @service.json, but I'm not sure how to get the body on a /query. (The sample fake-simple-

[web2py] Re: rendering custom dict to xml, csv, and py

2016-11-15 Thread Dave S
On Tuesday, November 15, 2016 at 3:41:39 AM UTC-8, lucas wrote: > > ok, with dave's prompting and help, i got the code to work. i don't > understand why taking the response.write() function out there works. how > come? > > here is my working snippet: > > from cStringIO import Stri

[web2py] No __pow__ on pydal Expression

2016-11-15 Thread Brendan Barnwell
I notice that the pydal Expression class defines magic methods for most math operations, letting you create expression queries like `.select(db.Table.field*2)`. However, it doesn't define a __pow__ method, so I can't do something like `.select(db.Table.field**2)` to get a computed result that

[web2py] Re: Equivalent of request.args(...) for request.vars(...)

2016-11-15 Thread Brendan Barnwell
On Monday, November 14, 2016 at 1:01:26 PM UTC-8, Anthony wrote: > > On Monday, November 14, 2016 at 1:29:11 PM UTC-5, Brendan Barnwell wrote: >> >> You're right that dict.get handles the default value, but the >> functionality available for args includes substantially more than that. >> It's on

[web2py] Re: Sending two different emails with auth.settings.register_onaccept

2016-11-15 Thread 黄祥
perhaps you can use a function *e.g.* *models/db.py* auth.settings.register_onaccept = lambda form: registration_send_mail(form) def registration_send_mail(form): #1st send_mail #2nd send_mail best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http

Re: [web2py] scheduling multiple tasks

2016-11-15 Thread Dave S
On Tuesday, November 15, 2016 at 2:14:21 AM UTC-8, Yebach wrote: > > Thank you guys. I finally made it. I did not quite understand the whole > scheduler process but i am now getting there. > > Thank you again > > Congratulations! It sometimes takes a while to get the right mental images, doesn

[web2py] Re: Text area input field DAL question

2016-11-15 Thread Dave S
On Tuesday, November 15, 2016 at 9:58:52 AM UTC-8, Ramos wrote: > > I know this should be a simple one. > > I have a field >Field('event','text',requires=IS_NOT_EMPTY(error_message=T("Please > enter a value")),label=T("Event")), > > This field is displayed as a textarea. > > The user inputs

[web2py] Re: Text area input field DAL question

2016-11-15 Thread Marlysson Silva
try with {{=XML(event)}} Em terça-feira, 15 de novembro de 2016 14:58:52 UTC-3, Ramos escreveu: > > I know this should be a simple one. > > I have a field >Field('event','text',requires=IS_NOT_EMPTY(error_message=T("Please > enter a value")),label=T("Event")), > > This field is displayed as

[web2py] Text area input field DAL question

2016-11-15 Thread António Ramos
I know this should be a simple one. I have a field Field('event','text',requires=IS_NOT_EMPTY(error_message=T("Please enter a value")),label=T("Event")), This field is displayed as a textarea. The user inputs text like this aaa bbb ccc and when i show it on a form as {{=event}} i get

[web2py] Sending two different emails with auth.settings.register_onaccept

2016-11-15 Thread Gael Princivalle
Hello. Actually my app send one email when the user registration is accepted: auth.settings.register_onaccept = lambda form: mail.send(to=i...@domain.com ',subject='New user on domain.com',message='New user is First name: ' + form.vars.first_name + 'Last name: ' + form.vars.last_name + '') How

[web2py] Re: redis_utils import error

2016-11-15 Thread Pierre
I see my w2p version is too old - one year and "one" gets old :)( reinstalling . . .. shall we call "old children" adults ? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py

[web2py] redis_utils import error

2016-11-15 Thread Pierre
Hi, I installed *redis* on my local machine I added this (from the book) in a model : from gluon.contrib.redis_utils import RConn from gluon.contrib.redis_cache import RedisCache rconn = RConn('localhost', 6379) cache.redis = RedisCache(redis_conn=rconn, debug=True) first import fails and

[web2py] Re: rendering custom dict to xml, csv, and py

2016-11-15 Thread lucas
ok, with dave's prompting and help, i got the code to work. i don't understand why taking the response.write() function out there works. how come? here is my working snippet: from cStringIO import StringIO stream = StringIO() if (file_return == 'xml'):

Re: [web2py] scheduling multiple tasks

2016-11-15 Thread Vid Ogris
Thank you guys. I finally made it. I did not quite understand the whole scheduler process but i am now getting there. Thank you again 2016-11-14 2:50 GMT+08:00 Nico de Groot : > Correction: > > Hi Vid, > > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - htt