[web2py] Re: How can I generate hash for user password like web2py

2019-06-07 Thread Константин Комков
Dave S, hello!
1) When I told entrant I want to say person, who want to study in 
university and involve in competition, maybe applicant is more correct.
2) Applicants can choose to apply online and in person. For person, who 
choose to apply online I created form with password (here applicant must 
have email). After operator(moderator) check application, applicant can 
login in personal cabinet.
3) Yes, If applicant don't have email it can registrate it with operator 
(in person).
4) No
5,6,7) Yes, there are table with operator, computer with internet, 
multi-function printer and place for applicant.

-- 
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/9d355ea7-0c49-48cb-9696-de0f97a4daf7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: I can not import module in app

2019-06-07 Thread Константин Комков
P.S. If you delete comment from default.py controller you can see that app 
don't work becouse dont have that module.
>
>

-- 
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/d3968b7a-9450-441a-8674-793b90dc3ad0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py on Raspbian and Python 2 or 3?

2019-06-07 Thread lucas
i can not for the life of me figure out where to change to the python3.5 
environment for web2py.  i tried changing the python symbolic link, and 
changed to python3.5 in multiple files under web2py main directory, uwsgi, 
etc., but i can not get web2py to boot straight into python3.5.  where is 
the secret spot.  i'm using nginx 1.10.3 and uwsgi 2.0.14 and the 
wsgihandler.py properly, etc.  lucas

-- 
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/2ce6a8a9-14e7-4def-85e8-d763e9571442%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py on Raspbian and Python 2 or 3?

2019-06-07 Thread 黄祥
shell script not work ?
another way around perhaps can use conda 3 or miniconda 3, install it and 
it automatically add variable PATH on your bash file, reload it, then, the 
default of your python bash will refer to conda installed path

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/14bf8017-3fad-402c-a42e-8d30a4940b5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Could this problem in production be related to web2py?

2019-06-07 Thread Tim Nyborg
Thanks for this.  Let me know if you find a resolution to the 'saving to 
disk' latency issue.  Redis sessions would be an improvement, but I'd want 
to ensure disk-persistence for them (but not for cached things like search 
results).  How many sessions are you storing, and how much RAM does it 
consume?

On Thursday, 6 June 2019 20:33:28 UTC+1, Lisandro wrote:
>
> If you're going to add Redis, let me add a couple of comments about my own 
> experience:
>
>  - Using Redis to store sessions (not only to cache) was a huge 
> improvement in my case. I have public websites, some of them with much 
> traffic, so my app handles many sessions. I was using the database for 
> handling sessions, but when I changed to Redis, the performance improvement 
> was considerable. 
>
>  - Do some tests with the argument "with_lock" available in RedisCache and 
> RedisSessions (from gluon.contrib). In my specific case, using 
> with_lock=False is better, but of course this depends on each specific 
> scenario.
>
>  - An advise: choose proper values for "maxmemory" and "maxmemory-policy" 
> options from Redis configuration. The first one sets the max amount of 
> memory that Redis is allowed to use, and "maxmemory-policy" allows you to 
> choose how Redis should evict keys when it hits the maxmemory: 
> https://redis.io/topics/lru-cache. 
>
>
> El jueves, 6 de junio de 2019, 12:15:38 (UTC-3), Tim Nyborg escribió:
>>
>> This is really good to know.  I've a similar architecture to you, and am 
>> planning to add redis to the stack soon.  Knowing about issues to be on the 
>> lookout for is very helpful.
>>
>> On Friday, 24 May 2019 16:26:50 UTC+1, Lisandro wrote:
>>>
>>> I've found the root cause of the issue: the guilty was Redis.
>>>
>>> This is what was happening: Redis has an option for persistance 
>>>  wich stores the DB to the disk 
>>> every certain amount of time. The configuration I had was the one that 
>>> comes by default with Redis, that stores the DB every 15 minutes if at 
>>> least 1 key changed, every 5 minutes if at least 10 keys changed, and every 
>>> 60 seconds if 1 keys changed. My Redis instance was saving DB to the 
>>> disk every minute, and the saving process was taking about 70 seconds. 
>>> Apparently, during that time, many of the requests were hanging. What I did 
>>> was to simply disable the saving process (I can do it in my case because I 
>>> don't need persistance). 
>>>
>>> I'm not sure why this happens. I know that Redis is single-threaded, but 
>>> its documentation states that many tasks (such as saving the DB) run in a 
>>> separate thread that Redis creates. So I'm not sure how is that the process 
>>> of saving DB to the disk is making the other Redis operations hang. But 
>>> this is what was happening, and I'm able to confirm that, after disabling 
>>> the DB saving process, my application response times have decreased to 
>>> expected values, no more timeouts :)
>>>
>>> I will continue to investigate this issue with Redis in the proper 
>>> forum. 
>>> I hope this helps anyone facing the same issue.
>>>
>>> Thanks for the help!
>>>
>>> El lunes, 13 de mayo de 2019, 13:49:26 (UTC-3), Lisandro escribió:

 After doing a lot of reading about uWSGI, I've discovered that "uWSGI 
 cores are not CPU cores" (this was confirmed by unbit developers 
 , the 
 ones that wrote and mantain uWSGI). This makes me think that the issue I'm 
 experiencing is due to a misconfiguration of uWSGI. But as I'm a developer 
 and not a sysadmin, it's being hard for me to figure out exactly what 
 uWSGI 
 options should I tweak. 

 I know this is out of the scope of this group, but I'll post my uWSGI 
 app configuration anyway, in case someone still wants to help:

 [uwsgi]
 pythonpath = /var/www/medios/
 mount = /=wsgihandler:application
 master = true
 workers = 40
 cpu-affinity = 3
 lazy-apps = true
 harakiri = 60
 reload-mercy = 8
 max-requests = 4000
 no-orphans = true
 vacuum = true
 buffer-size = 32768
 disable-logging = true
 ignore-sigpipe = true
 ignore-write-errors = true
 listen = 65535
 disable-write-exception = true


 Just to remember, this is running on a machine with 16 CPUs.
 Maybe I should *enable-threads*, set *processes* options and maybe 
 tweak *cpu-affinity. *
 My application uses Redis for caching, so I think I can enable threads 
 safely. 
 What do you think?


 El jueves, 9 de mayo de 2019, 21:10:57 (UTC-3), Lisandro escribió:
>
> I've checked my app's code once again and I can confirm that it 
> doesn't create threads. It only uses subprocess.cal() within functions 
> that 
> are called in the scheduler environment, I understand that's the proper 
> way 
> to do it because those calls d

[web2py] Re: Hidden Field

2019-06-07 Thread Quang Lam

