Re: [web2py] how to start Celery worker in web2py

2018-11-04 Thread James O' Driscoll
I used DAL(uri, folder, import_models=True) in the task.py function and 
this does the job.

If possible can someone explain if:

1.This lightweight connect to celery is preferred 
over https://code.google.com/archive/p/web2py-celery/.
2.Is running the worker using task manager as a windows service the 
best practice?

Regards,
James


On Saturday, November 3, 2018 at 4:46:43 PM UTC+10, James O' Driscoll wrote:
>
> I have implemented the above, the gen_url function is working but the 
> add_user function is not (receiving the error db is not defined from 
> tasks.py.)
>
> Regards,
> James
>

-- 
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] how to start Celery worker in web2py

2018-11-04 Thread Alexandra Lee
hello.
Can you unsubscribe me please? I am not currenly a web2py user. But maybe
in future.
Please remove my email from you list for now.

Kind regards,
Alexandra

On Sun, Nov 4, 2018 at 8:10 AM James O' Driscoll 
wrote:

> I used DAL(uri, folder, import_models=True) in the task.py function and
> this does the job.
>
> If possible can someone explain if:
>
> 1.This lightweight connect to celery is preferred over
> https://code.google.com/archive/p/web2py-celery/.
> 2.Is running the worker using task manager as a windows service the
> best practice?
>
> Regards,
> James
>
>
> On Saturday, November 3, 2018 at 4:46:43 PM UTC+10, James O' Driscoll
> wrote:
>>
>> I have implemented the above, the gen_url function is working but the
>> add_user function is not (receiving the error db is not defined from
>> tasks.py.)
>>
>> Regards,
>> James
>>
> --
> 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: json data breaks, via routing, to a web2py controller

2018-11-04 Thread Carl Hunter Roach
As suspected, my workaround was to URL encode the "offending" fields at the 
client end. simpleton.loads() then parsed the json happily. The field could 
then be "unencoded".

My system has plenty of json passing between clients and the Web2py 
service. I can't work out why I've tripped over here.


On Saturday, 3 November 2018 19:04:20 UTC, Carl Hunter Roach wrote:
>
> I've had a stable web2py-based service for some years now.
> But it broke today with a small change in a data value - that's my working 
> hypothesis.
>
> The output of the print statement (see code below):
>
>  {'{"sort":"relevancy","longitude":-0.1228710438544765,"keywords":"parrot","latitude":51.51158325978085,"page_cursor":"A2ebAAFVVvv0OW53MHyzU0VWVVBxb0tiUW9oWkd0UHMzU09aUjIwYUFBPT0jMTA':
>  
> '"}'}>
>
>
> The value of "page_cursor" sent by the caller is "page_cursor" : 
> "A2ebAAFVVvv0OW53MHyzU0VWVVBxb0tiUW9oWkd0UHMzU09aUjIwYUFBPT0jMTA=' i.e. 
> there is an "=" suffix. But by the time my controller receives the 
> json structure the "=" has been mangled. This obviously defeats the 
> simplejson loads function as the data is no longer valid json. Previous to 
> today page_cursor values have been more straightforward and not included a 
> "=" character and the code has executed fine.
>
> Any suggestions? A fix or a different approach to parsing request.post_vars
>
> The call is to: https://…/api/v1/article_search
>
> The code excerpts:
>
> app/controller.py
>
> @articles_service.json
> def get_article():
> from applications.app.modules.article import get_articles
> print(request.post_vars)
> return get_articles(request.post_vars)
>
> app/modules/article.py
>
> def get_articles(json_fields):
> '''
> get with a JSON interface
> '''
> from gluon.contrib.simplejson import loads
> fields = {}
> for i in json_fields.keys():
> fields = loads(i) # crashes here.
> return …
>
> routes.py
>
> routes_in = (  ('/api/v1/$anything', 
> '/app/controller/call/json/$anything')  )
> routes_out = [(x, y) for (y, x) in routes_in]
>
>
>

-- 
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] passing multiple values from view to controller

2018-11-04 Thread Tribo Eila
Hi,

using the code below, i'm trying to pass multiple variable from view to 
controller... and simple print the two values or work some validation.

perhaps i'm missing something... need help

view:

