[web2py] Re: Web3py

2019-06-14 Thread 黄祥

>
> Be careful that you can no longer change attributes everywhere you like as 
> in:
>
> db.tablename.fieldname.readable = False
>
> In web2py this is ok. In web3py this is not safe. Attributes must be 
> global. The state of fixtures must not be modified inside actions.
>

is it mean in controller not safe, but in on_define, safe or not ?
*e.g.*
*controller.py*
db.tablename.fieldname.readable = False # not safe in web3py
def test():
db.tablename.fieldname.readable = False # not safe in web3py

*models.py*
def on_define_tablename(table): 
table.fieldname.readable = False # safe or not ?
db.define_table('tablename', 
Field('fieldname'), 
on_define = on_define_tablename)

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/51987943-74b7-4fba-85be-6446e291874b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-06-14 Thread 黄祥

>
> *url* = 
> http://localhost:8000/_dashboard/dbadmin?app=test=db=address
> *result* = { "__class__": "lazyT", "kwargs": {}, "text": "Field 0", 
> "translator": { "__class__": "method" } }
> *expected result *= Field 0
> no error occured but the result is not expected
>

there's told about lazyT, so put it lazy (which work in web2py), but return 
an error on web3py
def on_define_address(table): 
table.street.label = T('Street', lazy = True)

Traceback (most recent call last):
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 614, in 
import_apps
module = importlib.machinery.SourceFileLoader(module_name, init).
load_module()
  File "", line 407, in 
_check_name_wrapper
  File "", line 907, in load_module
  File "", line 732, in load_module
  File "", line 265, in _load_module_shim
  File "", line 696, in _load
  File "", line 677, in _load_unlocked
  File "", line 728, in exec_module
  File "", line 219, in 
_call_with_frames_removed
  File "/Users/sugizo/learn/python/web3py/apps/test/__init__.py", line 1, in 

from .controllers.install import *
  File "/Users/sugizo/learn/python/web3py/apps/test/controllers/install.py", 
line 2, in 
from ..models.db_schema_1_address import *
  File 
"/Users/sugizo/learn/python/web3py/apps/test/models/db_schema_1_address.py", 
line 54, in 
format = lambda r: \
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/base.py"
, line 592, in define_table
table = self.lazy_define_table(tablename, *fields, **kwargs)
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/pydal/base.py"
, line 633, in lazy_define_table
on_define(table)
  File 
"/Users/sugizo/learn/python/web3py/apps/test/models/db_schema_1_address.py", 
line 8, in on_define_address
table.street.label = T('Street', lazy = True)
TypeError: __call__() got an unexpected keyword argument 'lazy'

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/73b730e3-7839-422f-8d2e-4a8e744ed239%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Datatables serverside JSON/Ajax

2019-06-14 Thread Jim Steil
Yes, you can search through multiple columns. I just happened to write the
sample on a table with one column. The key is in building the DAL query
properly.

Jim


On Fri, Jun 14, 2019, 6:13 PM Cristina Sig  wrote:

> @Jim
>
> I tried the app and it works!! but I have a question, is it possible to
> search through all the columns or has to be one at the time?
> Also, do you know if this server side method works on data bases with
> thousands of records or is it a bit slower?
>
> Thanks again!
>
> El viernes, 14 de junio de 2019, 13:16:32 (UTC-3), Jim S escribió:
>>
>> I've attached the 'packed' file of the app.
>>
>> The app:
>>
>> -uses your table setup (I took the uppercase characters out of your table
>> names - I'm not preaching, but in my experience you don't want to do this)
>> -puts some test data into the degree table
>> -added a page to list the degrees using datatables.net
>>
>> Modified files
>> -added DataTables directory to /static
>> -views/layout.html - added references to datatables css and javascript
>> files
>> -controllers/default - added degrees and _get_degrees methods
>> -created views/default/degrees.html
>>
>> To Run it
>> -Extract the code to your applications directory
>> -fire up web2py
>> -navigate to 127.0.0.1:8000/school/default/degrees
>>
>> You should see the list of degrees.  Paging should work and the search
>> filter should work.  I didn't add the 'click on the column heading to
>> sort', but you can do all of that as well.
>>
>> Let me know if you have any problems or questions.
>>
>> -Jim
>>
>>  web2py.app.school.w2p
>> 
>>
>>
>> On Fri, Jun 14, 2019 at 9:43 AM Cristina Sig  wrote:
>>
>>> Thank you @Jim. I will appreciate if you can share some example because
>>> I have been struggling with this for weeks and I'm really confused with
>>> ajax and server side.
>>>
>>> El viernes, 14 de junio de 2019, 9:39:14 (UTC-3), Jim S escribió:

 I believe you are confusing a couple things here.  The code you're
 using is trying to use a server-side data set, but the

 data:{{=results}},

 is using the results passed to the view as the data to display, not the
 data you're getting back from the ajax call.

 I'll try to make some time later this morning to build up a demo for
 you.  I've been working with datatables.net and web2py A LOT in the
 past few weeks and have some good working samples, but will need to tear
 some of it down to the bare essentials to make what I have more
 understandable.

 Gotta run but will get back to this in a few hours.

 -Jim


 On Thursday, June 13, 2019 at 6:19:18 PM UTC-5, Cristina Sig wrote:
>
> Thank you @John
> yes, I have been checking DT docs and it seems that I need to add that
> data, I tried it but the sorting and ordering is not working at all.
> Do you have any idea or example how to deal with that?
>
> El martes, 11 de junio de 2019, 9:43:14 (UTC-3), John Bannister
> escribió:
>>
>> @Leonel .. I think this will work well with client side but not
>> serverside datables but may be wrong.
>>
>> @Cristina:
>>
>> My understanding of serverside processing is that you will need to
>> have a few more items returned to datatables as outlined in the DT docs 
>> for
>> serverside processing.
>>
>> Your response to the request from DataTables should look something
>> like this for serverside processing:
>>
>> return dict(draw=sEcho, recordsTotal=iTotalRecords,
>> recordsFiltered=iTotalRecords, data=aaData)
>>
>> You will also need to move your sorting, filtering and ordering to
>> the server (which is a bit more complicated) but doable.
>>
>> As said I could be wrong.
>>
>> BR
>> John
>>
>>
>> On Tuesday, 11 June 2019 10:52:42 UTC+2, Leonel Câmara wrote:
>>>
>>> It's because you're not using the generic.json view and you're also
>>> not setting the response.headers content-type to json. I would simply
>>> change your function to this which will do everything for you:
>>>
>>> def manageCareer():
>>> rows = db((db.Career.faculty == db.Faculty.id)&(db.Career.degree
>>> == db.Degree.id)).select()
>>> return response.json({'results': rows})
>>>
>> --
>>> 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/CZtFA49nJ18/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web...@googlegroups.com.
>>> To view this 

