[web2py] Re: 2.17.2 is out

2018-12-06 Thread Massimo Di Pierro
Can I ask for a patch?

On Tuesday, 27 November 2018 09:42:35 UTC-8, Web2_3py wrote:
>
> for web2py version 2.17.2
>
> On Sunday, November 25, 2018 at 8:17:08 PM UTC+3, Web2_3py wrote:
>>
>>
>> *export_to_csv_file*
>>
>>
>> under python2 , no problem
>>
>> under python3 , the following problem
>>
>>   File 
>> "C:\Users\assus\Desktop\Flash\python3\web2py_2_17_2_src\web2py\gluon\packages\dal\pydal\objects.py",
>>  line 2619, in export_to_csv_file
>> writer.writerow(unquote_colnames(colnames))
>> TypeError: a bytes-like object is required, not 'str'
>>
>>
>>
>>
>>

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


[web2py] Re: Is it possible to share cache between two differente web2py applications?

2018-12-06 Thread Massimo Di Pierro
thanks

On Monday, 26 November 2018 06:49:36 UTC-8, Lisandro wrote:
>
> Thanks Massimo!
> I've recently noted that the fix I did was incomplete.
>
> I've sent a new pull request with the new code:
> https://github.com/web2py/web2py/pull/2059
>
> Regards,
> Lisandro.
>
> El domingo, 18 de noviembre de 2018, 16:06:37 (UTC-3), Massimo Di Pierro 
> escribió:
>>
>> approved! :-)
>>
>> On Wednesday, 14 November 2018 08:02:07 UTC-8, Lisandro wrote:
>>>
>>> I've created a pull request to achieve this:
>>> https://github.com/web2py/web2py/pull/2055
>>>
>>> If it's not accepted (which is totally ok with me), I would like to know 
>>> if I have some other alternative.
>>> Thanks!
>>>
>>> El lunes, 23 de enero de 2017, 17:29:22 (UTC-3), Lisandro escribió:

 I'm using RedisCache, and I've seen that web2py adds a prefix to all 
 the keys I store in the cache.
 For example, if I have an application called "master" and I do this:

 config = cache.redis('config', lambda: initialize_config(), time_expire
 =999)

 ... then the actual key used to store the data is "w2p:master:config"

 But, what about if I have two applications that need to share the 
 config?
 How can I tell web2py to use the same cache prefix for two specific 
 applications?



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


[web2py] Re: How to get tickets in DB working

2018-12-06 Thread Massimo Di Pierro
I opened a ticket about this until I can evaluate this further. But at the 
very list what you proposed should be an option.
https://github.com/web2py/web2py/issues/2062

On Friday, 23 November 2018 01:06:26 UTC-8, appjar...@gmail.com wrote:
>
> I had to modify Web2Py as follows to get tickets stored in the DB 
> (necessary for cloud deployment with no filesystem)
>
> It is working for tracebacks but not for snapshots. 
>
> I needed to modify Web2Py (version 2.17.2) to:
>
> 1) Use JSON instead of Pickle for serialization as Pickle has errors 
> serializing to MySQL (not sure about other databases)
> 2) Add extra error checking for the ticket-to-DB code path
> 3) set fake_migrate correctly when reading form and creating the error 
> table.
>
>
> The 2 files modified and attached to this message are:
> gluon/restricted.py
> applications/admin/controllers/default.py 
>
>
> Hopefully someone can get it working for snapshots as well and integrate 
> to the main line.
>
> Thanks,
> -Mike
>
>
>

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


Re: [web2py] Re: PostgreSQL log flooded with "could not receive data from client: Connection reset by peer" messages;

2018-12-06 Thread Tadas U
Sorry, yes, postgres is 9.3 by the way, forgot to mention


On Fri, 7 Dec 2018, 09:46 Massimo Di Pierro  What do you mean by "20 schedulers"? 20 workers? 20 tasks?
>
> On Sunday, 18 November 2018 10:46:35 UTC-8, Tadas U wrote:
>>
>> Web2py version: Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>>
>> AFAIK, the scheduler is responsible, e.x.:
>>
>> SETUP (e.x.):
>>
>> scheduler.queue_task(
>> 'test__task_insert', application_name='app', repeats=0,
>> period=60, timeout=3600, retry_failed=-1)
>>
>> def task_insert():
>> db.table.insert(title='abc')
>> db.commit()
>> # db.close()  -- same problem, doesn't matter
>>
>> scheduler = Scheduler(db, {
>> 'test__task_insert': task_insert
>> })
>>
>>
>> log output, when taks runs:
>> 
>> 2018-11-13 13:14:11 EET LOG:  duration: 0.029 ms  statement: BEGIN
>> 2018-11-13 13:14:11 EET LOG:  duration: 0.340 ms  statement: SELECT
>> scheduler_worker.id, scheduler_worker.worker_name,
>> scheduler_worker.first_heartbeat, scheduler_worker.last_heartbeat,
>> scheduler_worker.status, scheduler_worker.is_ticker,
>> scheduler_worker.group_names, scheduler_worker.worker_stats FROM
>> scheduler_worker WHERE (scheduler_worker.worker_name = 'web2py#8228');
>> 2018-11-13 13:14:11 EET LOG:  duration: 0.305 ms  statement: UPDATE
>> scheduler_worker SET status='ACTIVE',last_heartbeat='2018-11-13
>> 13:14:11',worker_stats='{"status": "RUNNING", "errors": 0, "workers": 1,
>> "queue": 1, "empty_runs": 0, "sleep": 3, "distribution": {"main":
>> {"workers": [{"c": 1, "name": "web2py#8228"}]}}, "total": 1}' WHERE
>> (scheduler_worker.worker_name = 'web2py#8228');
>> 2018-11-13 13:14:11 EET LOG:  duration: 1.890 ms  statement: COMMIT
>> 2018-11-13 13:14:11 EET LOG:  duration: 0.067 ms  statement: BEGIN
>> 2018-11-13 13:14:11 EET LOG:  duration: 0.046 ms  statement: SET
>> CLIENT_ENCODING TO 'UTF8'
>> 2018-11-13 13:14:11 EET LOG:  duration: 0.020 ms  statement: SET
>> standard_conforming_strings=on;
>> 2018-11-13 13:14:11 EET LOG:  duration: 0.047 ms  statement: COMMIT
>> 2018-11-13 13:14:12 EET LOG:  duration: 0.029 ms  statement: BEGIN
>> 2018-11-13 13:14:12 EET LOG:  duration: 2.413 ms  statement: INSERT INTO
>> table(title) VALUES ('abc');
>> 2018-11-13 13:14:12 EET LOG:  duration: 2.594 ms  statement: COMMIT
>> 2018-11-13 13:14:12 EET LOG:  could not receive data from client:
>> Connection reset by peer
>> 2018-11-13 13:14:12 EET LOG:  duration: 0.029 ms  statement: BEGIN
>> 2018-11-13 13:14:12 EET LOG:  duration: 0.285 ms  statement: DELETE FROM
>> scheduler_run WHERE (scheduler_run.id = 967703);
>> 2018-11-13 13:14:12 EET LOG:  duration: 0.306 ms  statement: UPDATE
>> scheduler_task SET status='QUEUED',next_run_time='2018-11-13
>> 13:15:11',times_run=93796,times_failed=0 WHERE (scheduler_task.id = 371);
>> 2018-11-13 13:14:12 EET LOG:  duration: 2.426 ms  statement: COMMIT
>> 2018-11-13 13:14:12 EET LOG:  duration: 0.024 ms  statement: BEGIN
>> 
>>
>> PROBLEM:  "2018-11-13 13:14:12 EET LOG:  could not receive data from
>> client: Connection reset by peer"
>> We have ~20 ish active schedulers, so the log gets flooded a lot,
>> basically:
>>
>> 2018-11-13 09:21:00 EET LOG:  could not receive data from client:
>> Connection reset by peer
>> 2018-11-13 09:21:00 EET LOG:  could not receive data from client:
>> Connection reset by peer
>> 2018-11-13 09:21:00 EET LOG:  could not receive data from client:
>> Connection reset by peer
>> 2018-11-13 09:21:16 EET LOG:  could not receive data from client:
>> Connection reset by peer
>> 2018-11-13 09:21:46 EET LOG:  could not receive data from client:
>> Connection reset by peer
>> 2018-11-13 09:22:00 EET LOG:  could not receive data from client:
>> Connection reset by peer
>> 2018-11-13 09:22:00 EET LOG:  could not receive data from client:
>> Connection reset by peer
>> 2018-11-13 09:22:01 EET LOG:  could not receive data from client:
>> Connection reset by peer
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: PostgreSQL log flooded with "could not receive data from client: Connection reset by peer" messages;