[web2py] import data between table(I've been researching for a 2 week.)

2018-11-04 Thread Semih
I create two tables.

db = DAL('sqlite://storage.sqlite')
*db.define_table('maintable',*
*  Field('refcode',unique=True, 
requires=IS_NOT_IN_DB(db,'maintable.refcode') ),*
*  Field('description'))*

*db.define_table('secondtable',*
*Field('refcode','reference maintable', requires=IS_IN_DB(db, 
'maintable.refcode', '%(name)s')),*
*Field('Description', 'string'),*
*Field('quantity')*


*ı using inline grid for secondtable.*
*I choose 'refcode'.**and I want information from 'maintable'.By selecting 
the 'reference' the 'description'of the information coming automatically 
and entering the 'quantity'. ı want to save.*

*how can I do that.*
*Thank you in advance for your 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] Need to set a default application

2018-11-04 Thread Arindam Dasgupta
Hi ,

I have purchased a domain and whenever I enter "www.mydomain.com" the 
browser lands in the page : http://www.mydomain/welcome/default/index.

I want to change the default application , default controller and default 
view so that whenever someone enters www.mydomain.com then he lands in 
http://www.mydomain/myapp/mycontroller/myview.

I came to know from web that I should modify the file routes.py with the 
following :

default_application='AppName'
default_controller = "user"
default_function = "login"

But where do I find the file routes.py? 


Thanks in advance for your help.


BR//Arindam

-- 
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] ondelete attribute missing in 2.17.2

2018-11-04 Thread Ivan Gazzola
I've updated to 2.17.2-stable but i've got this error:

 invalid table "Prestazioni" attributes: set(['ondelete'])
invalid_kwargs  set(['ondelete'])
tablename 'Prestazioni'

My field is definied as:

Field('preventivo',db.Preventivi,requires=IS_EMPTY_OR(IS_IN_DB(db, 
'Preventivi.id'))),ondelete='SET NULL')

Is it changed pydal?

Regards


Ivan

-- 
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: Need to set a default application

2018-11-04 Thread Massimo Di Pierro
cp web2py/examples/routes.parametric.example.py web2py/routes.py

On Sunday, 4 November 2018 11:58:16 UTC-8, Arindam Dasgupta wrote:
>
> Hi ,
>
> I have purchased a domain and whenever I enter "www.mydomain.com" the 
> browser lands in the page : http://www.mydomain/welcome/default/index.
>
> I want to change the default application , default controller and default 
> view so that whenever someone enters www.mydomain.com then he lands in 
> http://www.mydomain/myapp/mycontroller/myview.
>
> I came to know from web that I should modify the file routes.py with the 
> following :
>
> default_application='AppName'
> default_controller = "user"
> default_function = "login"
>
> But where do I find the file routes.py? 
>
>
> Thanks in advance for your help.
>
>
> BR//Arindam
>

-- 
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: ondelete attribute missing in 2.17.2

2018-11-04 Thread Massimo Di Pierro
It has not changed. I think you have a typo

Field('preventivo',db.Preventivi,requires=IS_EMPTY_OR(IS_IN_DB(db, 
'Preventivi.id'))),ondelete='SET NULL')

should be

Field('preventivo',db.Preventivi,requires=IS_EMPTY_OR(IS_IN_DB(db, 
'Preventivi.id')),ondelete='SET NULL')



On Sunday, 4 November 2018 12:50:21 UTC-8, Ivan Gazzola wrote:
>
> I've updated to 2.17.2-stable from 2.16.1 but i've got this error:
>
>  invalid table "Prestazioni" attributes: set(['ondelete'])
> invalid_kwargs  set(['ondelete'])
> tablename 'Prestazioni'
>
> My field is definied as:
>
> Field('preventivo',db.Preventivi,requires=IS_EMPTY_OR(IS_IN_DB(db, 
> 'Preventivi.id'))),ondelete='SET NULL')
>
> Is it changed pydal?
>
> Regards
>
>
> Ivan
>
>

-- 
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: ondelete attribute missing in 2.17.2

2018-11-04 Thread Ivan Gazzola
Sorry, I've found typo and removed message but you've been faster :)
I don't know why but the previous wrong syntax worked without problems for 
months on the previous version ... 

Thx Massimo!