Hi i guess i have to declare the field is neither readable nor writable, so 
that it will not display in the form. but my concern is the setting of 
writable and readable to false will prevent me from inputting the value 
which i got from running another script into the field mode or it does not 
affect. in the other words. when i display the form, it will ask the user 
to input the info for fields except the mode because i will call another 
script to get the mode data, then i will insert data into all fields. 

Please help
On Thursday, June 6, 2019 at 7:25:05 PM UTC-7, 黄祥 wrote:
>
> perhaps can use readabe=False or show_if
> ref:
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-constructor
>
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Conditional-fields
>
> 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/b055f91c-c508-475a-80c7-c365c6cda87f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Could this problem in production be related to web2py?

2019-06-07 Thread Lisandro
I'm not exactly sure how many sessions my app is handling, but this numbers 
will give you an idea:

 - My websites receive about 500k visits (sessions) in an average day.
 - The server handles about 2.5 million requests in an average day.
 - I use RedisSession(session_expiry=36000), that is, sessions handled by 
Redis expire after 10 hours.
 - I also use Redis to store in cache the final HTML of public pages for 5 
minutes.
 - My Redis instance uses about 12gb of RAM. 
 - My Redis instance consumes only about 8% of CPU (that is the 8% of one 
single CPU, notice Redis is single-threaded).


When you say "I'd want to ensure disk-persistence for them (but not for 
cached things like search results)", how do you plan to achieve that? I'm 
no expert, but I think the disk-persistance option in Redis is global. If 
you want persistance for sessions and not for other cached things, I think 
you will need to different instances of Redis. 


El viernes, 7 de junio de 2019, 7:09:26 (UTC-3), Tim Nyborg escribió:
>
> Thanks for this.  Let me know if you find a resolution to the 'saving to 
> disk' latency issue.  Redis sessions would be an improvement, but I'd want 
> to ensure disk-persistence for them (but not for cached things like search 
> results).  How many sessions are you storing, and how much RAM does it 
> consume?
>
> On Thursday, 6 June 2019 20:33:28 UTC+1, Lisandro wrote:
>>
>> If you're going to add Redis, let me add a couple of comments about my 
>> own experience:
>>
>>  - Using Redis to store sessions (not only to cache) was a huge 
>> improvement in my case. I have public websites, some of them with much 
>> traffic, so my app handles many sessions. I was using the database for 
>> handling sessions, but when I changed to Redis, the performance improvement 
>> was considerable. 
>>
>>  - Do some tests with the argument "with_lock" available in RedisCache 
>> and RedisSessions (from gluon.contrib). In my specific case, using 
>> with_lock=False is better, but of course this depends on each specific 
>> scenario.
>>
>>  - An advise: choose proper values for "maxmemory" and "maxmemory-policy" 
>> options from Redis configuration. The first one sets the max amount of 
>> memory that Redis is allowed to use, and "maxmemory-policy" allows you to 
>> choose how Redis should evict keys when it hits the maxmemory: 
>> https://redis.io/topics/lru-cache. 
>>
>>
>> El jueves, 6 de junio de 2019, 12:15:38 (UTC-3), Tim Nyborg escribió:
>>>
>>> This is really good to know.  I've a similar architecture to you, and am 
>>> planning to add redis to the stack soon.  Knowing about issues to be on the 
>>> lookout for is very helpful.
>>>
>>> On Friday, 24 May 2019 16:26:50 UTC+1, Lisandro wrote:

 I've found the root cause of the issue: the guilty was Redis.

 This is what was happening: Redis has an option for persistance 
  wich stores the DB to the disk 
 every certain amount of time. The configuration I had was the one that 
 comes by default with Redis, that stores the DB every 15 minutes if at 
 least 1 key changed, every 5 minutes if at least 10 keys changed, and 
 every 
 60 seconds if 1 keys changed. My Redis instance was saving DB to the 
 disk every minute, and the saving process was taking about 70 seconds. 
 Apparently, during that time, many of the requests were hanging. What I 
 did 
 was to simply disable the saving process (I can do it in my case because I 
 don't need persistance). 

 I'm not sure why this happens. I know that Redis is single-threaded, 
 but its documentation states that many tasks (such as saving the DB) run 
 in 
 a separate thread that Redis creates. So I'm not sure how is that the 
 process of saving DB to the disk is making the other Redis operations 
 hang. 
 But this is what was happening, and I'm able to confirm that, after 
 disabling the DB saving process, my application response times have 
 decreased to expected values, no more timeouts :)

 I will continue to investigate this issue with Redis in the proper 
 forum. 
 I hope this helps anyone facing the same issue.

 Thanks for the help!

 El lunes, 13 de mayo de 2019, 13:49:26 (UTC-3), Lisandro escribió:
>
> After doing a lot of reading about uWSGI, I've discovered that "uWSGI 
> cores are not CPU cores" (this was confirmed by unbit developers 
> , 
> the ones that wrote and mantain uWSGI). This makes me think that the 
> issue 
> I'm experiencing is due to a misconfiguration of uWSGI. But as I'm a 
> developer and not a sysadmin, it's being hard for me to figure out 
> exactly 
> what uWSGI options should I tweak. 
>
> I know this is out of the scope of this group, but I'll post my uWSGI 
> app configuration anyway, in case someone stil

[web2py] Re: web2py on Raspbian and Python 2 or 3?

2019-06-07 Thread lucas
well  isn't python opened with either nginx (nginx.service) or uwsgi 
(emperor.uwsgi.service) with systemctl.  I've been trying to find that 
script to change the python to python3.5.  but I can't seem to find it 
under either of those two or under web2py.

-- 
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/09a73628-a905-4ba6-aae6-3ef3f43ccc2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py on Raspbian and Python 2 or 3?

2019-06-07 Thread Val K
Did you look at /etc/systemd/system

-- 
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/318e3a05-160b-47fb-af08-e35626cb4375%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Could this problem in production be related to web2py?

2019-06-07 Thread Tim Nyborg
You're exactly right - I'll probably wind up with two instances, once 
RAM-only for caching, and a persistent one for sessions.