2018-12-06 Thread Massimo Di Pierro
What do you mean by "20 schedulers"? 20 workers? 20 tasks?

On Sunday, 18 November 2018 10:46:35 UTC-8, Tadas U wrote:
>
> Web2py version: Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>
> AFAIK, the scheduler is responsible, e.x.:
>
> SETUP (e.x.):
>
> scheduler.queue_task(
> 'test__task_insert', application_name='app', repeats=0, period=60, 
> timeout=3600, retry_failed=-1)
>
> def task_insert():
> db.table.insert(title='abc')
> db.commit()
> # db.close()  -- same problem, doesn't matter
>
> scheduler = Scheduler(db, {
> 'test__task_insert': task_insert
> })
>
>
> log output, when taks runs:
> 
> 2018-11-13 13:14:11 EET LOG:  duration: 0.029 ms  statement: BEGIN
> 2018-11-13 13:14:11 EET LOG:  duration: 0.340 ms  statement: SELECT  
> scheduler_worker.id, scheduler_worker.worker_name, 
> scheduler_worker.first_heartbeat, scheduler_worker.last_heartbeat, 
> scheduler_worker.status, scheduler_worker.is_ticker, 
> scheduler_worker.group_names, scheduler_worker.worker_stats FROM 
> scheduler_worker WHERE (scheduler_worker.worker_name = 'web2py#8228');
> 2018-11-13 13:14:11 EET LOG:  duration: 0.305 ms  statement: UPDATE 
> scheduler_worker SET status='ACTIVE',last_heartbeat='2018-11-13 
> 13:14:11',worker_stats='{"status": "RUNNING", "errors": 0, "workers": 1, 
> "queue": 1, "empty_runs": 0, "sleep": 3, "distribution": {"main": 
> {"workers": [{"c": 1, "name": "web2py#8228"}]}}, "total": 1}' WHERE 
> (scheduler_worker.worker_name = 'web2py#8228');
> 2018-11-13 13:14:11 EET LOG:  duration: 1.890 ms  statement: COMMIT
> 2018-11-13 13:14:11 EET LOG:  duration: 0.067 ms  statement: BEGIN
> 2018-11-13 13:14:11 EET LOG:  duration: 0.046 ms  statement: SET 
> CLIENT_ENCODING TO 'UTF8'
> 2018-11-13 13:14:11 EET LOG:  duration: 0.020 ms  statement: SET 
> standard_conforming_strings=on;
> 2018-11-13 13:14:11 EET LOG:  duration: 0.047 ms  statement: COMMIT
> 2018-11-13 13:14:12 EET LOG:  duration: 0.029 ms  statement: BEGIN
> 2018-11-13 13:14:12 EET LOG:  duration: 2.413 ms  statement: INSERT INTO 
> table(title) VALUES ('abc');
> 2018-11-13 13:14:12 EET LOG:  duration: 2.594 ms  statement: COMMIT
> 2018-11-13 13:14:12 EET LOG:  could not receive data from client: 
> Connection reset by peer
> 2018-11-13 13:14:12 EET LOG:  duration: 0.029 ms  statement: BEGIN
> 2018-11-13 13:14:12 EET LOG:  duration: 0.285 ms  statement: DELETE FROM 
> scheduler_run WHERE (scheduler_run.id = 967703);
> 2018-11-13 13:14:12 EET LOG:  duration: 0.306 ms  statement: UPDATE 
> scheduler_task SET status='QUEUED',next_run_time='2018-11-13 
> 13:15:11',times_run=93796,times_failed=0 WHERE (scheduler_task.id = 371);
> 2018-11-13 13:14:12 EET LOG:  duration: 2.426 ms  statement: COMMIT
> 2018-11-13 13:14:12 EET LOG:  duration: 0.024 ms  statement: BEGIN
> 
>
> PROBLEM:  "2018-11-13 13:14:12 EET LOG:  could not receive data from 
> client: Connection reset by peer"
> We have ~20 ish active schedulers, so the log gets flooded a lot, 
> basically:
>
> 2018-11-13 09:21:00 EET LOG:  could not receive data from client: 
> Connection reset by peer
> 2018-11-13 09:21:00 EET LOG:  could not receive data from client: 
> Connection reset by peer
> 2018-11-13 09:21:00 EET LOG:  could not receive data from client: 
> Connection reset by peer
> 2018-11-13 09:21:16 EET LOG:  could not receive data from client: 
> Connection reset by peer
> 2018-11-13 09:21:46 EET LOG:  could not receive data from client: 
> Connection reset by peer
> 2018-11-13 09:22:00 EET LOG:  could not receive data from client: 
> Connection reset by peer
> 2018-11-13 09:22:00 EET LOG:  could not receive data from client: 
> Connection reset by peer
> 2018-11-13 09:22:01 EET LOG:  could not receive data from client: 
> Connection reset by peer
>
>

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


[web2py] Re: machine learning

2018-12-06 Thread Massimo Di Pierro
Yes. Th recommended way is that you use the scheduler. You can use web2py 
to create an interface and you call your module using the scheduler. That 
way the UI does not have to wait while the computation runs in background. 
There is an example in the book.

On Sunday, 18 November 2018 10:46:35 UTC-8, Devyansh Bansal wrote:
>
> i want to run machine learning code written in jupyter converted in .py on 
> my website as a face login any help ??
>

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


[web2py] Problem in Ubuntu 18.04

2018-12-06 Thread carlos valdez
Hi, I have the next problem trying to running web2py, the problem is, I've 
a old project, the guys used 2.9 framework, I'm trying to run it in 
ubutuntu 18.04, It seems to work but when I access to de url 
https://127.0.0.1/, it shows me an error, but, I can't see the error, 
becouse when I try to see the ticket, It shows me a new error, I  tryed to 
look in logs, but no logs are generated, I'm a newie, I need some help, 
because I don't know what to do.

Thanks


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


[web2py] multi-level form acceptance

2018-12-06 Thread pradeep chauhan
hi,
i want to send form which i created to some person, if that person accepts 
the application it will be sent to 2nd person for approval and so on..how 
can i do that?

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


[web2py] "web2py.app“ wants access to control “System Events.app“

2018-12-06 Thread John McMaster

Just installed web2py 2.17.2 on Mojave 10.14.1:

I get this message:

"web2py.app“ wants access to control “System Events.app“. Allowing control 
will provide access to documents and data in “System Events.app“, and to 
perform actions within that app.

Are there any issues by allowing this?
Security etc?

Can anyone enlighten me on what this is doing?


Thank you,

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