Re: [web2py] Re: Datatables serverside JSON/Ajax

2019-06-14 Thread Cristina Sig
@Jim

I tried the app and it works!! but I have a question, is it possible to 
search through all the columns or has to be one at the time?
Also, do you know if this server side method works on data bases with 
thousands of records or is it a bit slower?

Thanks again!

El viernes, 14 de junio de 2019, 13:16:32 (UTC-3), Jim S escribió:
>
> I've attached the 'packed' file of the app.
>
> The app:
>
> -uses your table setup (I took the uppercase characters out of your table 
> names - I'm not preaching, but in my experience you don't want to do this)
> -puts some test data into the degree table
> -added a page to list the degrees using datatables.net
>
> Modified files
> -added DataTables directory to /static
> -views/layout.html - added references to datatables css and javascript 
> files
> -controllers/default - added degrees and _get_degrees methods
> -created views/default/degrees.html
>
> To Run it
> -Extract the code to your applications directory
> -fire up web2py
> -navigate to 127.0.0.1:8000/school/default/degrees
>
> You should see the list of degrees.  Paging should work and the search 
> filter should work.  I didn't add the 'click on the column heading to 
> sort', but you can do all of that as well.
>
> Let me know if you have any problems or questions.
>
> -Jim
>
>  web2py.app.school.w2p 
> 
>
>
> On Fri, Jun 14, 2019 at 9:43 AM Cristina Sig  > wrote:
>
>> Thank you @Jim. I will appreciate if you can share some example because I 
>> have been struggling with this for weeks and I'm really confused with ajax 
>> and server side.
>>
>> El viernes, 14 de junio de 2019, 9:39:14 (UTC-3), Jim S escribió:
>>>
>>> I believe you are confusing a couple things here.  The code you're using 
>>> is trying to use a server-side data set, but the 
>>>
>>> data:{{=results}},
>>>
>>> is using the results passed to the view as the data to display, not the 
>>> data you're getting back from the ajax call.
>>>
>>> I'll try to make some time later this morning to build up a demo for 
>>> you.  I've been working with datatables.net and web2py A LOT in the 
>>> past few weeks and have some good working samples, but will need to tear 
>>> some of it down to the bare essentials to make what I have more 
>>> understandable.
>>>
>>> Gotta run but will get back to this in a few hours.
>>>
>>> -Jim
>>>
>>>
>>> On Thursday, June 13, 2019 at 6:19:18 PM UTC-5, Cristina Sig wrote:

 Thank you @John 
 yes, I have been checking DT docs and it seems that I need to add that 
 data, I tried it but the sorting and ordering is not working at all. 
 Do you have any idea or example how to deal with that?

 El martes, 11 de junio de 2019, 9:43:14 (UTC-3), John Bannister 
 escribió:
>
> @Leonel .. I think this will work well with client side but not 
> serverside datables but may be wrong.
>
> @Cristina:
>
> My understanding of serverside processing is that you will need to 
> have a few more items returned to datatables as outlined in the DT docs 
> for 
> serverside processing.
>
> Your response to the request from DataTables should look something 
> like this for serverside processing:
>
> return dict(draw=sEcho, recordsTotal=iTotalRecords, 
> recordsFiltered=iTotalRecords, data=aaData)
>
> You will also need to move your sorting, filtering and ordering to the 
> server (which is a bit more complicated) but doable.
>
> As said I could be wrong.
>
> BR
> John
>
>
> On Tuesday, 11 June 2019 10:52:42 UTC+2, Leonel Câmara wrote:
>>
>> It's because you're not using the generic.json view and you're also 
>> not setting the response.headers content-type to json. I would simply 
>> change your function to this which will do everything for you:
>>
>> def manageCareer():
>> rows = db((db.Career.faculty == db.Faculty.id)&(db.Career.degree 
>> == db.Degree.id)).select()
>> return response.json({'results': rows}) 
>>
> -- 
>> 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/CZtFA49nJ18/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/7e0bcbc2-6f9e-499d-bef5-dee93fd6370f%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit 

[web2py] Function for checking payments and arrears in DB needed

2019-06-14 Thread dirman
I need a function to manage payment by installment and when fee is fully 
paid

db.define_table('payment_type',
Field('category'),
Field('amount', 'double'),format='%(category)s %(amount)s')

db.define_table('fee',
Field('name', 'reference students'),
Field('category', 'reference payment_type'),
Field('payment_date', 'date'),
Field('arrears', 'double'),
Field('installment', 'double'))

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/ebb499c1-8246-41f8-b60a-82a6278ebe8d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Upgrading from 2.08 to 2.18.5

2019-06-14 Thread Jim Gregory
OK, I installed the current version of web2py on my laptop and copied over 
the 'init' application and a 'blog' application.  I've launched the test 
server and opened the blog app in my browser.  

The main problem I'm having now is URL rewriting.  Here's routes.py in my 
blog app:

default_controller = 'default'  # ordinarily set in app-specific routes.py
default_function = 'index'  # ordinarily set in app-specific routes.py
#
routes_in = (
('/blog/category/$anything', '/blog/default/tag/$anything'),
('/blog/static/$anything', '/blog/static/$anything'),
('/blog', '/blog/default/index'),
('/blog/$anything', '/blog/default/post/$anything'),
)
routes_out = [(y,x) for (x,y) in routes_in]

And here's the index template of the blog:

{{ response.files.append(URL('static/css/blog.css')) }}
{{extend '../../init/views/layout.html'}}
Latest Blog Posts:
{{ for post in posts: }}