On Friday, 7 June 2019 14:15:35 UTC+1, Lisandro wrote:
>
> I'm not exactly sure how many sessions my app is handling, but this 
> numbers will give you an idea:
>
>  - My websites receive about 500k visits (sessions) in an average day.
>  - The server handles about 2.5 million requests in an average day.
>  - I use RedisSession(session_expiry=36000), that is, sessions handled by 
> Redis expire after 10 hours.
>  - I also use Redis to store in cache the final HTML of public pages for 5 
> minutes.
>  - My Redis instance uses about 12gb of RAM. 
>  - My Redis instance consumes only about 8% of CPU (that is the 8% of one 
> single CPU, notice Redis is single-threaded).
>
>
> When you say "I'd want to ensure disk-persistence for them (but not for 
> cached things like search results)", how do you plan to achieve that? I'm 
> no expert, but I think the disk-persistance option in Redis is global. If 
> you want persistance for sessions and not for other cached things, I think 
> you will need to different instances of Redis. 
>
>
> El viernes, 7 de junio de 2019, 7:09:26 (UTC-3), Tim Nyborg escribió:
>>
>> Thanks for this.  Let me know if you find a resolution to the 'saving to 
>> disk' latency issue.  Redis sessions would be an improvement, but I'd want 
>> to ensure disk-persistence for them (but not for cached things like search 
>> results).  How many sessions are you storing, and how much RAM does it 
>> consume?
>>
>> On Thursday, 6 June 2019 20:33:28 UTC+1, Lisandro wrote:
>>>
>>> If you're going to add Redis, let me add a couple of comments about my 
>>> own experience:
>>>
>>>  - Using Redis to store sessions (not only to cache) was a huge 
>>> improvement in my case. I have public websites, some of them with much 
>>> traffic, so my app handles many sessions. I was using the database for 
>>> handling sessions, but when I changed to Redis, the performance improvement 
>>> was considerable. 
>>>
>>>  - Do some tests with the argument "with_lock" available in RedisCache 
>>> and RedisSessions (from gluon.contrib). In my specific case, using 
>>> with_lock=False is better, but of course this depends on each specific 
>>> scenario.
>>>
>>>  - An advise: choose proper values for "maxmemory" and 
>>> "maxmemory-policy" options from Redis configuration. The first one sets the 
>>> max amount of memory that Redis is allowed to use, and "maxmemory-policy" 
>>> allows you to choose how Redis should evict keys when it hits the 
>>> maxmemory: https://redis.io/topics/lru-cache. 
>>>
>>>
>>> El jueves, 6 de junio de 2019, 12:15:38 (UTC-3), Tim Nyborg escribió:

 This is really good to know.  I've a similar architecture to you, and 
 am planning to add redis to the stack soon.  Knowing about issues to be on 
 the lookout for is very helpful.

 On Friday, 24 May 2019 16:26:50 UTC+1, Lisandro wrote:
>
> I've found the root cause of the issue: the guilty was Redis.
>
> This is what was happening: Redis has an option for persistance 
>  wich stores the DB to the disk 
> every certain amount of time. The configuration I had was the one that 
> comes by default with Redis, that stores the DB every 15 minutes if at 
> least 1 key changed, every 5 minutes if at least 10 keys changed, and 
> every 
> 60 seconds if 1 keys changed. My Redis instance was saving DB to the 
> disk every minute, and the saving process was taking about 70 seconds. 
> Apparently, during that time, many of the requests were hanging. What I 
> did 
> was to simply disable the saving process (I can do it in my case because 
> I 
> don't need persistance). 
>
> I'm not sure why this happens. I know that Redis is single-threaded, 
> but its documentation states that many tasks (such as saving the DB) run 
> in 
> a separate thread that Redis creates. So I'm not sure how is that the 
> process of saving DB to the disk is making the other Redis operations 
> hang. 
> But this is what was happening, and I'm able to confirm that, after 
> disabling the DB saving process, my application response times have 
> decreased to expected values, no more timeouts :)
>
> I will continue to investigate this issue with Redis in the proper 
> forum. 
> I hope this helps anyone facing the same issue.
>
> Thanks for the help!
>
> El lunes, 13 de mayo de 2019, 13:49:26 (UTC-3), Lisandro escribió:
>>
>> After doing a lot of reading about uWSGI, I've discovered that "uWSGI 
>> cores are not CPU cores" (this was confirmed by unbit developers 
>> , 
>> the ones that wrote and mantain uWSGI). This makes me think that the 
>> issue 
>> I'm experiencing is due to 

Re: [web2py] appadmin database administration fails when trying to edit record

2019-06-07 Thread David Manns
It turns out the orderby is redundant.

Field('Account', 'reference CoA', requires=IS_IN_DB(db, 'CoA.id', 
'%(Name)s')),

works the same. In the application smartgrid edit form the Account field is 
a dropdown displaying the Name's of the accounts in alphabetic order, no 
need for the orderby, so yes, the user is selecting by Name but of course 
what's stored in Account is the corresponding id.

The orderby in Event is not redundant, as the event names need to be in 
reverse chronological order in the dropdown, rather than alphabetic.

But appadmin still fails exactly the same way. Looks like a bug in appadmin 
to me.