[web2py] How to create an administration account (Sahana eden)

2018-12-06 Thread Muhammad Ahsan Farooqui

Hi,

I have just added an instance of sahana eden. How can I add an admin user 
to it? I added one user but it is not admin user so I cannot access db etc. 

Please help. 

Ahsan

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


[web2py] Help with deploy with nginx and ubuntu 18.04

2018-12-06 Thread carlos valdez
Hi, I'm a noob with web2py, I need some help, because I'm trying to put a 
site online, for a old project developed in web2py 2.9.5.

I need use nginx as a app server, I know I need to use uwsgi, but I'm a 
little confused with the configuration.

I used the script  setup-web2py-nginx-uwsgi-ubuntu.sh, but it didn't work.

Thanks in advance

Regards

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


[web2py] Conditional Checks on output from DB.Select statements?

2018-12-06 Thread arjunmjarun


I am writing a simple web2py application and can't seem to figure out how 
to run comparison checks on variables from db.select statements. Code is 
posted below:


form = FORM('Enter Member ID: ', INPUT(_type='text', _name='name'),
   INPUT(_type='submit', _value='submit'))
if form.accepts(request, session):
member_id= form.vars.name
measure_1 = 
db(db.Detailed_Info.MEMBER_NBR==form.vars.name).select(db.Detailed_Info.MEASURE_1)
measure_2 = 
db(db.Detailed_Info.MEMBER_NBR==form.vars.name).select(db.Detailed_Info.MEASURE_2)
response.flash = 'Form Accepted'

if measure_1=='DBD':
   test = 'IT WORKED'else: 
   test = 'IT DIDNT WORK'
return dict(form=form, test=test)



My question is, I am able to see that the value from the first select statement 
(that defines variable measure_1) is in fact 'DBD'. But the if statement 
conditional at the bottom isn't working. I feel it's because the result of the 
select statement is a "row" object. Is there a way to extract the actual value?


Thank you!

down votefavorI am writing a simple web2py application and can't seem to 
figure out how to run comparison checks on variables from db.select 
statements. Code is posted below: 


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


[web2py] upload a photo to your site by >

2018-12-06 Thread Morteza Tabibi
Hello everyone
I just started designing web2py I have a problem I can not upload a photo 
to your site with the command >
  And my operating system is Linux, thanks for giving me an example guide

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


[web2py] Re: New production install Ubuntu/nginx/uwsgi - connect to redis

2018-12-06 Thread Jim S
Ok, I appear to have it working:

Here's what I did.  I need someone much smarter than me to determine 
whether or not this is wise:

Original web2py/gluon/globals.py at line 1230
dd = dict(locked=False,
  client_ip=response.session_client,
  modified_datetime=request.now,
  session_data=session_pickled,
  unique_key=unique_key)

I changed it to:
dd = dict(locked='False',
  client_ip=response.session_client,
  modified_datetime=str(request.now),
  session_data=session_pickled,
  unique_key=unique_key)

Now it is working for me.

-Jim



On Thursday, December 6, 2018 at 4:04:01 PM UTC-6, Jim S wrote:
>
> Yes, same result.
>
> I clear history/cookies and still got the message
>
> I tried a private window and it happened.
>
> Also got the same result testing from a different browser.
>
> -Jim
>
> On Thursday, December 6, 2018 at 3:37:10 PM UTC-6, Leonel Câmara wrote:
>>
>> Does this still happen if you clear the cookies in the browser (or use a 
>> private window) before visiting the URL?
>>
>

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


[web2py] Re: New production install Ubuntu/nginx/uwsgi - connect to redis

2018-12-06 Thread Jim S
Yes, same result.

I clear history/cookies and still got the message

I tried a private window and it happened.

Also got the same result testing from a different browser.

-Jim

On Thursday, December 6, 2018 at 3:37:10 PM UTC-6, Leonel Câmara wrote:
>
> Does this still happen if you clear the cookies in the browser (or use a 
> private window) before visiting the URL?
>

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


Re: [web2py] DAL issues ....

2018-12-06 Thread Jim Steil
Thanks Ben

On Thu, Dec 6, 2018 at 3:42 PM Ben Duncan  wrote:

> Controller Code:
>
> def company_login():
>
> form = SQLFORM.factory(
> Field('username', label = 'User Name', requires=IS_NOT_EMPTY()),
> Field('password', 'password', label =
> "Password",requires=IS_NOT_EMPTY()),
> Field('Company', label = 'Court ID',
>
> requires=IS_IN_DB(db,db.company.company_number,'%(company_name)s')),
> submit_button=' Login ',
> )
>
> if form.process().accepted:
>response.flash = 'form accepted'
> elif form.errors:
>response.flash = T('form has errors')
>
> session.company = request.vars['Company']
>
> Company_ID = session.company
>
> if session.company :
>DbRows = db(db.company.company_number==Company_ID).select().first()
>session.company_data = DbRows
>session.company_name = DbRows.company_name
>session.company_ap_aging = DbRows.
>
> return dict(form=form)
>
> The reason I need this setup is that this is the Company Record that
> controls all aspects of
> the system (see ap_apaging_days). It also controls what sub-apps are on
> and off ...
>
>
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 6, 2018 at 2:59 PM Jim S  wrote:
>
>> I'd love to see the final controller code if you have the time?
>>
>> Also, I'm curious as to why you're putting all this in the session.  Why
>> not just pass it in the dict being returned to the view?
>>
>> -Jim
>>
>> On Thursday, December 6, 2018 at 2:46:22 PM UTC-6, Ben Duncan wrote:
>>>
>>> Ok, YOU GUYS are awesome ...
>>> Your replies gave me the insight I needed !
>>>
>>> Here is the explanation:
>>>
>>> A: in the database, the passes were for the "lookup" in the
>>> SQLFORM.factory
>>>SO there was the confusion there ...
>>>
>>> B: It seems there is a 2 passes thru the controller (which this group
>>> gave me the hint at it)
>>> The failure was at the first pass when nothing was set ...
>>> putting this in:
>>>
>>> if session.company :
>>>DbRows =
>>> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
>>>session.company_data = DbRows
>>>session.company_name = DbRows.company_name
>>>
>>> Allowed me to PASS unharmed and get what I needed.
>>>
>>> THANKS Again, group 
>>>
>>>
>>> .
>>> *Ben Duncan*
>>> DBA / Chief Software Architect
>>> Mississippi State Supreme Court
>>> Electronic Filing Division
>>>
>>>
>>> On Thu, Dec 6, 2018 at 2:21 PM Ben Duncan  wrote:
>>>
 The request.vars get set from the SQL form in the controller
 Removed all the COMMENTS, and in the controller put a print and changed
 the code:

 DbRows =
 db(db.company.company_number==Company_ID).select(db.company.company_name).first()
 print DbRows['company_name']
 session.company_data = DbRows
 return dict(form=form,DbRows=DbRows)

 And still getting a failure now on the print line ...

 Ticket ID

 10.13.69.144.2018-12-06.13-53-08.f35db77f-72f8-4749-82e9-90eda4c32141
  'NoneType' object has no attribute
 '__getitem__' Version
 web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
 Python Python 2.7.13: /usr/bin/python (prefix:
 /opt/rh/python27/root/usr) Traceback

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.

 Traceback (most recent call last):
   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
 exec(ccode, environment)
   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
 , line 
 101, in 
   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
 self._caller = lambda f: f()
   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
 , line 
 87, in company_login
 print DbRows['company_name']
 TypeError: 'NoneType' object has no attribute '__getitem__'



 It's very strange how :
  session.company_data = DbRows
 Gets passed.

 However, looking at the postgres logs:
  2018-12-06 14:18:31.482 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
 statement: SELECT "company"."company_name", "company"."company_number" FROM
 "company" WHERE ("company"."company_number" IS NOT NULL) ORDER BY
 "company"."company_name", "company"."company_number";
 < 2018-12-06 14:18:31.488 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
 statement: SELECT "company"."company_name" FROM "company" WHERE
 ("company"."company_number" IS NULL);
 < 2018-12-06 14:18:31.505 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
 statement: COMMIT
 < 2018-12-06 14:18:35.282 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
 statement: BEGIN