{{ =post.title 
}}
{{ if post.thumbnail: }}

{{ pass }}

{{ =post.meta_description }} 
More 


{{ pass }}

On the old version of my blog, I would get relative URLs 
'/blog/', but now I'm getting '/blog/default/'.   
SImilar behavior is occurring in the top-level navigation.  Has routing 
behavior changed?

On Wednesday, June 12, 2019 at 3:13:38 PM UTC-5, Jim Gregory wrote:
>
> I will be moving a legacy application from my old shared host to a new 
> VPS, and would like to upgrade web2py at the same time from 2.08 to the 
> current version (2.18.5).  How should I go about doing this?  What changes 
> will I need to make?  I'm satisfied for now with the currently layout 
> (which uses Bootstrap 2), so I don't want to change it if I don't need to.  
> TIA.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f33e4d33-c45a-42c0-90b0-ff20ed2369bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: 2 domains for 2 apps on 1 web2p

2019-06-14 Thread Jim Steil
Glad to help, this is the only way I know manage the routing, I'd forgotten
about the routes_in.

-Jim

On Fri, Jun 14, 2019 at 2:05 PM Eliezer (Vlad) Tseytkin <
westgate6...@gmail.com> wrote:

> Oops I didn't know that domains can be there!
> Thank you!!
>
> On Fri, Jun 14, 2019, 3:02 PM Jim S  wrote:
>
>> My production routes.py has this in it:
>>
>> routers = dict(BASE=dict(domains={'www.domain1.com': 'app1',
>>   'www.domain2.com': 'app2'}))
>>
>>
>>
>> -Jim
>>
>>
>> On Friday, June 14, 2019 at 1:47:22 PM UTC-5, Vlad wrote:
>>>
>>> let me be a bit more specific, as my problem is apparently in missing
>>> something very basic:
>>>
>>> here is a quote from PythonAnywhere docs: "...for each additional domain
>>> name, you need to set up another PythonAnywhere web app from the web tab.
>>> This time though, you should choose "manual configuration". Then, go and
>>> edit your WSGI file. You should make it into a copy of the WSGI file for
>>> the first web2py application, so that both domains point at the same web2py
>>> installation. Then the web2py routes.py should work."
>>>
>>> So this is perfect, and routes.py works indeed. However, it doesn't work
>>> fully for the root domains:
>>>
>>> routes.py can only have only entry corresponding to "/", for example:
>>>
>>> routes_in = (
>>>( '/' ,' /app1/cont1/func1'),
>>>
>>>  )
>>>
>>> This will take care of www.domain1.com .
>>>
>>> Now, if I want to point www.domain2.com to /app2/conf2/func2 - I have
>>> no way to handle this (unless I am missing something very basic here). I
>>> would at least need to specify something like this:
>>>  ( '/app2', '/app2/conf2/func2' ) which will take care of
>>> www.domain2.com/app2 but the root www.domain2.com will still be
>>> redirecting to /app1/cont1/func1, as per the only "/" entry in routes.py,
>>> as "/" doesn't distinguish between domains.
>>>
>>> What am I missing? How can I handle this properly??
>>>
>>> On Friday, June 14, 2019 at 2:23:21 PM UTC-4, Vlad wrote:

 I've had multiple apps in one web2py with no problems, of course, but
 only up to the point I've assigned different domains to different apps

 I am on PythonAnywhere, but presumably it's the same issue on any
 hosting.

 I am giving 2 cnames for 2 apps, and I pointed both cnames properly.
 BUT only one domain works for bare domain - i.e. for www.domain1.com .
 For the second name I always have to specify the full path  -
 www.domain2.com//app/cont/func.

 I am obviously missing something, but here is why I have this problem:

 they all share one routes.py on the web2py root level. routes.py can
 only have one entry corresponding to "/" - I can point "/" to
 app1/cont1/func1. So, www.domain2.com can't be handled without a/c/f ,
 because no matter what the domain is, the only proper entry for the bare
 domain name is "/" in routes.py.

 How to handle this properly, i.e. to specify routing for each domain
 root - without having the 2nd web2py installation?



 --
>> 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/GKiH_-0K8d8/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/4e86e650-c228-496d-b0da-4eb0cb96ef45%40googlegroups.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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/GKiH_-0K8d8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CABZ%2BKCDPP0ATfYBmOVwMDRYuN6LVpUfHbiyn3%2BZQtX0OPAGRKQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- 

Re: [web2py] Re: 2 domains for 2 apps on 1 web2p

2019-06-14 Thread Eliezer (Vlad) Tseytkin
Oops I didn't know that domains can be there!
Thank you!!

On Fri, Jun 14, 2019, 3:02 PM Jim S  wrote:

> My production routes.py has this in it:
>
> routers = dict(BASE=dict(domains={'www.domain1.com': 'app1',
>   'www.domain2.com': 'app2'}))
>
>
>
> -Jim
>
>
> On Friday, June 14, 2019 at 1:47:22 PM UTC-5, Vlad wrote:
>>
>> let me be a bit more specific, as my problem is apparently in missing
>> something very basic:
>>
>> here is a quote from PythonAnywhere docs: "...for each additional domain
>> name, you need to set up another PythonAnywhere web app from the web tab.
>> This time though, you should choose "manual configuration". Then, go and
>> edit your WSGI file. You should make it into a copy of the WSGI file for
>> the first web2py application, so that both domains point at the same web2py
>> installation. Then the web2py routes.py should work."
>>
>> So this is perfect, and routes.py works indeed. However, it doesn't work
>> fully for the root domains:
>>
>> routes.py can only have only entry corresponding to "/", for example:
>>
>> routes_in = (
>>( '/' ,' /app1/cont1/func1'),
>>
>>  )
>>
>> This will take care of www.domain1.com .
>>
>> Now, if I want to point www.domain2.com to /app2/conf2/func2 - I have no
>> way to handle this (unless I am missing something very basic here). I would
>> at least need to specify something like this:
>>  ( '/app2', '/app2/conf2/func2' ) which will take care of
>> www.domain2.com/app2 but the root www.domain2.com will still be
>> redirecting to /app1/cont1/func1, as per the only "/" entry in routes.py,
>> as "/" doesn't distinguish between domains.
>>
>> What am I missing? How can I handle this properly??
>>
>> On Friday, June 14, 2019 at 2:23:21 PM UTC-4, Vlad wrote:
>>>
>>> I've had multiple apps in one web2py with no problems, of course, but
>>> only up to the point I've assigned different domains to different apps
>>>
>>> I am on PythonAnywhere, but presumably it's the same issue on any
>>> hosting.
>>>
>>> I am giving 2 cnames for 2 apps, and I pointed both cnames properly. BUT
>>> only one domain works for bare domain - i.e. for www.domain1.com . For
>>> the second name I always have to specify the full path  -
>>> www.domain2.com//app/cont/func.
>>>
>>> I am obviously missing something, but here is why I have this problem:
>>>
>>> they all share one routes.py on the web2py root level. routes.py can
>>> only have one entry corresponding to "/" - I can point "/" to
>>> app1/cont1/func1. So, www.domain2.com can't be handled without a/c/f ,
>>> because no matter what the domain is, the only proper entry for the bare
>>> domain name is "/" in routes.py.
>>>
>>> How to handle this properly, i.e. to specify routing for each domain
>>> root - without having the 2nd web2py installation?
>>>
>>>
>>>
>>> --
> 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/GKiH_-0K8d8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/4e86e650-c228-496d-b0da-4eb0cb96ef45%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCDPP0ATfYBmOVwMDRYuN6LVpUfHbiyn3%2BZQtX0OPAGRKQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: 2 domains for 2 apps on 1 web2p