On Thursday, June 6, 2019 at 12:17:53 PM UTC-4, Ben Duncan wrote:
>
> Field('Account', 'reference CoA',
> requires=IS_IN_DB(db, 'CoA.id', '%(Name)s', orderby=
> db.CoA.Name)), 
>
> To me, it looks like you are using "name" to reference the COA, instead of 
> the ID.
>
> http://www.web2py.com/books/default/search/29?search=IS_IN_DB
>
> *Ben Duncan*
> DBA / Chief Software Architect 
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Jun 6, 2019 at 10:25 AM David Manns  > wrote:
>
>> running Python 2.7, web2py 2.18.5
>>
>> table:
>> 
>> db.define_table('AccTrans',
>> Field('Timestamp', 'datetime', default=request.now, writable=False),
>> Field('Bank', 'reference Bank_Accounts', writable=False),#e.g. 
>> PayPal, Cambridge Trust, ...
>> Field('Account', 'reference CoA',
>> requires=IS_IN_DB(db, 'CoA.id', '%(Name)s', orderby=
>> db.CoA.Name)),
>> Field('Event', 'reference Events',
>> requires=IS_EMPTY_OR(IS_IN_DB(db, 'Events.id', 
>> '%(Event)s', orderby=~db.Events.Date)),
>> comment='leave blank if not applicable'),
>> Field('Amount', 'decimal(8,2)',
>> comment='enter full amount of check (negative) or deposit 
>> (positive); split using Edit if multiple accounts',
>> requires=IS_DECIMAL_IN_RANGE(-1, 1)),# >=0 
>> for asset/revenue, <0 for liability/expense
>> Field('Fee', 'decimal(6,2)', 
>> requires=IS_EMPTY_OR(IS_DECIMAL_IN_RANGE(-1000,100))),# e.g. PayPal 
>> transaction fee, <0 (unless refunded)
>> Field('CheckNumber', 'integer', default=None, 
>> requires=IS_EMPTY_OR(IS_INT_IN_RANGE(1,9)),
>> comment='enter check number if recording a check 
>> written'),
>> Field('Accrual', 'boolean', default=True, readable=True, 
>> writable=False),
>> Field('FullAmt', 'decimal(8,2)', writable=False, readable=False),
>> # for an accrual, the original unsplit amount
>> Field('Reference', 'string', writable=False),
>> Field('Notes', 'text'),
>> singular='Transaction', plural='Check_Register')
>>
>> first referenced table:
>> 
>> db.define_table('CoA',
>> Field('Name', 'string'),
>> Field('Notes', 'string'),
>> singular='Bank', plural='Banks', format='%(Name)s')
>> db.CoA.Name.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB(db, 'CoA.Name')]
>>
>> appadmin displays table rows just fine.
>>
>> clicking a record link in the id column to edit the record fails:
>>
>> Ticket ID 
>>
>> 127.0.0.1.2019-06-06.11-23-25.64b3e296-56e8-4c9f-a875-5a0ae496f620
>>  'Account.Name' Version 
>> web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03 
>> Python Python 2.7.14: C:\Python27\python.exe (prefix: C:\Python27) 
>> Traceback 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>> 19.
>> 20.
>> 21.
>> 22.
>>
>> Traceback (most recent call last):
>>   File "C:\Users\David\Google Drive\My 
>> Documents\OxCamNE.3.1\gluon\restricted.py", line 219, in restricted
>> exec(ccode, environment)
>>   File "C:\Users\David\Google Drive\My 
>> Documents\OxCamNE.3.1\applications\init\controllers/appadmin.py", line 695, 
>> in 
>>   File "C:\Users\David\Google Drive\My 
>> Documents\OxCamNE.3.1\gluon\globals.py", line 421, in 
>> self._caller = lambda f: f()
>>   File "C:\Users\David\Google Drive\My 
>> Documents\OxCamNE.3.1\applications\init\controllers/appadmin.py", line 337, 
>> in update
>> f='download', args=request.args[:1]))
>>   File "C:\Users\David\Google Drive\My 
>> Documents\OxCamNE.3.1\gluon\sqlhtml.py", line 1550, in __init__
>> inp = self.widgets.options.widget(field, default)
>>   File "C:\Users\David\Google Drive\My 
>> Documents\OxCamNE.3.1\gluon\sqlhtml.py", line 353, in widget
>> options = requires[0].options()
>>   File "C:\Users\David\Google Drive\My 
>> Documents\OxCamNE.3.1\gluon\packages\dal\pydal\validators.py", line 2742, in 
>> _options
>> options = self.other.options(*args, **kwargs)
>>   File "C:\Users\David\Google Drive\My 
>> Documents\OxCamNE.3.1\gluon\packages\dal\pydal\validators.py", line 609, in 
>> options
>> self.build_set()
>>   File "C:\Users\David\Google Drive\My 
>> Documents\OxCamNE.3.1\gluon\packages\dal\pydal\validators.py", line 604, in 
>> build_set
>> self.labels = [s

[web2py] Re: auth.settings.login_next doesn't redirect after login -

2019-06-07 Thread Anthony
On Thursday, June 6, 2019 at 3:54:59 PM UTC-4, Vlad wrote:
>
> What could be the reason the following code wouldn't redirect to the 
> appropriate URL after login? (still brings to default/index page)
>
> def login_to_url():
>
>auth.settings.login_next=URL(request.args(0),request.args(1))
>
>logger.warning(auth.settings.login_next)
>
>redirect(URL('default','user',args='login'))
>
>
Above you set the login_next setting inside the login_to_url() action but 
then redirect to /default/user. The redirect results in the browser sending 
a new HTTP request to web2py, and in that new request, your setting is not 
made. Instead, maybe try:

def login_to_url():
   login_next = URL(request.args(0), request.args(1))
   redirect(URL('default','user', args='login', vars=dict(_next=login_next
)))

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1457f394-aa1a-458c-935d-e6ddf4888e24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: how safe is it to rely on a value stored as a session variable?

2019-06-07 Thread Anthony
Users can neither read nor write to the session (even cookie based 
sessions, which are encrypted), so it is "safe" in that regard. Of course, 
we don't know what your app code is writing to the session -- if you take 
user input and write it to the session, then it may not be safe.

Anthony

On Thursday, June 6, 2019 at 10:11:19 PM UTC-4, Vlad wrote:
>
> I don't really understand how it works internally, so wondering if it's 
> safe to rely on a value stored as a session storage variable. 
> More specifically, I am authorizing one user to do certain actions on 
> behalf of another user, and the currently assumed user is stored in 
> session.user (even if auth.user_id is somebody else). 
> If somebody can hack session and change the value of session.user - it 
> would be potentially dangerous situation, so if it's not safe - I would 
> have to figure out something else.It's just easy and tempting to use some 
> variables in a session. 
> Any ideas on how safe it is? 
>
> p.s. I don't care if somebody can read it - my only concern is that they 
> shouldn't be able to overwrite it, because this would give them authority 
> to perform certain actions.
>

-- 
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/dcdff220-c9dd-4273-9b4f-028fe56b0489%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: auth.settings.login_next doesn't redirect after login -

2019-06-07 Thread Eliezer (Vlad) Tseytkin
Oops, got it, repeating this mistake second time..
Thank you very much

On Fri, Jun 7, 2019, 12:26 PM Anthony  wrote:

> On Thursday, June 6, 2019 at 3:54:59 PM UTC-4, Vlad wrote:
>>
>> What could be the reason the following code wouldn't redirect to the
>> appropriate URL after login? (still brings to default/index page)
>>
>> def login_to_url():
>>
>>auth.settings.login_next=URL(request.args(0),request.args(1))
>>
>>logger.warning(auth.settings.login_next)
>>
>>redirect(URL('default','user',args='login'))
>>
>>
> Above you set the login_next setting inside the login_to_url() action but
> then redirect to /default/user. The redirect results in the browser sending
> a new HTTP request to web2py, and in that new request, your setting is not
> made. Instead, maybe try:
>
> def login_to_url():
>login_next = URL(request.args(0), request.args(1))
>redirect(URL('default','user', args='login', vars=dict(_next=login_next
> )))
>
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/lSvOD-GXM_k/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/1457f394-aa1a-458c-935d-e6ddf4888e24%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%2BKCB-J76xNVWRUovAY4jO9uzVeEtJW6wpXK929PXYNS%3Dp5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: how safe is it to rely on a value stored as a session variable?

2019-06-07 Thread Eliezer (Vlad) Tseytkin
Thank you!

On Fri, Jun 7, 2019, 12:32 PM Anthony  wrote:

> Users can neither read nor write to the session (even cookie based
> sessions, which are encrypted), so it is "safe" in that regard. Of course,
> we don't know what your app code is writing to the session -- if you take
> user input and write it to the session, then it may not be safe.
>
> Anthony
>
> On Thursday, June 6, 2019 at 10:11:19 PM UTC-4, Vlad wrote:
>>
>> I don't really understand how it works internally, so wondering if it's
>> safe to rely on a value stored as a session storage variable.
>> More specifically, I am authorizing one user to do certain actions on
>> behalf of another user, and the currently assumed user is stored in
>> session.user (even if auth.user_id is somebody else).
>> If somebody can hack session and change the value of session.user - it
>> would be potentially dangerous situation, so if it's not safe - I would
>> have to figure out something else.It's just easy and tempting to use some
>> variables in a session.
>> Any ideas on how safe it is?
>>
>> p.s. I don't care if somebody can read it - my only concern is that they
>> shouldn't be able to overwrite it, because this would give them authority
>> to perform certain actions.
>>
> --
> 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/bE9rZb_MHkI/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/dcdff220-c9dd-4273-9b4f-028fe56b0489%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%2BKCD7sUnrTH7WGVPco3ctD_ZmywCmjfPb9Cjcdzxruc1bRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Problem with Import

2019-06-07 Thread Quang Lam
i placed a new module file in the modules folder but i got the error saying 
there is no module named in the modules folder when i import the module. 
However, i can import the other modules in the modules folder but not the 
new one.
Please 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/3edd3268-f787-44ea-b832-8e8b925d36d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py on Raspbian and Python 2 or 3?

2019-06-07 Thread lucas
i haven't until you just mentioned it.  there is an emperor.uwsgi.service 
file.  its contents are:

[Unit]
Description = uWSGI Emperor
After = syslog.target

[Service]
ExecStart = /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
RuntimeDirectory = uwsgi
Restart = always
KillSignal = SIGQUIT
Type = notify
StandardError = syslog
NotifyAccess = all

[Install]
WantedBy = multi-user.target

is there a way or option to ensure that it starts the /usr/bin/python3.5 
environment in there somehow?

On Friday, June 7, 2019 at 9:50:12 AM UTC-4, Val K wrote:
>
> Did you look at /etc/systemd/system

-- 
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/0f2fade4-597d-4b2d-ab16-55b25871a606%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Problem with Import

2019-06-07 Thread Dave S


On Friday, June 7, 2019 at 10:33:09 AM UTC-7, Quang Lam wrote:
>
> i placed a new module file in the modules folder but i got the error 
> saying there is no module named in the modules folder when i import the 
> module. However, i can import the other modules in the modules folder but 
> not the new one.
> Please help 
>

If you have appadmin enabled, the "sites" page has a reload button.  
Otherwise, stop and restart web2py.
(I only use modules in Scheduler tasks, so it's just the -K that has to be 
stop-and-go)


/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/052fa92a-d422-4536-9e16-b524c9c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Problem with Import

2019-06-07 Thread Quang Lam
Hi Dave

i restarted the web2py, reloaded the adminpage but i still got the error 
saying no module named in the modules folder. i have no problem with the 
other modules except the new one named mode_extraction. Also, i checked my 
modules folder, web2py actually compiles the mode_extraction module because 
i saw the pyc file but i dont know why i got the error of no module named 
in the folder.

Thanks 

On Friday, June 7, 2019 at 1:16:44 PM UTC-7, Dave S wrote:
>
>
>
> On Friday, June 7, 2019 at 10:33:09 AM UTC-7, Quang Lam wrote:
>>
>> i placed a new module file in the modules folder but i got the error 
>> saying there is no module named in the modules folder when i import the 
>> module. However, i can import the other modules in the modules folder but 
>> not the new one.
>> Please help 
>>
>
> If you have appadmin enabled, the "sites" page has a reload button.  
> Otherwise, stop and restart web2py.
> (I only use modules in Scheduler tasks, so it's just the -K that has to be 
> stop-and-go)
>
>
> /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/de84ce2a-e29c-4f80-a3c1-6beb2ae72775%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Problem with Import

2019-06-07 Thread Dave S


On Friday, June 7, 2019 at 1:24:23 PM UTC-7, Quang Lam wrote:
>
> Hi Dave
>
> i restarted the web2py, reloaded the adminpage but i still got the error 
> saying no module named in the modules folder. i have no problem with the 
> other modules except the new one named mode_extraction. Also, i checked my 
> modules folder, web2py actually compiles the mode_extraction module because 
> i saw the pyc file but i dont know why i got the error of no module named 
> in the folder.
>
> Thanks 
>


Ah!  Maybe the custom importer is not handling the underscore.  Try 
renaming the module.

/dps
 

> On Friday, June 7, 2019 at 1:16:44 PM UTC-7, Dave S wrote:
>>
>>
>>
>> On Friday, June 7, 2019 at 10:33:09 AM UTC-7, Quang Lam wrote:
>>>
>>> i placed a new module file in the modules folder but i got the error 
>>> saying there is no module named in the modules folder when i import the 
>>> module. However, i can import the other modules in the modules folder but 
>>> not the new one.
>>> Please help 
>>>
>>
>> If you have appadmin enabled, the "sites" page has a reload button.  
>> Otherwise, stop and restart web2py.
>> (I only use modules in Scheduler tasks, so it's just the -K that has to 
>> be stop-and-go)
>>
>>
>> /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/4c224586-92d4-447a-8adc-3144f0e255e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py on Raspbian and Python 2 or 3?

2019-06-07 Thread Dave S


On Friday, June 7, 2019 at 2:37:54 AM UTC-7, lucas wrote:
>
> i can not for the life of me figure out where to change to the python3.5 
> environment for web2py.  i tried changing the python symbolic link, and 
> changed to python3.5 in multiple files under web2py main directory, uwsgi, 
> etc., but i can not get web2py to boot straight into python3.5.  where is 
> the secret spot.  i'm using nginx 1.10.3 and uwsgi 2.0.14 and the 
> wsgihandler.py properly, etc.  lucas
>

You may not be able to do it with a distro build of uwsgi.  a quick Google 
(tm) search found Stack Overflow articles, one of which pointed to
https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html#bonus-multiple-python-versions-for-the-same-uwsgi-binary>

/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/603b7bf4-e96e-49ea-bb72-dcc2abc0d8ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] appadmin database administration fails when trying to edit record