Re: [web2py] DAL issues ....

2018-12-06 Thread Ben Duncan
Controller Code:

def company_login():

form = SQLFORM.factory(
Field('username', label = 'User Name', requires=IS_NOT_EMPTY()),
Field('password', 'password', label =
"Password",requires=IS_NOT_EMPTY()),
Field('Company', label = 'Court ID',

requires=IS_IN_DB(db,db.company.company_number,'%(company_name)s')),
submit_button=' Login ',
)

if form.process().accepted:
   response.flash = 'form accepted'
elif form.errors:
   response.flash = T('form has errors')

session.company = request.vars['Company']

Company_ID = session.company

if session.company :
   DbRows = db(db.company.company_number==Company_ID).select().first()
   session.company_data = DbRows
   session.company_name = DbRows.company_name
   session.company_ap_aging = DbRows.

return dict(form=form)

The reason I need this setup is that this is the Company Record that
controls all aspects of
the system (see ap_apaging_days). It also controls what sub-apps are on and
off ...



*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 6, 2018 at 2:59 PM Jim S  wrote:

> I'd love to see the final controller code if you have the time?
>
> Also, I'm curious as to why you're putting all this in the session.  Why
> not just pass it in the dict being returned to the view?
>
> -Jim
>
> On Thursday, December 6, 2018 at 2:46:22 PM UTC-6, Ben Duncan wrote:
>>
>> Ok, YOU GUYS are awesome ...
>> Your replies gave me the insight I needed !
>>
>> Here is the explanation:
>>
>> A: in the database, the passes were for the "lookup" in the
>> SQLFORM.factory
>>SO there was the confusion there ...
>>
>> B: It seems there is a 2 passes thru the controller (which this group
>> gave me the hint at it)
>> The failure was at the first pass when nothing was set ...
>> putting this in:
>>
>> if session.company :
>>DbRows =
>> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
>>session.company_data = DbRows
>>session.company_name = DbRows.company_name
>>
>> Allowed me to PASS unharmed and get what I needed.
>>
>> THANKS Again, group 
>>
>>
>> .
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Thu, Dec 6, 2018 at 2:21 PM Ben Duncan  wrote:
>>
>>> The request.vars get set from the SQL form in the controller
>>> Removed all the COMMENTS, and in the controller put a print and changed
>>> the code:
>>>
>>> DbRows =
>>> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
>>> print DbRows['company_name']
>>> session.company_data = DbRows
>>> return dict(form=form,DbRows=DbRows)
>>>
>>> And still getting a failure now on the print line ...
>>>
>>> Ticket ID
>>>
>>> 10.13.69.144.2018-12-06.13-53-08.f35db77f-72f8-4749-82e9-90eda4c32141
>>>  'NoneType' object has no attribute
>>> '__getitem__' Version
>>> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
>>> Python Python 2.7.13: /usr/bin/python (prefix:
>>> /opt/rh/python27/root/usr) Traceback
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>>
>>> Traceback (most recent call last):
>>>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
>>> exec(ccode, environment)
>>>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
>>> , line 
>>> 101, in 
>>>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
>>> self._caller = lambda f: f()
>>>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
>>> , line 
>>> 87, in company_login
>>> print DbRows['company_name']
>>> TypeError: 'NoneType' object has no attribute '__getitem__'
>>>
>>>
>>>
>>> It's very strange how :
>>>  session.company_data = DbRows
>>> Gets passed.
>>>
>>> However, looking at the postgres logs:
>>>  2018-12-06 14:18:31.482 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
>>> statement: SELECT "company"."company_name", "company"."company_number" FROM
>>> "company" WHERE ("company"."company_number" IS NOT NULL) ORDER BY
>>> "company"."company_name", "company"."company_number";
>>> < 2018-12-06 14:18:31.488 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
>>> statement: SELECT "company"."company_name" FROM "company" WHERE
>>> ("company"."company_number" IS NULL);
>>> < 2018-12-06 14:18:31.505 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
>>> statement: COMMIT
>>> < 2018-12-06 14:18:35.282 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
>>> statement: BEGIN
>>> < 2018-12-06 14:18:35.282 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
>>> statement: SELECT 1;
>>> < 2018-12-06 14:18:35.475 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
>>> statement: SELECT "company"."company_name", "company"."company_number" FROM

[web2py] Re: New production install Ubuntu/nginx/uwsgi - connect to redis

2018-12-06 Thread Leonel Câmara
Does this still happen if you clear the cookies in the browser (or use a 
private window) before visiting the URL?

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


Re: [web2py] DAL issues ....

2018-12-06 Thread Jim S
I'd love to see the final controller code if you have the time?

Also, I'm curious as to why you're putting all this in the session.  Why 
not just pass it in the dict being returned to the view?

-Jim

On Thursday, December 6, 2018 at 2:46:22 PM UTC-6, Ben Duncan wrote:
>
> Ok, YOU GUYS are awesome ...
> Your replies gave me the insight I needed !
>
> Here is the explanation:
>
> A: in the database, the passes were for the "lookup" in the SQLFORM.factory
>SO there was the confusion there ...
>
> B: It seems there is a 2 passes thru the controller (which this group gave 
> me the hint at it)
> The failure was at the first pass when nothing was set ...
> putting this in:
>
> if session.company :
>DbRows = 
> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
>session.company_data = DbRows
>session.company_name = DbRows.company_name
>
> Allowed me to PASS unharmed and get what I needed.
>
> THANKS Again, group 
>
>
> .
> *Ben Duncan*
> DBA / Chief Software Architect 
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 6, 2018 at 2:21 PM Ben Duncan > 
> wrote:
>
>> The request.vars get set from the SQL form in the controller
>> Removed all the COMMENTS, and in the controller put a print and changed 
>> the code:
>>
>> DbRows = 
>> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
>> print DbRows['company_name']
>> session.company_data = DbRows
>> return dict(form=form,DbRows=DbRows)
>>
>> And still getting a failure now on the print line ...
>>
>> Ticket ID 
>>
>> 10.13.69.144.2018-12-06.13-53-08.f35db77f-72f8-4749-82e9-90eda4c32141
>>  'NoneType' object has no attribute 
>> '__getitem__' Version 
>> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02 
>> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr) 
>> Traceback 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>>
>> Traceback (most recent call last):
>>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
>> exec(ccode, environment)
>>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
>> , line 
>> 101, in 
>>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
>> self._caller = lambda f: f()
>>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
>> , line 
>> 87, in company_login
>> print DbRows['company_name']
>> TypeError: 'NoneType' object has no attribute '__getitem__'
>>
>>
>>
>> It's very strange how :
>>  session.company_data = DbRows
>> Gets passed.
>>
>> However, looking at the postgres logs:
>>  2018-12-06 14:18:31.482 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:  
>> statement: SELECT "company"."company_name", "company"."company_number" FROM 
>> "company" WHERE ("company"."company_number" IS NOT NULL) ORDER BY 
>> "company"."company_name", "company"."company_number";
>> < 2018-12-06 14:18:31.488 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:  
>> statement: SELECT "company"."company_name" FROM "company" WHERE 
>> ("company"."company_number" IS NULL);
>> < 2018-12-06 14:18:31.505 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:  
>> statement: COMMIT
>> < 2018-12-06 14:18:35.282 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:  
>> statement: BEGIN
>> < 2018-12-06 14:18:35.282 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:  
>> statement: SELECT 1;
>> < 2018-12-06 14:18:35.475 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:  
>> statement: SELECT "company"."company_name", "company"."company_number" FROM 
>> "company" WHERE ("company"."company_number" IS NOT NULL) ORDER BY 
>> "company"."company_name", "company"."company_number";
>> < 2018-12-06 14:18:35.485 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:  
>> statement: SELECT "company"."company_name" FROM "company" WHERE 
>> ("company"."company_number" = 13);
>> < 2018-12-06 14:18:35.505 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:  
>> statement: COMMIT
>>
>> It seems to be making 2 passes thru the DB
>>
>> Allows the  the session variable to be set 
>> *Ben Duncan*
>> DBA / Chief Software Architect 
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Thu, Dec 6, 2018 at 1:30 PM Val K > 
>> wrote:
>>
>>> Maybe I don't understand something, but I think that when the controller 
>>> is requested for the first time there is no any request.vars and 
>>> request.vars['Company'] too. Just in case: form.process() doesn't interrupt 
>>> controller execution
>>>
>>> -- 
>>> 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 