2019-06-14 Thread Jim S
My production routes.py has this in it:

routers = dict(BASE=dict(domains={'www.domain1.com': 'app1',
  'www.domain2.com': 'app2'}))



-Jim


On Friday, June 14, 2019 at 1:47:22 PM UTC-5, Vlad wrote:
>
> let me be a bit more specific, as my problem is apparently in missing 
> something very basic:
>
> here is a quote from PythonAnywhere docs: "...for each additional domain 
> name, you need to set up another PythonAnywhere web app from the web tab. 
> This time though, you should choose "manual configuration". Then, go and 
> edit your WSGI file. You should make it into a copy of the WSGI file for 
> the first web2py application, so that both domains point at the same web2py 
> installation. Then the web2py routes.py should work."
>
> So this is perfect, and routes.py works indeed. However, it doesn't work 
> fully for the root domains: 
>
> routes.py can only have only entry corresponding to "/", for example: 
>
> routes_in = (
>( '/' ,' /app1/cont1/func1'),  
>  
>  )
>
> This will take care of www.domain1.com .
>
> Now, if I want to point www.domain2.com to /app2/conf2/func2 - I have no 
> way to handle this (unless I am missing something very basic here). I would 
> at least need to specify something like this:
>  ( '/app2', '/app2/conf2/func2' ) which will take care of 
> www.domain2.com/app2 but the root www.domain2.com will still be 
> redirecting to /app1/cont1/func1, as per the only "/" entry in routes.py, 
> as "/" doesn't distinguish between domains. 
>
> What am I missing? How can I handle this properly?? 
>
> On Friday, June 14, 2019 at 2:23:21 PM UTC-4, Vlad wrote:
>>
>> I've had multiple apps in one web2py with no problems, of course, but 
>> only up to the point I've assigned different domains to different apps 
>>
>> I am on PythonAnywhere, but presumably it's the same issue on any 
>> hosting. 
>>
>> I am giving 2 cnames for 2 apps, and I pointed both cnames properly. BUT 
>> only one domain works for bare domain - i.e. for www.domain1.com . For 
>> the second name I always have to specify the full path  -
>> www.domain2.com//app/cont/func.
>>
>> I am obviously missing something, but here is why I have this problem: 
>>
>> they all share one routes.py on the web2py root level. routes.py can only 
>> have one entry corresponding to "/" - I can point "/" to app1/cont1/func1. 
>> So, www.domain2.com can't be handled without a/c/f , because no matter 
>> what the domain is, the only proper entry for the bare domain name is "/" 
>> in routes.py.
>>
>> How to handle this properly, i.e. to specify routing for each domain root 
>> - without having the 2nd web2py installation?
>>
>>
>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/4e86e650-c228-496d-b0da-4eb0cb96ef45%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: 2 domains for 2 apps on 1 web2p

2019-06-14 Thread Vlad
let me be a bit more specific, as my problem is apparently in missing 
something very basic:

here is a quote from PythonAnywhere docs: "...for each additional domain 
name, you need to set up another PythonAnywhere web app from the web tab. 
This time though, you should choose "manual configuration". Then, go and 
edit your WSGI file. You should make it into a copy of the WSGI file for 
the first web2py application, so that both domains point at the same web2py 
installation. Then the web2py routes.py should work."

So this is perfect, and routes.py works indeed. However, it doesn't work 
fully for the root domains: 

routes.py can only have only entry corresponding to "/", for example: 

routes_in = (
   ( '/' ,' /app1/cont1/func1'),
   
 )

This will take care of www.domain1.com .

Now, if I want to point www.domain2.com to /app2/conf2/func2 - I have no 
way to handle this (unless I am missing something very basic here). I would 
at least need to specify something like this:
 ( '/app2', '/app2/conf2/func2' ) which will take care of 
www.domain2.com/app2 but the root www.domain2.com will still be redirecting 
to /app1/cont1/func1, as per the only "/" entry in routes.py, as "/" 
doesn't distinguish between domains. 

What am I missing? How can I handle this properly?? 

On Friday, June 14, 2019 at 2:23:21 PM UTC-4, Vlad wrote:
>
> I've had multiple apps in one web2py with no problems, of course, but only 
> up to the point I've assigned different domains to different apps 
>
> I am on PythonAnywhere, but presumably it's the same issue on any hosting. 
>
> I am giving 2 cnames for 2 apps, and I pointed both cnames properly. BUT 
> only one domain works for bare domain - i.e. for www.domain1.com . For 
> the second name I always have to specify the full path  -
> www.domain2.com//app/cont/func.
>
> I am obviously missing something, but here is why I have this problem: 
>
> they all share one routes.py on the web2py root level. routes.py can only 
> have one entry corresponding to "/" - I can point "/" to app1/cont1/func1. 
> So, www.domain2.com can't be handled without a/c/f , because no matter 
> what the domain is, the only proper entry for the bare domain name is "/" 
> in routes.py.
>
> How to handle this properly, i.e. to specify routing for each domain root 
> - without having the 2nd web2py installation?
>
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/3da3ff6e-c29d-4a8e-a235-1b18c6df4cbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] 2 domains for 2 apps on 1 web2p