2019-06-07 Thread Dave S


On Friday, June 7, 2019 at 8:43:43 AM UTC-7, David Manns wrote:
>
> It turns out the orderby is redundant.
>
> Field('Account', 'reference CoA', requires=IS_IN_DB(db, 'CoA.id', 
> '%(Name)s')),
>
> works the same. In the application smartgrid edit form the Account field 
> is a dropdown displaying the Name's of the accounts in alphabetic order, no 
> need for the orderby, so yes, the user is selecting by Name but of course 
> what's stored in Account is the corresponding id.
>
> The orderby in Event is not redundant, as the event names need to be in 
> reverse chronological order in the dropdown, rather than alphabetic.
>
> But appadmin still fails exactly the same way. Looks like a bug in 
> appadmin to me.
>

The place where I use Appadmin and a reference field is at home, and last 
night I was paying for the night before, and didn't even wake my computer.  
But in my experience (admittedly with 2.14.6) Appadmin shows the child 
table just fine, with a column for the ids from the parent table.

/dps


> On Thursday, June 6, 2019 at 12:17:53 PM UTC-4, Ben Duncan wrote:
>>
>> Field('Account', 'reference CoA',
>> requires=IS_IN_DB(db, 'CoA.id', '%(Name)s', orderby=
>> db.CoA.Name)), 
>>
>> To me, it looks like you are using "name" to reference the COA, instead 
>> of the ID.
>>
>> http://www.web2py.com/books/default/search/29?search=IS_IN_DB
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect 
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Thu, Jun 6, 2019 at 10:25 AM David Manns  wrote:
>>
>>> running Python 2.7, web2py 2.18.5
>>>
>>> table:
>>> 
>>> db.define_table('AccTrans',
>>> Field('Timestamp', 'datetime', default=request.now, writable=False),
>>> Field('Bank', 'reference Bank_Accounts', writable=False),#e.g. 
>>> PayPal, Cambridge Trust, ...
>>> Field('Account', 'reference CoA',
>>> requires=IS_IN_DB(db, 'CoA.id', '%(Name)s', orderby=
>>> db.CoA.Name)),
>>> Field('Event', 'reference Events',
>>> requires=IS_EMPTY_OR(IS_IN_DB(db, 'Events.id', 
>>> '%(Event)s', orderby=~db.Events.Date)),
>>> comment='leave blank if not applicable'),
>>> Field('Amount', 'decimal(8,2)',
>>> comment='enter full amount of check (negative) or 
>>> deposit (positive); split using Edit if multiple accounts',
>>> requires=IS_DECIMAL_IN_RANGE(-1, 1)),# >=0 
>>> for asset/revenue, <0 for liability/expense
>>> Field('Fee', 'decimal(6,2)', 
>>> requires=IS_EMPTY_OR(IS_DECIMAL_IN_RANGE(-1000,100))),# e.g. PayPal 
>>> transaction fee, <0 (unless refunded)
>>> Field('CheckNumber', 'integer', default=None, 
>>> requires=IS_EMPTY_OR(IS_INT_IN_RANGE(1,9)),
>>> comment='enter check number if recording a check 
>>> written'),
>>> Field('Accrual', 'boolean', default=True, readable=True, 
>>> writable=False),
>>> Field('FullAmt', 'decimal(8,2)', writable=False, readable=False),
>>> # for an accrual, the original unsplit amount
>>> Field('Reference', 'string', writable=False),
>>> Field('Notes', 'text'),
>>> singular='Transaction', plural='Check_Register')
>>>
>>> first referenced table:
>>> 
>>> db.define_table('CoA',
>>> Field('Name', 'string'),
>>> Field('Notes', 'string'),
>>> singular='Bank', plural='Banks', format='%(Name)s')
>>> db.CoA.Name.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB(db, 'CoA.Name')]
>>>
>>> appadmin displays table rows just fine.
>>>
>>> clicking a record link in the id column to edit the record fails:
>>>
>>> Ticket ID 
>>>
>>> 127.0.0.1.2019-06-06.11-23-25.64b3e296-56e8-4c9f-a875-5a0ae496f620
>>>  'Account.Name' Version 
>>> web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03 
>>> Python Python 2.7.14: C:\Python27\python.exe (prefix: C:\Python27) 
>>> Traceback 
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>> 12.
>>> 13.
>>> 14.
>>> 15.
>>> 16.
>>> 17.
>>> 18.
>>> 19.
>>> 20.
>>> 21.
>>> 22.
>>>
>>> Traceback (most recent call last):
>>>   File "C:\Users\David\Google Drive\My 
>>> Documents\OxCamNE.3.1\gluon\restricted.py", line 219, in restricted
>>> exec(ccode, environment)
>>>   File "C:\Users\David\Google Drive\My 
>>> Documents\OxCamNE.3.1\applications\init\controllers/appadmin.py", line 695, 
>>> in 
>>>   File "C:\Users\David\Google Drive\My 
>>> Documents\OxCamNE.3.1\gluon\globals.py", line 421, in 
>>> self._caller = lambda f: f()
>>>   File "C:\Users\David\Google Drive\My 
>>> Documents\OxCamNE.3.1\applications\init\controllers/appadmin.py", line 337, 
>>> in update
>>> f='download', args=request.args[:1]))
>>>   File "C:\Users\David\Google Drive\My 
>>> Documents\OxCamNE.3.1\gluon\sqlhtml.py", line 1550, in __init__
>>> inp = self.widgets.options.widget(field, default)
>>>   File "C:\Users\David\Google Drive\My 
>>> Documents\OxCamNE.3.1\gluon\sqlhtml.py", line 353, in widget
>>> options = requires[0].option