Re: [web2py] DAL issues ....

2018-12-06 Thread Ben Duncan
Ok, YOU GUYS are awesome ...
Your replies gave me the insight I needed !

Here is the explanation:

A: in the database, the passes were for the "lookup" in the SQLFORM.factory
   SO there was the confusion there ...

B: It seems there is a 2 passes thru the controller (which this group gave
me the hint at it)
The failure was at the first pass when nothing was set ...
putting this in:

if session.company :
   DbRows =
db(db.company.company_number==Company_ID).select(db.company.company_name).first()
   session.company_data = DbRows
   session.company_name = DbRows.company_name

Allowed me to PASS unharmed and get what I needed.

THANKS Again, group 


.
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 6, 2018 at 2:21 PM Ben Duncan  wrote:

> The request.vars get set from the SQL form in the controller
> Removed all the COMMENTS, and in the controller put a print and changed
> the code:
>
> DbRows =
> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
> print DbRows['company_name']
> session.company_data = DbRows
> return dict(form=form,DbRows=DbRows)
>
> And still getting a failure now on the print line ...
>
> Ticket ID
>
> 10.13.69.144.2018-12-06.13-53-08.f35db77f-72f8-4749-82e9-90eda4c32141
>  'NoneType' object has no attribute
> '__getitem__' Version
> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
>
> Traceback (most recent call last):
>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> , line 
> 101, in 
>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> , line 87, 
> in company_login
> print DbRows['company_name']
> TypeError: 'NoneType' object has no attribute '__getitem__'
>
>
>
> It's very strange how :
>  session.company_data = DbRows
> Gets passed.
>
> However, looking at the postgres logs:
>  2018-12-06 14:18:31.482 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: SELECT "company"."company_name", "company"."company_number" FROM
> "company" WHERE ("company"."company_number" IS NOT NULL) ORDER BY
> "company"."company_name", "company"."company_number";
> < 2018-12-06 14:18:31.488 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: SELECT "company"."company_name" FROM "company" WHERE
> ("company"."company_number" IS NULL);
> < 2018-12-06 14:18:31.505 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: COMMIT
> < 2018-12-06 14:18:35.282 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: BEGIN
> < 2018-12-06 14:18:35.282 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: SELECT 1;
> < 2018-12-06 14:18:35.475 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: SELECT "company"."company_name", "company"."company_number" FROM
> "company" WHERE ("company"."company_number" IS NOT NULL) ORDER BY
> "company"."company_name", "company"."company_number";
> < 2018-12-06 14:18:35.485 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: SELECT "company"."company_name" FROM "company" WHERE
> ("company"."company_number" = 13);
> < 2018-12-06 14:18:35.505 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
> statement: COMMIT
>
> It seems to be making 2 passes thru the DB
>
> Allows the  the session variable to be set
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 6, 2018 at 1:30 PM Val K  wrote:
>
>> Maybe I don't understand something, but I think that when the controller
>> is requested for the first time there is no any request.vars and
>> request.vars['Company'] too. Just in case: form.process() doesn't interrupt
>> controller execution
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe 

Re: [web2py] DAL issues ....

2018-12-06 Thread Ben Duncan
The request.vars get set from the SQL form in the controller
Removed all the COMMENTS, and in the controller put a print and changed the
code:

DbRows =
db(db.company.company_number==Company_ID).select(db.company.company_name).first()
print DbRows['company_name']
session.company_data = DbRows
return dict(form=form,DbRows=DbRows)

And still getting a failure now on the print line ...

Ticket ID

10.13.69.144.2018-12-06.13-53-08.f35db77f-72f8-4749-82e9-90eda4c32141
 'NoneType' object has no attribute
'__getitem__' Version
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

Traceback (most recent call last):
  File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
,
line 101, in 
  File "/data/web2py/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
,
line 87, in company_login
print DbRows['company_name']
TypeError: 'NoneType' object has no attribute '__getitem__'



It's very strange how :
 session.company_data = DbRows
Gets passed.

However, looking at the postgres logs:
 2018-12-06 14:18:31.482 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: SELECT "company"."company_name", "company"."company_number" FROM
"company" WHERE ("company"."company_number" IS NOT NULL) ORDER BY
"company"."company_name", "company"."company_number";
< 2018-12-06 14:18:31.488 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: SELECT "company"."company_name" FROM "company" WHERE
("company"."company_number" IS NULL);
< 2018-12-06 14:18:31.505 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: COMMIT
< 2018-12-06 14:18:35.282 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: BEGIN
< 2018-12-06 14:18:35.282 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: SELECT 1;
< 2018-12-06 14:18:35.475 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: SELECT "company"."company_name", "company"."company_number" FROM
"company" WHERE ("company"."company_number" IS NOT NULL) ORDER BY
"company"."company_name", "company"."company_number";
< 2018-12-06 14:18:35.485 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: SELECT "company"."company_name" FROM "company" WHERE
("company"."company_number" = 13);
< 2018-12-06 14:18:35.505 CST SessId: 5c0981bd.6e70  TrxId: 0>LOG:
statement: COMMIT

It seems to be making 2 passes thru the DB

Allows the  the session variable to be set
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 6, 2018 at 1:30 PM Val K  wrote:

> Maybe I don't understand something, but I think that when the controller
> is requested for the first time there is no any request.vars and
> request.vars['Company'] too. Just in case: form.process() doesn't interrupt
> controller execution
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] DAL issues ....

2018-12-06 Thread Val K
Maybe I don't understand something, but I think that when the controller is 
requested for the first time there is no any request.vars and 
request.vars['Company'] too. Just in case: form.process() doesn't interrupt 
controller execution

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


Re: [web2py] Re: DAL issues ....

2018-12-06 Thread Jim S
It looks like the second line of your view if reassigning something else to 
session.company.  I don't believe the HTML comment tags are not going to 
prevent web2py from executing that statement.

-Jim