2019-06-14 Thread Vlad
I've had multiple apps in one web2py with no problems, of course, but only 
up to the point I've assigned different domains to different apps 

I am on PythonAnywhere, but presumably it's the same issue on any hosting. 

I am giving 2 cnames for 2 apps, and I pointed both cnames properly. BUT 
only one domain works for bare domain - i.e. for www.domain1.com . For the 
second name I always have to specify the full path  
-www.domain2.com//app/cont/func.

I am obviously missing something, but here is why I have this problem: 

they all share one routes.py on the web2py root level. routes.py can only 
have one entry corresponding to "/" - I can point "/" to app1/cont1/func1. 
So, www.domain2.com can't be handled without a/c/f , because no matter what 
the domain is, the only proper entry for the bare domain name is "/" in 
routes.py.

How to handle this properly, i.e. to specify routing for each domain root - 
without having the 2nd web2py installation?



-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/86a1e4b8-90df-4a81-b554-478d193bbaea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Datatables serverside JSON/Ajax

2019-06-14 Thread Cristina Sig
Thank you @Jim, I will test it out this evening and let you know if I have 
any questions or doubts about it :)

El viernes, 14 de junio de 2019, 13:16:32 (UTC-3), Jim S escribió:
>
> I've attached the 'packed' file of the app.
>
> The app:
>
> -uses your table setup (I took the uppercase characters out of your table 
> names - I'm not preaching, but in my experience you don't want to do this)
> -puts some test data into the degree table
> -added a page to list the degrees using datatables.net
>
> Modified files
> -added DataTables directory to /static
> -views/layout.html - added references to datatables css and javascript 
> files
> -controllers/default - added degrees and _get_degrees methods
> -created views/default/degrees.html
>
> To Run it
> -Extract the code to your applications directory
> -fire up web2py
> -navigate to 127.0.0.1:8000/school/default/degrees
>
> You should see the list of degrees.  Paging should work and the search 
> filter should work.  I didn't add the 'click on the column heading to 
> sort', but you can do all of that as well.
>
> Let me know if you have any problems or questions.
>
> -Jim
>
>  web2py.app.school.w2p 
> 
>
>
> On Fri, Jun 14, 2019 at 9:43 AM Cristina Sig  > wrote:
>
>> Thank you @Jim. I will appreciate if you can share some example because I 
>> have been struggling with this for weeks and I'm really confused with ajax 
>> and server side.
>>
>> El viernes, 14 de junio de 2019, 9:39:14 (UTC-3), Jim S escribió:
>>>
>>> I believe you are confusing a couple things here.  The code you're using 
>>> is trying to use a server-side data set, but the 
>>>
>>> data:{{=results}},
>>>
>>> is using the results passed to the view as the data to display, not the 
>>> data you're getting back from the ajax call.
>>>
>>> I'll try to make some time later this morning to build up a demo for 
>>> you.  I've been working with datatables.net and web2py A LOT in the 
>>> past few weeks and have some good working samples, but will need to tear 
>>> some of it down to the bare essentials to make what I have more 
>>> understandable.
>>>
>>> Gotta run but will get back to this in a few hours.
>>>
>>> -Jim
>>>
>>>
>>> On Thursday, June 13, 2019 at 6:19:18 PM UTC-5, Cristina Sig wrote:

 Thank you @John 
 yes, I have been checking DT docs and it seems that I need to add that 
 data, I tried it but the sorting and ordering is not working at all. 
 Do you have any idea or example how to deal with that?

 El martes, 11 de junio de 2019, 9:43:14 (UTC-3), John Bannister 
 escribió:
>
> @Leonel .. I think this will work well with client side but not 
> serverside datables but may be wrong.
>
> @Cristina:
>
> My understanding of serverside processing is that you will need to 
> have a few more items returned to datatables as outlined in the DT docs 
> for 
> serverside processing.
>
> Your response to the request from DataTables should look something 
> like this for serverside processing:
>
> return dict(draw=sEcho, recordsTotal=iTotalRecords, 
> recordsFiltered=iTotalRecords, data=aaData)
>
> You will also need to move your sorting, filtering and ordering to the 
> server (which is a bit more complicated) but doable.
>
> As said I could be wrong.
>
> BR
> John
>
>
> On Tuesday, 11 June 2019 10:52:42 UTC+2, Leonel Câmara wrote:
>>
>> It's because you're not using the generic.json view and you're also 
>> not setting the response.headers content-type to json. I would simply 
>> change your function to this which will do everything for you:
>>
>> def manageCareer():
>> rows = db((db.Career.faculty == db.Faculty.id)&(db.Career.degree 
>> == db.Degree.id)).select()
>> return response.json({'results': rows}) 
>>
> -- 
>> 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/CZtFA49nJ18/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/7e0bcbc2-6f9e-499d-bef5-dee93fd6370f%40googlegroups.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)
- 

Re: [web2py] Re: Datatables serverside JSON/Ajax

2019-06-14 Thread Jim Steil
I've attached the 'packed' file of the app.

The app:

-uses your table setup (I took the uppercase characters out of your table
names - I'm not preaching, but in my experience you don't want to do this)
-puts some test data into the degree table
-added a page to list the degrees using datatables.net

Modified files
-added DataTables directory to /static
-views/layout.html - added references to datatables css and javascript files
-controllers/default - added degrees and _get_degrees methods
-created views/default/degrees.html

To Run it
-Extract the code to your applications directory
-fire up web2py
-navigate to 127.0.0.1:8000/school/default/degrees

You should see the list of degrees.  Paging should work and the search
filter should work.  I didn't add the 'click on the column heading to
sort', but you can do all of that as well.

Let me know if you have any problems or questions.

-Jim

 web2py.app.school.w2p