Re: [web2py] appadmin database administration fails when trying to edit record

2019-06-07 Thread David Manns
Yes, I'm pretty sure it worked fine with 2.14.6!

On Friday, June 7, 2019 at 5:42:12 PM UTC-4, Dave S wrote:
>
>
>
> On Friday, June 7, 2019 at 8:43:43 AM UTC-7, David Manns wrote:
>>
>> It turns out the orderby is redundant.
>>
>> Field('Account', 'reference CoA', requires=IS_IN_DB(db, 'CoA.id', 
>> '%(Name)s')),
>>
>> works the same. In the application smartgrid edit form the Account field 
>> is a dropdown displaying the Name's of the accounts in alphabetic order, no 
>> need for the orderby, so yes, the user is selecting by Name but of course 
>> what's stored in Account is the corresponding id.
>>
>> The orderby in Event is not redundant, as the event names need to be in 
>> reverse chronological order in the dropdown, rather than alphabetic.
>>
>> But appadmin still fails exactly the same way. Looks like a bug in 
>> appadmin to me.
>>
>
> The place where I use Appadmin and a reference field is at home, and last 
> night I was paying for the night before, and didn't even wake my computer.  
> But in my experience (admittedly with 2.14.6) Appadmin shows the child 
> table just fine, with a column for the ids from the parent table.
>
> /dps
>
>
>> On Thursday, June 6, 2019 at 12:17:53 PM UTC-4, Ben Duncan wrote:
>>>
>>> Field('Account', 'reference CoA',
>>> requires=IS_IN_DB(db, 'CoA.id', '%(Name)s', orderby=
>>> db.CoA.Name)), 
>>>
>>> To me, it looks like you are using "name" to reference the COA, instead 
>>> of the ID.
>>>
>>> http://www.web2py.com/books/default/search/29?search=IS_IN_DB
>>>
>>> *Ben Duncan*
>>> DBA / Chief Software Architect 
>>> Mississippi State Supreme Court
>>> Electronic Filing Division
>>>
>>>
>>> On Thu, Jun 6, 2019 at 10:25 AM David Manns  wrote:
>>>
 running Python 2.7, web2py 2.18.5

 table:
 
 db.define_table('AccTrans',
 Field('Timestamp', 'datetime', default=request.now, writable=False),
 Field('Bank', 'reference Bank_Accounts', writable=False),#e.g. 
 PayPal, Cambridge Trust, ...
 Field('Account', 'reference CoA',
 requires=IS_IN_DB(db, 'CoA.id', '%(Name)s', orderby=
 db.CoA.Name)),
 Field('Event', 'reference Events',
 requires=IS_EMPTY_OR(IS_IN_DB(db, 'Events.id', 
 '%(Event)s', orderby=~db.Events.Date)),
 comment='leave blank if not applicable'),
 Field('Amount', 'decimal(8,2)',
 comment='enter full amount of check (negative) or 
 deposit (positive); split using Edit if multiple accounts',
 requires=IS_DECIMAL_IN_RANGE(-1, 1)),# >=0 
 for asset/revenue, <0 for liability/expense
 Field('Fee', 'decimal(6,2)', 
 requires=IS_EMPTY_OR(IS_DECIMAL_IN_RANGE(-1000,100))),# e.g. PayPal 
 transaction fee, <0 (unless refunded)
 Field('CheckNumber', 'integer', default=None, 
 requires=IS_EMPTY_OR(IS_INT_IN_RANGE(1,9)),
 comment='enter check number if recording a check 
 written'),
 Field('Accrual', 'boolean', default=True, readable=True, 
 writable=False),
 Field('FullAmt', 'decimal(8,2)', writable=False, 
 readable=False),# for an accrual, the original unsplit amount
 Field('Reference', 'string', writable=False),
 Field('Notes', 'text'),
 singular='Transaction', plural='Check_Register')

 first referenced table:
 
 db.define_table('CoA',
 Field('Name', 'string'),
 Field('Notes', 'string'),
 singular='Bank', plural='Banks', format='%(Name)s')
 db.CoA.Name.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB(db, 'CoA.Name')]

 appadmin displays table rows just fine.

 clicking a record link in the id column to edit the record fails:

 Ticket ID 

 127.0.0.1.2019-06-06.11-23-25.64b3e296-56e8-4c9f-a875-5a0ae496f620
  'Account.Name' Version 
 web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03 
 Python Python 2.7.14: C:\Python27\python.exe (prefix: C:\Python27) 
 Traceback 

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 20.
 21.
 22.

 Traceback (most recent call last):
   File "C:\Users\David\Google Drive\My 
 Documents\OxCamNE.3.1\gluon\restricted.py", line 219, in restricted
 exec(ccode, environment)
   File "C:\Users\David\Google Drive\My 
 Documents\OxCamNE.3.1\applications\init\controllers/appadmin.py", line 
 695, in 
   File "C:\Users\David\Google Drive\My 
 Documents\OxCamNE.3.1\gluon\globals.py", line 421, in 
 self._caller = lambda f: f()
   File "C:\Users\David\Google Drive\My 
 Documents\OxCamNE.3.1\applications\init\controllers/appadmin.py", line 
 337, in update
 f='download', args=request.args[:1]))
   File "C:\Users\David\Google Drive\My 
 Document