On Thursday, December 6, 2018 at 12:22:30 PM UTC-6, Ben Duncan wrote:
>
> Well I was thinking that, BUT:  I'm ALMOST convinced there is a bug in the 
> latest web2py:
>
> CODE 
> --
> Snippet of controllers/default.py
>
> session.company = request.vars['Company']
> Company_ID = "This is a %s of type %s " % (session.company, 
> type(session.company))
> Company_ID = session.company
>
> DbRows = 
> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
> # Co_Name = DbRows['company_name']
>
> session.company_data = DbRows
>
> From view/default/company_login.html:
> {{extend 'layout.html'}}
> 
>
>  onclick="location.href='{{=URL('index')}}'"/>
>
> HOME
>
> Input form
> {{=form}}
> Submitted variables
> {{=BEAUTIFY(request.vars)}}
> {{=(request.vars)}}
>
> Company vars: {{=(request.vars['Company'])}}
> Company session: {{=(session.company)}}
> session data: {{=(session.company_data)}}
>
> Will Display The following:
> (top of form omitted ...)
> . Submitted variables 
> Company : 
> 5
> password : 
> makeit1
> username : 
> be...@linux4ms.net 
> ', 'Company': '5', 
> 'password': 'makeit1', '_formkey': '65ee8396-aac0-4b5c-a255-00be7e7b01ca', 
> '_formname': 'no_table/create'}> Company vars: 5 Company session: 5 session 
> data: 
>
> ___
>
> However, any type of referencing or attempt to do anything with either 
> session.company_date or DbRows 
> always gives a "Nonetype" error of various subtypes (such as __getitem__)
>
> Uncommenting the controller code  of  "# Co_Name = DbRows['company_name']"
> gives the error:
>
> Ticket ID 
>
> 10.13.69.144.2018-12-06.12-17-59.81fd7ae1-6523-47ad-94c7-7b1b480179bd
>  'NoneType' object has no attribute 
> '__getitem__' Version 
> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02 
> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr) 
> Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
>
> Traceback (most recent call last):
>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> , line 98, 
> in 
>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> , line 84, 
> in company_login
> Co_Name = DbRows['company_name']
> TypeError: 'NoneType' object has no attribute '__getitem__'
>
>
> As one can see , the Row item exists, it just seems there is no way to get 
> to it ...
>
> Any other ideas ?
>
>
> *Ben Duncan*
> DBA / Chief Software Architect 
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 6, 2018 at 9:09 AM Leonel Câmara  > wrote:
>
>> What's happening here is that DbRows can become None in this line
>>
>>DbRows = 
>> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
>>
>> So when you do DbRows['company_name'] you can get that error.
>>
>> Basically you need to check if DbRows is None and raise HTTP(404)
>>
>> -- 
>> 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+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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


[web2py] Re: DAL issues ....

2018-12-06 Thread Jim S
Can you try passing DbRows to your view and see if that works?

return dict(form=form, DbRows=DbRows)

Or, throw a print statement in there before session.company_name = 
DbRows['company_name'] to see if DbRows['company_name'] has a value before 
sending to the view?

-Jim



On Thursday, December 6, 2018 at 7:42:27 AM UTC-6, Ben Duncan wrote:
>
> How can something that seems so simple, be so hard? 
>
> I can't seem to get a SINGLE field from the database from DAL:
>
> First is the Error Message (Or on of the many types - but the latest one), 
> then the code
>
> What AM I doing wrong here ?
>
> Als always, thanks ...
>
> Error Message:
> Error ticket for "Mec" Ticket ID 
>
> 10.13.69.144.2018-12-06.07-32-29.8fda8fd6-fe14-47f4-b508-14ce2346465e
>  'NoneType' object has no attribute 
> '__getitem__' Version 
> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02 
> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr) 
> Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
>
> Traceback (most recent call last):
>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> , line 96, 
> in 
>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> , line 87, 
> in company_login
> session.company_name = DbRows['company_name']
> TypeError: 'NoneType' object has no attribute '__getitem__'
>
> Error snapshot [image: help] 
> 
>  
>
> ('NoneType' object has no attribute 
> '__getitem__') 
>  Code Here  
> --
>  Ok - Code for controller/default.py
>
> def company_login():
> company.company_name,orderby=db.company.company_name)form = 
> SQLFORM.factory(
> Field('username', label = 'User Name', requires=IS_NOT_EMPTY()),
> Field('password', 'password', label = 
> "Password",requires=IS_NOT_EMPTY()),
> Field('Company', label = 'Court ID',
>  
> requires=IS_IN_DB(db,db.company.company_number,'%(company_name)s')),
> submit_button=' Login ',
> )
>
>   if form.process().accepted:
>response.flash = 'form accepted'
>elif form.errors:
>response.flash = T('form has errors')
>
>session.company = request.vars['Company']
>Company_ID = request.vars['Company']
>DbRows = 
> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
> session.company_name = DbRows['company_name']
>
> return dict(form=form)
>
>
>
>
>
> Thanks again ...
>
>
> *Ben Duncan*
> DBA / Chief Software Architect 
> Mississippi State Supreme Court
> Electronic Filing Division
>

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


Re: [web2py] Re: DAL issues ....

2018-12-06 Thread Ben Duncan
Here is something strange as well - working thru the web2py console,
everything works:

[web2py@su-postgres-ben-3 web2py]$ python ./web2py.py -S Mec -M
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2018
Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000,
pyodbc
WARNING:web2py:import IPython error; use default python shell
Python 2.7.13 (default, Feb  8 2017, 06:30:30)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> session.company_id = '5'
>>> Company_ID = session.company_id
>>> print Company_ID
5
>>> DbRows =
db(db.company.company_number==Company_ID).select(db.company.company_name).first()
>>> type(DbRows['company_name'])

>>> DbRows['company_name']
'Number 5 Company'
>>> session.company_data = DbRows
>>> type(DbRows['company_name'])

>>> print session.company_data['company_name']
Number 5 Company
>>>type(DbRows)

>>>





*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 6, 2018 at 12:22 PM Ben Duncan  wrote:

> Well I was thinking that, BUT:  I'm ALMOST convinced there is a bug in the
> latest web2py:
>
> CODE
> --
> Snippet of controllers/default.py
>
> session.company = request.vars['Company']
> Company_ID = "This is a %s of type %s " % (session.company,
> type(session.company))
> Company_ID = session.company
>
> DbRows =
> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
> # Co_Name = DbRows['company_name']
>
> session.company_data = DbRows
>
> From view/default/company_login.html:
> {{extend 'layout.html'}}
> 
>
>  onclick="location.href='{{=URL('index')}}'"/>
>
> HOME
>
> Input form
> {{=form}}
> Submitted variables
> {{=BEAUTIFY(request.vars)}}
> {{=(request.vars)}}
>
> Company vars: {{=(request.vars['Company'])}}
> Company session: {{=(session.company)}}
> session data: {{=(session.company_data)}}
>
> Will Display The following:
> (top of form omitted ...)
> . Submitted variables
> Company :
> 5
> password :
> makeit1
> username :
> b...@linux4ms.net
>  'makeit1', '_formkey': '65ee8396-aac0-4b5c-a255-00be7e7b01ca', '_formname':
> 'no_table/create'}> Company vars: 5 Company session: 5 session data:  {'company_name': 'Number 5 Company'}>
>
> ___
>
> However, any type of referencing or attempt to do anything with either
> session.company_date or DbRows
> always gives a "Nonetype" error of various subtypes (such as __getitem__)
>
> Uncommenting the controller code  of  "# Co_Name = DbRows['company_name']"
> gives the error:
>
> Ticket ID
>
> 10.13.69.144.2018-12-06.12-17-59.81fd7ae1-6523-47ad-94c7-7b1b480179bd
>  'NoneType' object has no attribute
> '__getitem__' Version
> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
>
> Traceback (most recent call last):
>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> , line 98, 
> in 
>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> , line 84, 
> in company_login
> Co_Name = DbRows['company_name']
> TypeError: 'NoneType' object has no attribute '__getitem__'
>
>
> As one can see , the Row item exists, it just seems there is no way to get
> to it ...
>
> Any other ideas ?
>
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 6, 2018 at 9:09 AM Leonel Câmara 
> wrote:
>
>> What's happening here is that DbRows can become None in this line
>>
>>DbRows =
>> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
>>
>> So when you do DbRows['company_name'] you can get that error.
>>
>> Basically you need to check if DbRows is None and raise HTTP(404)
>>
>> --
>> 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 