On Fri, Jun 14, 2019 at 9:43 AM Cristina Sig  wrote:

> Thank you @Jim. I will appreciate if you can share some example because I
> have been struggling with this for weeks and I'm really confused with ajax
> and server side.
>
> El viernes, 14 de junio de 2019, 9:39:14 (UTC-3), Jim S escribió:
>>
>> I believe you are confusing a couple things here.  The code you're using
>> is trying to use a server-side data set, but the
>>
>> data:{{=results}},
>>
>> is using the results passed to the view as the data to display, not the
>> data you're getting back from the ajax call.
>>
>> I'll try to make some time later this morning to build up a demo for
>> you.  I've been working with datatables.net and web2py A LOT in the past
>> few weeks and have some good working samples, but will need to tear some of
>> it down to the bare essentials to make what I have more understandable.
>>
>> Gotta run but will get back to this in a few hours.
>>
>> -Jim
>>
>>
>> On Thursday, June 13, 2019 at 6:19:18 PM UTC-5, Cristina Sig wrote:
>>>
>>> Thank you @John
>>> yes, I have been checking DT docs and it seems that I need to add that
>>> data, I tried it but the sorting and ordering is not working at all.
>>> Do you have any idea or example how to deal with that?
>>>
>>> El martes, 11 de junio de 2019, 9:43:14 (UTC-3), John Bannister escribió:

 @Leonel .. I think this will work well with client side but not
 serverside datables but may be wrong.

 @Cristina:

 My understanding of serverside processing is that you will need to have
 a few more items returned to datatables as outlined in the DT docs for
 serverside processing.

 Your response to the request from DataTables should look something like
 this for serverside processing:

 return dict(draw=sEcho, recordsTotal=iTotalRecords,
 recordsFiltered=iTotalRecords, data=aaData)

 You will also need to move your sorting, filtering and ordering to the
 server (which is a bit more complicated) but doable.

 As said I could be wrong.

 BR
 John


 On Tuesday, 11 June 2019 10:52:42 UTC+2, Leonel Câmara wrote:
>
> It's because you're not using the generic.json view and you're also
> not setting the response.headers content-type to json. I would simply
> change your function to this which will do everything for you:
>
> def manageCareer():
> rows = db((db.Career.faculty == db.Faculty.id)&(db.Career.degree
> == db.Degree.id)).select()
> return response.json({'results': rows})
>
 --
> 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/CZtFA49nJ18/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/7e0bcbc2-6f9e-499d-bef5-dee93fd6370f%40googlegroups.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.
To view this discussion on the web visit 

Re: [web2py] Web2py Windows edition with 3.x Interpreter

2019-06-14 Thread rāma
Hi Dave,

Nico is right here. I used pip to pre-package modules for easier 
distribution. Not really a DLL but works. The only downside is that 
distributing the app can be really large.

On Friday, 14 June 2019 00:31:50 UTC+8, Dave S wrote:
>
>
>
> On Monday, April 29, 2019 at 8:15:09 PM UTC-7, rāma wrote:
>>
>> Hi Nico,
>>
>> Thanks for your inputs.
>>
>> I've actually run windows py2.7 binary with modules within site-packages, 
>> and pip can be leveraged by setting your target folder like this: 
>>
>> pip install -t site-packages 
>>
>> for the benefit of other readers. It's just that pandas didn't quite work 
>> for me in py2.7 and ported my code to python 3.5+.
>>
>>>
  
> Hi, rāma --
>
> I'm interested in how you got pip installed with python as a DLL.  I want 
> to play around with Pillow.
>
> /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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0f8e4cda-ee00-4529-bdb5-a79b7bcd2c7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Datatables serverside JSON/Ajax

2019-06-14 Thread Cristina Sig
Thank you @Jim. I will appreciate if you can share some example because I 
have been struggling with this for weeks and I'm really confused with ajax 
and server side.

El viernes, 14 de junio de 2019, 9:39:14 (UTC-3), Jim S escribió:
>
> I believe you are confusing a couple things here.  The code you're using 
> is trying to use a server-side data set, but the 
>
> data:{{=results}},
>
> is using the results passed to the view as the data to display, not the 
> data you're getting back from the ajax call.
>
> I'll try to make some time later this morning to build up a demo for you.  
> I've been working with datatables.net and web2py A LOT in the past few 
> weeks and have some good working samples, but will need to tear some of it 
> down to the bare essentials to make what I have more understandable.
>
> Gotta run but will get back to this in a few hours.
>
> -Jim
>
>
> On Thursday, June 13, 2019 at 6:19:18 PM UTC-5, Cristina Sig wrote:
>>
>> Thank you @John 
>> yes, I have been checking DT docs and it seems that I need to add that 
>> data, I tried it but the sorting and ordering is not working at all. 
>> Do you have any idea or example how to deal with that?
>>
>> El martes, 11 de junio de 2019, 9:43:14 (UTC-3), John Bannister escribió:
>>>
>>> @Leonel .. I think this will work well with client side but not 
>>> serverside datables but may be wrong.
>>>
>>> @Cristina:
>>>
>>> My understanding of serverside processing is that you will need to have 
>>> a few more items returned to datatables as outlined in the DT docs for 
>>> serverside processing.
>>>
>>> Your response to the request from DataTables should look something like 
>>> this for serverside processing:
>>>
>>> return dict(draw=sEcho, recordsTotal=iTotalRecords, 
>>> recordsFiltered=iTotalRecords, data=aaData)
>>>
>>> You will also need to move your sorting, filtering and ordering to the 
>>> server (which is a bit more complicated) but doable.
>>>
>>> As said I could be wrong.
>>>
>>> BR
>>> John
>>>
>>>
>>> On Tuesday, 11 June 2019 10:52:42 UTC+2, Leonel Câmara wrote:

 It's because you're not using the generic.json view and you're also not 
 setting the response.headers content-type to json. I would simply change 
 your function to this which will do everything for you:

 def manageCareer():
 rows = db((db.Career.faculty == db.Faculty.id)&(db.Career.degree 
 == db.Degree.id)).select()
 return response.json({'results': rows}) 

>>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7e0bcbc2-6f9e-499d-bef5-dee93fd6370f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Web3py FORM referenced fields