[web2py] Re: 2.18.5 appadmin database administration fails when trying to edit record.

2019-06-07 Thread David Manns
This is a duplicate of 
https://groups.google.com/forum/#!topic/web2py/2oVcXiUCAiE this one 
originally seemed to disappear so I resubmitted it.

On Thursday, June 6, 2019 at 11:10:14 AM UTC-4, David Manns wrote:
>
> Here is my table definition:
>
> db.define_table('AccTrans',
> Field('Timestamp', 'datetime', default=request.now, writable=False),
> Field('Bank', 'reference Bank_Accounts', writable=False),#e.g. 
> PayPal, Cambridge Trust, ...
> Field('Account', 'reference CoA',
> requires=IS_IN_DB(db, 'CoA.id', '%(Name)s', orderby=
> db.CoA.Name)),
> Field('Event', 'reference Events',
> requires=IS_EMPTY_OR(IS_IN_DB(db, 'Events.id', 
> '%(Event)s', orderby=~db.Events.Date)),
> comment='leave blank if not applicable'),
> Field('Amount', 'decimal(8,2)',
> comment='enter full amount of check (negative) or deposit 
> (positive); split using Edit if multiple accounts',
> requires=IS_DECIMAL_IN_RANGE(-1, 1)),# >=0 for 
> asset/revenue, <0 for liability/expense
> Field('Fee', 'decimal(6,2)', 
> requires=IS_EMPTY_OR(IS_DECIMAL_IN_RANGE(-1000,100))),# e.g. PayPal 
> transaction fee, <0 (unless refunded)
> Field('CheckNumber', 'integer', default=None, 
> requires=IS_EMPTY_OR(IS_INT_IN_RANGE(1,9)),
> comment='enter check number if recording a check written'),
> Field('Accrual', 'boolean', default=True, readable=True, 
> writable=False),
> Field('FullAmt', 'decimal(8,2)', writable=False, readable=False),# 
> for an accrual, the original unsplit amount
> Field('Reference', 'string', writable=False),
> Field('Notes', 'text'),
> singular='Transaction', plural='Check_Register')
>
> The referenced table CoA looks like:
>
> db.define_table('CoA',
> Field('Name', 'string'),
> Field('Notes', 'string'),
> singular='Bank', plural='Banks', format='%(Name)s')
> db.CoA.Name.requires = [IS_NOT_EMPTY(), IS_NOT_IN_DB(db, 'CoA.Name')]
>
>
> Database administration displays the table rows just fine.
>
> Clicking on a record's id field should display the record for editing. 
> Instead I get an error, looks like when its setting up the widget for the 
> first reference field. In my application, grid and smartgrid have no 
> problem with my model.
>
>  'Account.Name' Version 
> web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03 
> Python Python 2.7.14: C:\Python27\python.exe (prefix: C:\Python27) 
> Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
>
> Traceback (most recent call last):
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\applications\init\controllers/appadmin.py", line 695, 
> in 
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\applications\init\controllers/appadmin.py", line 337, 
> in update
> f='download', args=request.args[:1]))
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\sqlhtml.py", line 1550, in __init__
> inp = self.widgets.options.widget(field, default)
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\sqlhtml.py", line 353, in widget
> options = requires[0].options()
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\packages\dal\pydal\validators.py", line 2742, in 
> _options
> options = self.other.options(*args, **kwargs)
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\packages\dal\pydal\validators.py", line 609, in 
> options
> self.build_set()
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\packages\dal\pydal\validators.py", line 604, in 
> build_set
> self.labels = [self.label % r for r in records]
>   File "C:\Users\David\Google Drive\My 
> Documents\OxCamNE.3.1\gluon\packages\dal\pydal\objects.py", line 103, in 
> __getitem__
> raise KeyError(key)
> KeyError: 'Account.Name'
>
> Error snapshot [image: help] 
> 
>  
>
> ('Account.Name') 
>
> inspect attributes 
> Frames 
>
>- 
>
>*File C:\Users\David\Google Drive\My 
>Documents\OxCamNE.3.1\gluon\restricted.py in restricted at line 219* 
>code arguments variables 
>- 
>
>*File C:\Users\David\Google Drive\My 
>Documents\OxCamNE.3.1\applications\init\controllers\appadmin.py in 
>  
>at line 695* code arguments variables 
>- 
>
>*File C:\Users\David\Google Drive\My 
>Documents\OxCamNE.3.1\gluon\globals.py in  at line 421* code 
>arguments variables 
>- 
>
>   