Re: [web2py] Re: DAL issues ....

2018-12-06 Thread Ben Duncan
Well I was thinking that, BUT:  I'm ALMOST convinced there is a bug in the
latest web2py:

CODE
--
Snippet of controllers/default.py

session.company = request.vars['Company']
Company_ID = "This is a %s of type %s " % (session.company,
type(session.company))
Company_ID = session.company

DbRows =
db(db.company.company_number==Company_ID).select(db.company.company_name).first()
# Co_Name = DbRows['company_name']

session.company_data = DbRows

>From view/default/company_login.html:
{{extend 'layout.html'}}




HOME

Input form
{{=form}}
Submitted variables
{{=BEAUTIFY(request.vars)}}
{{=(request.vars)}}

Company vars: {{=(request.vars['Company'])}}
Company session: {{=(session.company)}}
session data: {{=(session.company_data)}}

Will Display The following:
(top of form omitted ...)
. Submitted variables
Company :
5
password :
makeit1
username :
b...@linux4ms.net
 Company vars: 5 Company session: 5 session data: 
___

However, any type of referencing or attempt to do anything with either
session.company_date or DbRows
always gives a "Nonetype" error of various subtypes (such as __getitem__)

Uncommenting the controller code  of  "# Co_Name = DbRows['company_name']"
gives the error:

Ticket ID

10.13.69.144.2018-12-06.12-17-59.81fd7ae1-6523-47ad-94c7-7b1b480179bd
 'NoneType' object has no attribute
'__getitem__' Version
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

Traceback (most recent call last):
  File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
,
line 98, in 
  File "/data/web2py/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
,
line 84, in company_login
Co_Name = DbRows['company_name']
TypeError: 'NoneType' object has no attribute '__getitem__'


As one can see , the Row item exists, it just seems there is no way to get
to it ...

Any other ideas ?


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 6, 2018 at 9:09 AM Leonel Câmara  wrote:

> What's happening here is that DbRows can become None in this line
>
>DbRows =
> db(db.company.company_number==Company_ID).select(db.company.company_name).first()
>
> So when you do DbRows['company_name'] you can get that error.
>
> Basically you need to check if DbRows is None and raise HTTP(404)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: New production install Ubuntu/nginx/uwsgi - connect to redis

2018-12-06 Thread Jim S
And another thing...This fails on the server with the rocket webserver 
as well as with the nginx/uwsgi server.

-Jim