Il giorno domenica 4 novembre 2018 22:07:41 UTC+1, Massimo Di Pierro ha 
scritto:
>
> It has not changed. I think you have a typo
>
> Field('preventivo',db.Preventivi,requires=IS_EMPTY_OR(IS_IN_DB(db, 
> 'Preventivi.id'))),ondelete='SET NULL')
>
> should be
>
> Field('preventivo',db.Preventivi,requires=IS_EMPTY_OR(IS_IN_DB(db, 
> 'Preventivi.id')),ondelete='SET NULL')
>
>
>
> On Sunday, 4 November 2018 12:50:21 UTC-8, Ivan Gazzola wrote:
>>
>> I've updated to 2.17.2-stable from 2.16.1 but i've got this error:
>>
>>  invalid table "Prestazioni" attributes: set(['ondelete'])
>> invalid_kwargs  set(['ondelete'])
>> tablename 'Prestazioni'
>>
>> My field is definied as:
>>
>> Field('preventivo',db.Preventivi,requires=IS_EMPTY_OR(IS_IN_DB(db, 
>> 'Preventivi.id'))),ondelete='SET NULL')
>>
>> Is it changed pydal?
>>
>> Regards
>>
>>
>> Ivan
>>
>>

-- 
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: passing multiple values from view to controller

2018-11-04 Thread Dave S


On Sunday, November 4, 2018 at 7:43:18 AM UTC-8, Tribo Eila wrote:
>
> Hi,
>
> using the code below, i'm trying to pass multiple variable from view to 
> controller... and simple print the two values or work some validation.
>
> perhaps i'm missing something... need help
>
> view:
> 

[web2py] Re: off topic: pg_dump syntax for pythonanywhere

2018-11-04 Thread Alex Glaros
Alexandra, I have not used it recently and only have my notes below:

pg_dump 
--host=yourPythonAnywhereDbName.postgres.pythonanywhere-services.com  
--dbname=postgres_myDbName --(note: I don't know how to handle password) 
--port=10097 --username=yourPythonAnywhereRole --format=c 
--file=pg_alex_backup`date +%F-%H%M`.dump

-- 
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: json data breaks, via routing, to a web2py controller

2018-11-04 Thread Dave S


On Sunday, November 4, 2018 at 5:06:33 AM UTC-8, Carl Hunter Roach wrote:
>
> As suspected, my workaround was to URL encode the "offending" fields at 
> the client end. simpleton.loads() then parsed the json happily. The field 
> could then be "unencoded".
>
> My system has plenty of json passing between clients and the Web2py 
> service. I can't work out why I've tripped over here.
>
>
If that value is Base64 encoded, the "=" is a part of the encoding that is 
used for padding when the length of the original string doesn't fill the 
last set of encoding bytes (looking at WP for Base64,  len(S) % 4 != 0).

/dps
 

>
> On Saturday, 3 November 2018 19:04:20 UTC, Carl Hunter Roach wrote:
>>
>> I've had a stable web2py-based service for some years now.
>> But it broke today with a small change in a data value - that's my 
>> working hypothesis.
>>
>> The output of the print statement (see code below):
>>
>> > {'{"sort":"relevancy","longitude":-0.1228710438544765,"keywords":"parrot","latitude":51.51158325978085,"page_cursor":"A2ebAAFVVvv0OW53MHyzU0VWVVBxb0tiUW9oWkd0UHMzU09aUjIwYUFBPT0jMTA':
>>  
>> '"}'}>
>>
>>
>> The value of "page_cursor" sent by the caller is "page_cursor" : 
>> "A2ebAAFVVvv0OW53MHyzU0VWVVBxb0tiUW9oWkd0UHMzU09aUjIwYUFBPT0jMTA=' i.e. 
>> there is an "=" suffix. But by the time my controller receives the 
>> json structure the "=" has been mangled. This obviously defeats the 
>> simplejson loads function as the data is no longer valid json. Previous to 
>> today page_cursor values have been more straightforward and not included a 
>> "=" character and the code has executed fine.
>>
>> Any suggestions? A fix or a different approach to parsing 
>> request.post_vars
>>
>> The call is to: https://…/api/v1/article_search
>>
>> The code excerpts:
>>
>> app/controller.py
>>
>> @articles_service.json
>> def get_article():
>> from applications.app.modules.article import get_articles
>> print(request.post_vars)
>> return get_articles(request.post_vars)
>>
>> app/modules/article.py
>>
>> def get_articles(json_fields):
>> '''
>> get with a JSON interface
>> '''
>> from gluon.contrib.simplejson import loads
>> fields = {}
>> for i in json_fields.keys():
>> fields = loads(i) # crashes here.
>> return …
>>
>> routes.py
>>
>> routes_in = (  ('/api/v1/$anything', 
>> '/app/controller/call/json/$anything')  )
>> routes_out = [(x, y) for (y, x) in routes_in]
>>
>>
>>

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