[web2py] Re: web2py on Raspbian and Python 2 or 3?

2019-06-07 Thread Val K
uWSGI is very cool, but since you are on Raspbian maybe gunicorn is more 
suitable?

https://dzone.com/articles/a-performance-analysis-of-python-wsgi-servers-part  
 

On Saturday, June 8, 2019 at 12:12:58 AM UTC+3, Dave S wrote:
>
>
>
> On Friday, June 7, 2019 at 2:37:54 AM UTC-7, lucas wrote:
>>
>> i can not for the life of me figure out where to change to the python3.5 
>> environment for web2py.  i tried changing the python symbolic link, and 
>> changed to python3.5 in multiple files under web2py main directory, uwsgi, 
>> etc., but i can not get web2py to boot straight into python3.5.  where is 
>> the secret spot.  i'm using nginx 1.10.3 and uwsgi 2.0.14 and the 
>> wsgihandler.py properly, etc.  lucas
>>
>
> You may not be able to do it with a distro build of uwsgi.  a quick Google 
> (tm) search found Stack Overflow articles, one of which pointed to
>  https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html#bonus-multiple-python-versions-for-the-same-uwsgi-binary
> >
>
> /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/edffced5-6b86-45b0-b3be-a0b9d6f7d775%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: nssm does not work

2019-06-07 Thread Dave S


On Wednesday, June 5, 2019 at 1:54:53 AM UTC-7, Niphlod wrote:
>
> what happened may differ from what you thought it should happen which may 
> differ from what needs to happen.
>
> said that, nssm just bootstrap the process. the fact that you have a 
> service up&running may already indicate that everything is running smoothly 
> but if you wanna do a check, open the task manager, go to details, see if 
> there's a web2py running (it may be useful to select the column holding the 
> command line)
>

Simone, I always enjoy posts by the masters.

Did you see the thread asking about scaling?  You have experience with a 
different infrastructure than I do.

/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/f3439be5-a908-46a9-a077-fcfd72317026%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: web2py managing capacity ?

2019-06-07 Thread Dave S


On Tuesday, June 4, 2019 at 12:00:09 PM UTC-7, Dave S wrote:
>
>
>
> On Tuesday, June 4, 2019 at 9:12:24 AM UTC-7, karthikeyan p wrote:
>>
>> sorry , 
>> Carlos Costa 
>> , i typed wrongly !
>>   its scalability , i want to know web2py apps scalability !
>>
>
> Well, that depends on your application (how much work your app does on a 
> request), your front end, and your database.
>
> With nginx + uwsgi as a front end on an AWS instance, I can sustain 2 
> requests per second with load usually staying below 0.10 (0.8-0.09 typical).
> SQLite3 was working for me until I got up around 500,000 entries, and 
> "database locked" conflicts crept up.  I switched to postgres and the 
> system almost fell over ... until I created an index.
>
>
For completeness, this is a t2.micro instance.
 

>
> Massimo has customer systems with a bigger load, and so do several 
> others.  I think most production systems are on a Linux host, but there are 
> a lot of IIS systems, as well.  The Scheduler code works well in both 
> enviornments.  Rocket on either Linux or Windows works fine for 
> development, but I've seen some issues with large files from Windows 
> clients (end-of-post not recognized; data stored only after timeout).
>
> Early tests of web3py are, Massimo says, "way faster".
>
> /dps
>
>
>
>
>
>> On Fri, May 24, 2019 at 8:22 PM Carlos Costa  wrote:
>>
>>> sociability?
>>>
>>> Em sex, 24 de mai de 2019 às 05:18, 黄祥  escreveu:
>>>
 how to use it with postgresql ? 
>

 pls set the uri connection first
 *e.g. private/appconfig.ini*
 uri = postgres://postgres:password@localhost/database_name

 *ref:*

 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Connection-strings-the-uri-parameter-
  

 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 web...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/web2py/9a708b39-7b1e-4c77-a4b3-49b7bdac9215%40googlegroups.com
  
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>> -- 
>>> At.
>>>
>>> Carlos J. Costa
>>> --
>>> Cientista da Computação - Esp. Gestão em Telecom
>>>
>>> -- 
>>> 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/eZogykbJDOY/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/CAGsD4Nw626C_QyRFDH0wz1bJ52WROSubFequnb4-p1h1WB5BOA%40mail.gmail.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/453f0a48-758b-49af-a81b-d5e32c86a342%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Web3py

2019-06-07 Thread Massimo Di Pierro
try a db.commit() after your define_table(s).

On Monday, 3 June 2019 08:16:27 UTC-7, John Bannister wrote:
>
> Hi All,
>
> Finally gotten round to playing again on the latest Web3py.
>
> On _scaffold app .. if I add new tables to model file and then reload from 
> the dashboard .. I get errors as follows:-
>
> File "C:\Users\johhb\py3\lib\site-packages\pydal\base.py", line 581, in 
> define_table
> raise SyntaxError('table already defined: %s' % tablename)
>   File "", line None
> SyntaxError: table already defined: auth_user_tag_groups
>
> Only way around it seems to be to delete contents of database folder and 
> restart.
>
> Dashboard app hangs on reload sometimes (I think it has to do the with 
> same issue above) and only way to get round it is to restart the server and 
> refresh the _dashboard app. 
>
> I really want to start using it to create a few new apps I am due to start 
> working on shortly even though I am well aware that it is not yet 
> production ready so will keep testing and assist wherever I can. Thanks 
> again for all the hard work put in so far I am sure its gonna be a really 
> cool solution.
>
> Best Regards
> John
>
>
> On Thursday, 16 May 2019 17:15:44 UTC+2, John Bannister wrote:
>>
>> Hi All,
>>
>> Had a first real 'play' with web3py' today and have a few questions the 
>> biggest of which I am hoping the gurus will be able to answer:-
>>
>> 1: Is there any way to not to have to restart the app every time changes 
>> are made to actions in the controller or new actions added etc? I 
>> understand that controllers are basically being imported when the app fires 
>> up but is any there any way to occasionally reload instead of having to 
>> restart the app? This is a fairly big one for me as sometimes tweaks will 
>> need to be made in production and restarting the web server is not really 
>> an option so hopefully I am missing something really simple.
>>
>> Thanks in advance
>> 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/33476d6d-05dd-4452-a67b-e919b06d08b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.