On Thursday, December 6, 2018 at 11:42:18 AM UTC-6, Jim S wrote:
>
> Also
>
> I have another desktop linux machine here running Ubuntu 18.10 and this 
> all works just fine.  The web2py version there is:
>
> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
>
> so I tried that on the failing server and it too fails with the same 
> traceback.  Same python version, same redis-server version.
>
> -Jim
>
> On Thursday, December 6, 2018 at 11:06:33 AM UTC-6, Jim S wrote:
>>
>> I've narrowed this down a little bit:
>>
>> Here is the code at the top of my db.py:
>>
>> from gluon.contrib.redis_utils import RConn
>> from gluon.contrib.redis_session import RedisSession
>> rconn = RConn(ccfg.redis.server, ccfg.redis.port)
>> sessiondb = RedisSession(redis_conn=rconn, session_expiry=False)
>> session.connect(request, response, db=sessiondb)
>>
>> If I comment out the last line everything works.  But then my sessions 
>> aren't handled by redis.
>>
>> Here are my versions in use:
>> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.11.34.06
>> Python Python 2.7.15rc1: /usr/bin/python (prefix: /usr)
>> Redis server v=4.0.9 sha=:0 malloc=jemalloc-3.6.0 bits=64 
>> build=1bc80a08306a3efd
>>
>> Any ideas?
>>
>> -Jim
>>
>>
>>
>> On Tuesday, December 4, 2018 at 4:56:22 PM UTC-6, Jim S wrote:
>>>
>>> I'm getting this on every request
>>>
>>> 1.
>>>
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>> 12.
>>> 13.
>>> 14.
>>> 15.
>>> 16.
>>> 17.
>>> 18.
>>> 19.
>>>
>>> Traceback (most recent call last):
>>>
>>>   File "/home/www-data/web2py/gluon/main.py", line 461, in wsgibase
>>> session._try_store_in_db(request, response)
>>>   File "/home/www-data/web2py/gluon/globals.py", line 1239, in 
>>> _try_store_in_db
>>> record_id = table.insert(**dd)
>>>   File "/home/www-data/web2py/gluon/contrib/redis_session.py", line 150, in 
>>> insert
>>> pipe.execute()
>>>   File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 3443, 
>>> in execute
>>> return execute(conn, stack, raise_on_error)
>>>   File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 3309, 
>>> in _execute_transaction
>>> if EMPTY_RESPONSE not in options])
>>>   File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 
>>> 683, in pack_commands
>>> for chunk in self.pack_command(*cmd):
>>>   File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 
>>> 659, in pack_command
>>> for arg in imap(self.encoder.encode, args):
>>>   File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 
>>> 113, in encode
>>> raise DataError("Invalid input of type: 'bool'. Convert to a "
>>> DataError: Invalid input of type: 'bool'. Convert to a byte, string or 
>>> number first.
>>>
>>>
>>> I'm not sure what I'm missing.  This is a fresh install on an Ubuntu 
>>> 18.04 box after running the setup-web2py-nginx-uwsgi-ubuntu.sh script 
>>> (which by the way, needs some updating).
>>>
>>> Anyone have any ideas off the top of their head or is this going to 
>>> require some digging on my part?
>>>
>>> -Jim
>>>
>>>

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


[web2py] Re: New production install Ubuntu/nginx/uwsgi - connect to redis

2018-12-06 Thread Jim S
Also

I have another desktop linux machine here running Ubuntu 18.10 and this all 
works just fine.  The web2py version there is:

web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02

so I tried that on the failing server and it too fails with the same 
traceback.  Same python version, same redis-server version.

-Jim

On Thursday, December 6, 2018 at 11:06:33 AM UTC-6, Jim S wrote:
>
> I've narrowed this down a little bit:
>
> Here is the code at the top of my db.py:
>
> from gluon.contrib.redis_utils import RConn
> from gluon.contrib.redis_session import RedisSession
> rconn = RConn(ccfg.redis.server, ccfg.redis.port)
> sessiondb = RedisSession(redis_conn=rconn, session_expiry=False)
> session.connect(request, response, db=sessiondb)
>
> If I comment out the last line everything works.  But then my sessions 
> aren't handled by redis.
>
> Here are my versions in use:
> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.11.34.06
> Python Python 2.7.15rc1: /usr/bin/python (prefix: /usr)
> Redis server v=4.0.9 sha=:0 malloc=jemalloc-3.6.0 bits=64 
> build=1bc80a08306a3efd
>
> Any ideas?
>
> -Jim
>
>
>
> On Tuesday, December 4, 2018 at 4:56:22 PM UTC-6, Jim S wrote:
>>
>> I'm getting this on every request
>>
>> 1.
>>
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>> 19.
>>
>> Traceback (most recent call last):
>>
>>   File "/home/www-data/web2py/gluon/main.py", line 461, in wsgibase
>> session._try_store_in_db(request, response)
>>   File "/home/www-data/web2py/gluon/globals.py", line 1239, in 
>> _try_store_in_db
>> record_id = table.insert(**dd)
>>   File "/home/www-data/web2py/gluon/contrib/redis_session.py", line 150, in 
>> insert
>> pipe.execute()
>>   File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 3443, 
>> in execute
>> return execute(conn, stack, raise_on_error)
>>   File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 3309, 
>> in _execute_transaction
>> if EMPTY_RESPONSE not in options])
>>   File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 
>> 683, in pack_commands
>> for chunk in self.pack_command(*cmd):
>>   File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 
>> 659, in pack_command
>> for arg in imap(self.encoder.encode, args):
>>   File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 
>> 113, in encode
>> raise DataError("Invalid input of type: 'bool'. Convert to a "
>> DataError: Invalid input of type: 'bool'. Convert to a byte, string or 
>> number first.
>>
>>
>> I'm not sure what I'm missing.  This is a fresh install on an Ubuntu 
>> 18.04 box after running the setup-web2py-nginx-uwsgi-ubuntu.sh script 
>> (which by the way, needs some updating).
>>
>> Anyone have any ideas off the top of their head or is this going to 
>> require some digging on my part?
>>
>> -Jim
>>
>>

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


[web2py] Re: New production install Ubuntu/nginx/uwsgi - connect to redis

2018-12-06 Thread Jim S
I've narrowed this down a little bit:

Here is the code at the top of my db.py:

from gluon.contrib.redis_utils import RConn
from gluon.contrib.redis_session import RedisSession
rconn = RConn(ccfg.redis.server, ccfg.redis.port)
sessiondb = RedisSession(redis_conn=rconn, session_expiry=False)
session.connect(request, response, db=sessiondb)

If I comment out the last line everything works.  But then my sessions 
aren't handled by redis.

Here are my versions in use:
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.11.34.06
Python Python 2.7.15rc1: /usr/bin/python (prefix: /usr)
Redis server v=4.0.9 sha=:0 malloc=jemalloc-3.6.0 bits=64 
build=1bc80a08306a3efd

Any ideas?

-Jim



On Tuesday, December 4, 2018 at 4:56:22 PM UTC-6, Jim S wrote:
>
> I'm getting this on every request
>
> 1.
>
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
>
> Traceback (most recent call last):
>
>   File "/home/www-data/web2py/gluon/main.py", line 461, in wsgibase
> session._try_store_in_db(request, response)
>   File "/home/www-data/web2py/gluon/globals.py", line 1239, in 
> _try_store_in_db
> record_id = table.insert(**dd)
>   File "/home/www-data/web2py/gluon/contrib/redis_session.py", line 150, in 
> insert
> pipe.execute()
>   File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 3443, 
> in execute
> return execute(conn, stack, raise_on_error)
>   File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 3309, 
> in _execute_transaction
> if EMPTY_RESPONSE not in options])
>   File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 
> 683, in pack_commands
> for chunk in self.pack_command(*cmd):
>   File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 
> 659, in pack_command
> for arg in imap(self.encoder.encode, args):
>   File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 
> 113, in encode
> raise DataError("Invalid input of type: 'bool'. Convert to a "
> DataError: Invalid input of type: 'bool'. Convert to a byte, string or number 
> first.
>
>
> I'm not sure what I'm missing.  This is a fresh install on an Ubuntu 18.04 
> box after running the setup-web2py-nginx-uwsgi-ubuntu.sh script (which by 
> the way, needs some updating).
>
> Anyone have any ideas off the top of their head or is this going to 
> require some digging on my part?
>
> -Jim
>
>

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


[web2py] Re: DAL issues ....

2018-12-06 Thread Leonel Câmara
What's happening here is that DbRows can become None in this line

   DbRows = 
db(db.company.company_number==Company_ID).select(db.company.company_name).first()

So when you do DbRows['company_name'] you can get that error.

Basically you need to check if DbRows is None and raise HTTP(404)

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


[web2py] DAL issues ....

2018-12-06 Thread Ben Duncan
How can something that seems so simple, be so hard?

I can't seem to get a SINGLE field from the database from DAL:

First is the Error Message (Or on of the many types - but the latest one),
then the code

What AM I doing wrong here ?

Als always, thanks ...

Error Message:
Error ticket for "Mec" Ticket ID

10.13.69.144.2018-12-06.07-32-29.8fda8fd6-fe14-47f4-b508-14ce2346465e
 'NoneType' object has no attribute
'__getitem__' Version
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

Traceback (most recent call last):
  File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
,
line 96, in 
  File "/data/web2py/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
,
line 87, in company_login
session.company_name = DbRows['company_name']
TypeError: 'NoneType' object has no attribute '__getitem__'

Error snapshot [image: help]


('NoneType' object has no attribute
'__getitem__')
 Code Here
--
 Ok - Code for controller/default.py

def company_login():
company.company_name,orderby=db.company.company_name)form =
SQLFORM.factory(
Field('username', label = 'User Name', requires=IS_NOT_EMPTY()),
Field('password', 'password', label =
"Password",requires=IS_NOT_EMPTY()),
Field('Company', label = 'Court ID',

requires=IS_IN_DB(db,db.company.company_number,'%(company_name)s')),
submit_button=' Login ',
)

  if form.process().accepted:
   response.flash = 'form accepted'
   elif form.errors:
   response.flash = T('form has errors')

   session.company = request.vars['Company']
   Company_ID = request.vars['Company']
   DbRows =
db(db.company.company_number==Company_ID).select(db.company.company_name).first()
session.company_name = DbRows['company_name']

return dict(form=form)





Thanks again ...


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

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


Re: [web2py] Re: ValueError when deleting row object

2018-12-06 Thread Maurice Waka
Hi Dave.
Thanks for the interest.
Actually this line was the issue:
 delete button works if you're displaying [and punching delete for] Dinner
> entry, but for a Lunch entry, it gives the error below?
>
>
>> [...]
>>
> When I want to delete any row under 'LUNCH', I get this error:
>>
>> ValueError: Invalid objectid argument string. Requires an integer or base 16 
>> value
>>
>>
> What does your view look like?   Are you using javascript to do the
> buttons?  JQuery?
>
> Also, note that request.vars are usually strings and you may need to do a
> string to int conversion (atoi() for C users, but int() for Python).
> (for dates, datetime.datetime.strptime() might be needed.)
>
> /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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/CktRiwZp5ow/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: ValueError when deleting row object

2018-12-06 Thread Dave S


On Wednesday, December 5, 2018 at 6:16:15 AM UTC-8, Maurice Waka wrote:
>
> I'm trying to delete a certain row among others with this code:
> [...] 
>
want to delete a specific selected row
>
> [image: lunch.png]
> row = db(db.diary.id==request.vars.delete).delete()# deletes all 
> except under 'lunch'
>  
>

 When you say "deletes all except under 'lunch'", does that mean that the 
delete button works if you're displaying [and punching delete for] Dinner 
entry, but for a Lunch entry, it gives the error below?
 

> [...] 
>
When I want to delete any row under 'LUNCH', I get this error:
>
> ValueError: Invalid objectid argument string. Requires an integer or base 16 
> value
>
>
What does your view look like?   Are you using javascript to do the 
buttons?  JQuery? 

Also, note that request.vars are usually strings and you may need to do a 
string to int conversion (atoi() for C users, but int() for Python).
(for dates, datetime.datetime.strptime() might be needed.)

/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.
For more options, visit https://groups.google.com/d/optout.