2019-06-14 Thread Massimo Di Pierro
Thanks. That clarifies. Will fix later today.

On Wednesday, 12 June 2019 23:25:26 UTC-7, John Bannister wrote:
>
> Hi Massimo,
>
>  
>
> Issue is not the dropdown for referenced fields on an Add rec as  that 
> works fine. Issue is when you want to edit a record with a referenced field 
> so 
>
>  
>
> form=Form(db.order, record=id)
>
>  
>
> Referenced field is blank (although dropdown is available). All other 
> fields are populated with db values.
>
>  
>
> BR
>
> John
>
>  
>
>  
>
>  
>
> *From:* web2py@googlegroups.com [mailto:web2py@googlegroups.com] *On 
> Behalf Of *Massimo Di Pierro
> *Sent:* 13 June 2019 05:09
> *To:* web2py-users
> *Subject:* [web2py] Re: Web3py FORM referenced fields
>
>  
>
> I added an example that works for me.
>
> Maybe can help you debug the problem:
>
>  
>
> http://127.0.0.1:8000/examples/dbform2
>
>
> On Wednesday, 12 June 2019 04:02:18 UTC-7, John Bannister wrote:
>
> Hi All,
>
>  
>
> Does anyone have a working example of web3py Form using referenced fields?
>
>  
>
> I have created the standard person / pets tables with pets referencing 
> person as 'reference person' in the table definition.
>
>  
>
> Using form=Form(db.pet) I get the dropdown of persons for the add no 
> worries but on the form=Form(db.pet, record=id) for the edit form .. 
> neither the id of the person or the persons name (format='%(name)s' is 
> displayed even though I can still select from the dropdown list. The id is 
> definately stored in the db.
>
>  
>
> BR
>
> John
>
>  
>
>  
>
>  
>
>  
>
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/web2py/d40dcdf9-96c9-43a3-a9ab-d1c3090c7ed1%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0973acf7-c76b-4c8e-a5a3-4db3775e96b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-06-14 Thread Massimo Di Pierro
Try replace cache with 

cache2  = lambda key, f, expiration: cache.get(key,f, expiration)
cache_db = (cache2, cache_time_expire)

On Friday, 14 June 2019 03:32:53 UTC-7, 黄祥 wrote:
>
> cache on select not work, modify apps/todo/api, cacheable=True is work 
> without defining cache
> *apps/todo/__init__.py*
> @action('api')  # a GET API function
> @action.uses(db)# all before starting a db connection
> def todo():
> cache_time_expire = 10
> cache_db = (cache, cache_time_expire)
> return dict(items=db(db.todo).select(orderby=~db.todo.id, cache=
> cache_db, cacheable=True).as_list())
>
> ERROR:root:Traceback (most recent call last):
>   File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 413, in 
> wrapper
> ret = func(*func_args, **func_kwargs)
>   File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 379, in 
> wrapper
> ret = func(*args, **kwargs)
>   File "/Users/sugizo/learn/python/web3py/apps/todo/__init__.py", line 31, 
> in todo
> return dict(items=db(db.todo).select(orderby=~db.todo.id, cache=
> cache_db, cacheable=True).as_list())
>   File 
> "/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/objects.py"
> , line 2395, in select
> return adapter.select(self.query, fields, attributes)
>   File 
> "/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/adapters/sqlite.py"
> , line 82, in select
> return super(SQLite, self).select(query, fields, attributes)
>   File 
> "/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/adapters/base.py"
> , line 762, in select
> cache, sql, fields, attributes, colnames)
>   File 
> "/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/adapters/base.py"
> , line 753, in _cached_select
> time_expire)
> TypeError: 'Cache' object is not callable
>
> *apps/todo/__init__.py*
> @action('api')  # a GET API function
> @action.uses(db)# all before starting a db connection
> def todo():
> cache_time_expire = 10
> cache_db = (cache.memoize(expiration=5), cache_time_expire)
> return dict(items=db(db.todo).select(orderby=~db.todo.id, cache=
> cache_db, cacheable=True).as_list())
>
> ERROR:root:Traceback (most recent call last):
>   File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 413, in 
> wrapper
> ret = func(*func_args, **func_kwargs)
>   File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 379, in 
> wrapper
> ret = func(*args, **kwargs)
>   File "/Users/sugizo/learn/python/web3py/apps/todo/__init__.py", line 31, 
> in todo
> return dict(items=db(db.todo).select(orderby=~db.todo.id, cache=
> cache_db, cacheable=True).as_list())
>   File 
> "/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/objects.py"
> , line 2395, in select
> return adapter.select(self.query, fields, attributes)
>   File 
> "/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/adapters/sqlite.py"
> , line 82, in select
> return super(SQLite, self).select(query, fields, attributes)
>   File 
> "/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/adapters/base.py"
> , line 762, in select
> cache, sql, fields, attributes, colnames)
>   File 
> "/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/adapters/base.py"
> , line 753, in _cached_select
> time_expire)
> TypeError: decorator() takes 1 positional argument but 3 were given
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/161d0f94-8d18-46a5-9445-0cb072dd42c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-06-14 Thread Massimo Di Pierro
Be careful that you can no longer change attributes everywhere you like as 
in:

db.tablename.fieldname.readable = False

In web2py this is ok. In web3py this is not safe. Attributes must be 
global. The state of fixtures must not be modified inside actions.

On Thursday, 13 June 2019 17:57:49 UTC-7, 黄祥 wrote:
>
> tryin to move define_tables from web2py to web3py, run well just a few 
> note about field constuctor, (related with ui, FORM and T) :
> - comment : run well, but if you  not use bootstrap, then it's should be 
> modified (e.g. _class or function modal in boostrap)
> - represent : run well, but if you  not use bootstrap, then it's should be 
> modified (e.g. _class)
> - widget : not sure how to use it using FORM(), since the book only 
> written using SQLFOrm(), perhaps some guidance
> - labels : run well, but if using T(), the result is not expected when 
> editing in _dashboard (database), detail in previous msg
>
> just tests the models part, not yet using any controllers
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f43f434a-0d75-469e-81c5-6b2de10276bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Datatables serverside JSON/Ajax

2019-06-14 Thread Jim S
I believe you are confusing a couple things here.  The code you're using is 
trying to use a server-side data set, but the 

data:{{=results}},

is using the results passed to the view as the data to display, not the 
data you're getting back from the ajax call.

I'll try to make some time later this morning to build up a demo for you.  
I've been working with datatables.net and web2py A LOT in the past few 
weeks and have some good working samples, but will need to tear some of it 
down to the bare essentials to make what I have more understandable.

Gotta run but will get back to this in a few hours.

-Jim


On Thursday, June 13, 2019 at 6:19:18 PM UTC-5, Cristina Sig wrote:
>
> Thank you @John 
> yes, I have been checking DT docs and it seems that I need to add that 
> data, I tried it but the sorting and ordering is not working at all. 
> Do you have any idea or example how to deal with that?
>
> El martes, 11 de junio de 2019, 9:43:14 (UTC-3), John Bannister escribió:
>>
>> @Leonel .. I think this will work well with client side but not 
>> serverside datables but may be wrong.
>>
>> @Cristina:
>>
>> My understanding of serverside processing is that you will need to have a 
>> few more items returned to datatables as outlined in the DT docs for 
>> serverside processing.
>>
>> Your response to the request from DataTables should look something like 
>> this for serverside processing:
>>
>> return dict(draw=sEcho, recordsTotal=iTotalRecords, 
>> recordsFiltered=iTotalRecords, data=aaData)
>>
>> You will also need to move your sorting, filtering and ordering to the 
>> server (which is a bit more complicated) but doable.
>>
>> As said I could be wrong.
>>
>> BR
>> John
>>
>>
>> On Tuesday, 11 June 2019 10:52:42 UTC+2, Leonel Câmara wrote:
>>>
>>> It's because you're not using the generic.json view and you're also not 
>>> setting the response.headers content-type to json. I would simply change 
>>> your function to this which will do everything for you:
>>>
>>> def manageCareer():
>>> rows = db((db.Career.faculty == db.Faculty.id)&(db.Career.degree == 
>>> db.Degree.id)).select()
>>> return response.json({'results': rows}) 
>>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/29806e98-d952-4774-b679-4771f848e9fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-06-14 Thread 黄祥
cache on select not work, modify apps/todo/api, cacheable=True is work 
without defining cache
*apps/todo/__init__.py*
@action('api')  # a GET API function
@action.uses(db)# all before starting a db connection
def todo():
cache_time_expire = 10
cache_db = (cache, cache_time_expire)
return dict(items=db(db.todo).select(orderby=~db.todo.id, cache=cache_db
, cacheable=True).as_list())

ERROR:root:Traceback (most recent call last):
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 413, in 
wrapper
ret = func(*func_args, **func_kwargs)
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 379, in 
wrapper
ret = func(*args, **kwargs)
  File "/Users/sugizo/learn/python/web3py/apps/todo/__init__.py", line 31, 
in todo
return dict(items=db(db.todo).select(orderby=~db.todo.id, cache=cache_db
, cacheable=True).as_list())
  File 
"/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/objects.py"
, line 2395, in select
return adapter.select(self.query, fields, attributes)
  File 
"/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/adapters/sqlite.py"
, line 82, in select
return super(SQLite, self).select(query, fields, attributes)
  File 
"/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/adapters/base.py"
, line 762, in select
cache, sql, fields, attributes, colnames)
  File 
"/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/adapters/base.py"
, line 753, in _cached_select
time_expire)
TypeError: 'Cache' object is not callable

*apps/todo/__init__.py*
@action('api')  # a GET API function
@action.uses(db)# all before starting a db connection
def todo():
cache_time_expire = 10
cache_db = (cache.memoize(expiration=5), cache_time_expire)
return dict(items=db(db.todo).select(orderby=~db.todo.id, cache=cache_db
, cacheable=True).as_list())

ERROR:root:Traceback (most recent call last):
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 413, in 
wrapper
ret = func(*func_args, **func_kwargs)
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 379, in 
wrapper
ret = func(*args, **kwargs)
  File "/Users/sugizo/learn/python/web3py/apps/todo/__init__.py", line 31, 
in todo
return dict(items=db(db.todo).select(orderby=~db.todo.id, cache=cache_db
, cacheable=True).as_list())
  File 
"/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/objects.py"
, line 2395, in select
return adapter.select(self.query, fields, attributes)
  File 
"/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/adapters/sqlite.py"
, line 82, in select
return super(SQLite, self).select(query, fields, attributes)
  File 
"/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/adapters/base.py"
, line 762, in select
cache, sql, fields, attributes, colnames)
  File 
"/Users/sugizo/miniconda3/envs/python3_todo/lib/python3.7/site-packages/pydal/adapters/base.py"
, line 753, in _cached_select
time_expire)
TypeError: decorator() takes 1 positional argument but 3 were given

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/86bd1e59-98e0-48c0-83cb-93fb0b30b09b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Web2py Windows edition with 3.x Interpreter

2019-06-14 Thread Nico Zanferrari
Hi Dave,

I think that rāma  meant that he used a Windows system with the same Python
version as the one in a already frozen web2py program in order to install
modules inside it. AFAIK he didn't use a pip program inside a frozen web2py.

See this howto page

for details
;-)

Nico

Il giorno gio 13 giu 2019 alle ore 18:32 Dave S  ha
scritto:

>
>
> On Monday, April 29, 2019 at 8:15:09 PM UTC-7, rāma wrote:
>>
>> Hi Nico,
>>
>> Thanks for your inputs.
>>
>> I've actually run windows py2.7 binary with modules within site-packages,
>> and pip can be leveraged by setting your target folder like this:
>>
>> pip install -t site-packages 
>>
>> for the benefit of other readers. It's just that pandas didn't quite work
>> for me in py2.7 and ported my code to python 3.5+.
>>
>>>

> Hi, rāma --
>
> I'm interested in how you got pip installed with python as a DLL.  I want
> to play around with Pillow.
>
> /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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/59ead495-b06e-4dff-b644-7757849b63e5%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAAE8D_DWRvMuahgUaPEhZJMONjf8%3DPumW3FopnW4hNS17Xj16Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.