[web2py] web2py for (R)OLAP (pivoting)?

2019-11-27 Thread Val K

Hi !, you can pass sql expressions to select() :
.select(db.tbl.field, 'SUM(sometbl.somefield) OVER(PARTITION BY 
sometbl.anotherfield) AS mysum )')

-- 
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/19cd4ae4-aec6-4ea2-9b9a-a0ee68090d68%40googlegroups.com.


Re: [web2py] Re: Anyone have a sample haproxy.cfg file for haproxy v 1.8

2019-11-27 Thread Jim Steil
I'm still using redis for caching, but not for sessions.

Per the web2py book, I'm storing sessions in the database now. The
redis_session module is where the problem is.

Jim



On Wed, Nov 27, 2019, 10:31 PM Krishna Bavandlapally <
b.krishna2...@gmail.com> wrote:

> Thank you Jim S for your great help.
>
> I am also waiting for the Redis fix. Kindly let me know better alternative
> for cache.
>
> Thank you in advance.
>
>
>
> On Thursday, 28 November 2019 04:46:59 UTC+5:30, Jim S wrote:
>>
>> Here is what I have currently:
>>
>> global
>> log /dev/loglocal0
>> log /dev/loglocal1 notice
>> chroot /var/lib/haproxy
>> stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd
>> listeners
>> stats timeout 30s
>> user haproxy
>> group haproxy
>> daemon
>>
>> # Default SSL material locations
>> ca-base /etc/ssl/certs
>> crt-base /etc/ssl/private
>>
>> # Default ciphers to use on SSL-enabled listening sockets.
>> # For more information, see ciphers(1SSL). This list is from:
>> #  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
>> # An alternative list with additional directives can be obtained from
>> #
>> https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy
>> ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:
>> ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
>> ssl-default-bind-options no-sslv3
>>
>> defaults
>> logglobal
>> modehttp
>> optionhttplog
>> optiondontlognull
>> timeout connect 5000
>> timeout client  5
>> timeout server  5
>> errorfile 400 /etc/haproxy/errors/400.http
>> errorfile 403 /etc/haproxy/errors/403.http
>> errorfile 408 /etc/haproxy/errors/408.http
>> errorfile 500 /etc/haproxy/errors/500.http
>> errorfile 502 /etc/haproxy/errors/502.http
>> errorfile 503 /etc/haproxy/errors/503.http
>> errorfile 504 /etc/haproxy/errors/504.http
>>
>> frontend haproxynode
>> bind *:80
>> bind *:443 ssl crt /etc/ssl/new/STAR_qlf_com.pem
>> redirect scheme https if !{ ssl_fc }
>> default_backend backendnodes
>>
>> backend backendnodes
>> balance source
>> option forwardfor
>> http-request set-header X-Forwarded-Port %[dst_port]
>> #http-request add-header X-Forwarded-Proto https if { ssl_fc }
>> server ws19-1 10.10.0.57:9081 check
>> server ws19-2 10.10.0.59:9081 check
>>
>> listen stats
>> bind :32700
>> stats enable
>> stats uri /
>> stats hide-version
>> stats auth haproxy:haproxy
>>
>>
>> Notice the ssl cert specification
>>
>> You can see I have 2 separate servers and run them on port 9081.  For my
>> web2py servers I just run rocket as a service.  And, I have sessions stored
>> in the database.  I used to use redis, but that is no longer working with
>> web2py (in sessions).
>>
>> -Jim
>>
>> On Tuesday, November 26, 2019 at 9:23:24 PM UTC-6, Dave S wrote:
>>>
>>>
>>>
>>> On Tuesday, November 26, 2019 at 7:01:22 PM UTC-8, Krishna Bavandlapally
>>> wrote:

 Thank you, Deve S.

 Sorry I didn't know that and unpinned it.

>>>
>>> 'K
>>>
>>> I did a quick search, and perhaps Jim S' post will help:
>>> https://groups.google.com/d/msg/web2py/sTGFoVtiY04/t8y-6QssAgAJ>
>>>
>>> Ian Ryder also has a site using haproxy, but didn't give the setup
>>> details:
>>> https://groups.google.com/d/msg/web2py/BryoYJfvZ4k/tC_W05iDAAAJ>
>>>
>>> My setup is a single instance, but even if it grows another head, nginx
>>> might be enough, although I haven't studied the load balancing uses, and
>>> can't speak to how much of that is in the open source version (even though
>>> that's what I'm using).
>>>
>>> Good luck!
>>>
>>> /dps
>>>
>>>
>>>
>>>
>>>
>>> On Wednesday, 27 November 2019 02:56:55 UTC+5:30, Dave S wrote:



 On Saturday, November 23, 2019 at 5:01:01 AM UTC-8, Krishna
 Bavandlapally wrote:
>
> Anyone have a sample haproxy.cfg file for haproxy v 1.8



 No, sorry.  I'm only using nginx.

 Why is this post pinned?  That is supposed to be for long-lived
 messages, such as from Massimo.

 /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/dNItBzO0BE8/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/8ee713db-0c02-45fb-8bf3-aec08dd1ca2e%40googlegroups.com
> 

[web2py] Re: Anyone have a sample haproxy.cfg file for haproxy v 1.8

2019-11-27 Thread Krishna Bavandlapally
Thank you Jim S for your great help.

I am also waiting for the Redis fix. Kindly let me know better alternative 
for cache.

Thank you in advance.



On Thursday, 28 November 2019 04:46:59 UTC+5:30, Jim S wrote:
>
> Here is what I have currently:
>
> global
> log /dev/loglocal0
> log /dev/loglocal1 notice
> chroot /var/lib/haproxy
> stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd 
> listeners
> stats timeout 30s
> user haproxy
> group haproxy
> daemon
>
> # Default SSL material locations
> ca-base /etc/ssl/certs
> crt-base /etc/ssl/private
>
> # Default ciphers to use on SSL-enabled listening sockets.
> # For more information, see ciphers(1SSL). This list is from:
> #  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
> # An alternative list with additional directives can be obtained from
> #  
> https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy
> ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:
> ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
> ssl-default-bind-options no-sslv3
>
> defaults
> logglobal
> modehttp
> optionhttplog
> optiondontlognull
> timeout connect 5000
> timeout client  5
> timeout server  5
> errorfile 400 /etc/haproxy/errors/400.http
> errorfile 403 /etc/haproxy/errors/403.http
> errorfile 408 /etc/haproxy/errors/408.http
> errorfile 500 /etc/haproxy/errors/500.http
> errorfile 502 /etc/haproxy/errors/502.http
> errorfile 503 /etc/haproxy/errors/503.http
> errorfile 504 /etc/haproxy/errors/504.http
>
> frontend haproxynode
> bind *:80
> bind *:443 ssl crt /etc/ssl/new/STAR_qlf_com.pem
> redirect scheme https if !{ ssl_fc }
> default_backend backendnodes
>
> backend backendnodes
> balance source
> option forwardfor
> http-request set-header X-Forwarded-Port %[dst_port]
> #http-request add-header X-Forwarded-Proto https if { ssl_fc }
> server ws19-1 10.10.0.57:9081 check
> server ws19-2 10.10.0.59:9081 check
> 
> listen stats
> bind :32700
> stats enable
> stats uri /
> stats hide-version
> stats auth haproxy:haproxy
>
>
> Notice the ssl cert specification
>
> You can see I have 2 separate servers and run them on port 9081.  For my 
> web2py servers I just run rocket as a service.  And, I have sessions stored 
> in the database.  I used to use redis, but that is no longer working with 
> web2py (in sessions).
>
> -Jim
>
> On Tuesday, November 26, 2019 at 9:23:24 PM UTC-6, Dave S wrote:
>>
>>
>>
>> On Tuesday, November 26, 2019 at 7:01:22 PM UTC-8, Krishna Bavandlapally 
>> wrote:
>>>
>>> Thank you, Deve S.
>>>
>>> Sorry I didn't know that and unpinned it.
>>>
>>
>> 'K
>>
>> I did a quick search, and perhaps Jim S' post will help:
>> https://groups.google.com/d/msg/web2py/sTGFoVtiY04/t8y-6QssAgAJ>
>>
>> Ian Ryder also has a site using haproxy, but didn't give the setup 
>> details:
>> https://groups.google.com/d/msg/web2py/BryoYJfvZ4k/tC_W05iDAAAJ>
>>
>> My setup is a single instance, but even if it grows another head, nginx 
>> might be enough, although I haven't studied the load balancing uses, and 
>> can't speak to how much of that is in the open source version (even though 
>> that's what I'm using).
>>
>> Good luck!
>>
>> /dps
>>
>>
>>
>>
>>
>> On Wednesday, 27 November 2019 02:56:55 UTC+5:30, Dave S wrote:
>>>
>>>
>>>
>>> On Saturday, November 23, 2019 at 5:01:01 AM UTC-8, Krishna 
>>> Bavandlapally wrote:

 Anyone have a sample haproxy.cfg file for haproxy v 1.8
>>>
>>>
>>>
>>> No, sorry.  I'm only using nginx.
>>>
>>> Why is this post pinned?  That is supposed to be for long-lived 
>>> messages, such as from Massimo.
>>>
>>> /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/8ee713db-0c02-45fb-8bf3-aec08dd1ca2e%40googlegroups.com.


[web2py] Re: Anyone have a sample haproxy.cfg file for haproxy v 1.8

2019-11-27 Thread Jim S
Here is what I have currently:

global
log /dev/loglocal0
log /dev/loglocal1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd 
listeners
stats timeout 30s
user haproxy
group haproxy
daemon

# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private

# Default ciphers to use on SSL-enabled listening sockets.
# For more information, see ciphers(1SSL). This list is from:
#  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
# An alternative list with additional directives can be obtained from
# 
 https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:
ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
ssl-default-bind-options no-sslv3

defaults
logglobal
modehttp
optionhttplog
optiondontlognull
timeout connect 5000
timeout client  5
timeout server  5
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http

frontend haproxynode
bind *:80
bind *:443 ssl crt /etc/ssl/new/STAR_qlf_com.pem
redirect scheme https if !{ ssl_fc }
default_backend backendnodes

backend backendnodes
balance source
option forwardfor
http-request set-header X-Forwarded-Port %[dst_port]
#http-request add-header X-Forwarded-Proto https if { ssl_fc }
server ws19-1 10.10.0.57:9081 check
server ws19-2 10.10.0.59:9081 check

listen stats
bind :32700
stats enable
stats uri /
stats hide-version
stats auth haproxy:haproxy


Notice the ssl cert specification

You can see I have 2 separate servers and run them on port 9081.  For my 
web2py servers I just run rocket as a service.  And, I have sessions stored 
in the database.  I used to use redis, but that is no longer working with 
web2py (in sessions).

-Jim

On Tuesday, November 26, 2019 at 9:23:24 PM UTC-6, Dave S wrote:
>
>
>
> On Tuesday, November 26, 2019 at 7:01:22 PM UTC-8, Krishna Bavandlapally 
> wrote:
>>
>> Thank you, Deve S.
>>
>> Sorry I didn't know that and unpinned it.
>>
>
> 'K
>
> I did a quick search, and perhaps Jim S' post will help:
> https://groups.google.com/d/msg/web2py/sTGFoVtiY04/t8y-6QssAgAJ>
>
> Ian Ryder also has a site using haproxy, but didn't give the setup details:
> https://groups.google.com/d/msg/web2py/BryoYJfvZ4k/tC_W05iDAAAJ>
>
> My setup is a single instance, but even if it grows another head, nginx 
> might be enough, although I haven't studied the load balancing uses, and 
> can't speak to how much of that is in the open source version (even though 
> that's what I'm using).
>
> Good luck!
>
> /dps
>
>
>
>
>
> On Wednesday, 27 November 2019 02:56:55 UTC+5:30, Dave S wrote:
>>
>>
>>
>> On Saturday, November 23, 2019 at 5:01:01 AM UTC-8, Krishna Bavandlapally 
>> wrote:
>>>
>>> Anyone have a sample haproxy.cfg file for haproxy v 1.8
>>
>>
>>
>> No, sorry.  I'm only using nginx.
>>
>> Why is this post pinned?  That is supposed to be for long-lived messages, 
>> such as from Massimo.
>>
>> /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/c2288a75-fe07-4f40-8d24-7c24c655b62c%40googlegroups.com.


[web2py] web2py for (R)OLAP (pivoting)?

2019-11-27 Thread Jurgis Pralgauskis
Hi, 

OLAP Cube  model is based on dimensions (what to group by) and metrics 
(what to aggregate). 
Dimensions are mostly categorical data -- so can be nearly any fields 
(mostly FK).

Metrics would be aggregations of number fields. -- But [how] could they be 
described (incorporated into data model)?
Does pydal support aggregate expressions (that would be grouped by  
dimensions chosen in form)?

-- 
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/76bb8d25-1310-403b-ad15-26ce200f9bb2%40googlegroups.com.


[web2py] ValueError: invalid literal for int() with base 10 for 'id' Field

2019-11-27 Thread Jitun John
Hi, 

Here is my code.


*postgres_db = DAL("postgres://postgres@localhost:5432/" + 
get_postgres_db_filename(), auto_import=True, pool_size=10, 
migrate_enabled=False, fake_migrate_all=True)*

"get_postgres_db_filename()" will get you 
"CaptureOutput-2019-11-15_03-25-19-MN"



I have defined the table

postgres_db.define_table('vmhive',
 Field('id', type='uuid'),
 Field('owner', type='uuid'),
 Field('fsid', type='bigint'),
 Field('demuxer', type='uuid'),
 Field('origin_hive', type='uuid'),
 Field('name', type='citext'),
 Field('replicaset', type='text'),
 Field('visible', type='boolean'),
 Field('creation_time', type='bigint'),
 Field('platform_tag', type='text'),
 Field('platform_name', type='text'),
 Field('backup_policy', type='uuid'),
 Field('deletion_time', type='bigint'),
 Field('ancestor', type='uuid'),
 Field('removed_time', type='bigint'),
 Field('tree_id', type='uuid'),
 Field('owner_number', type='bigint'),
 Field('ready_for_backup', type='boolean'),
 Field('hive_version', type='bigint'),
 Field('hms_platform_id', type='text'),
 Field('stat', type='text'),
 Field('hms_host_id', type='text'),
 Field('ft_enabled', 'boolean'),
 Field('ft_primary', type='boolean'),
 Field('power_state', type='text'),
 Field('rb_ignore', type='boolean'))



When I explicitly issue SQL statements.
I am able to get result.

*print(postgres_db.executesql('SELECT * FROM vmhive where deletion_time > 
0;'))*

[('*9f750dab-48e3-4a98-a62c-41e38b6b1ce1*', 
'42147e2a-826a-f2a2-0130-7580c4cfad5f', 2874592791, 
'4a5a47b8-4eb6-4d28-9b65-9a88a3f0727d', 
'----', 'Oracle-test_172_16_0_201', 
'2|36:4214534b-83c5-1feb-150d-a632928dd77c|36:42147e2a-826a-f2a2-0130-7580c4cfad5f|'
, True, 1573183778, '', 'Oracle-test_172_16_15_200', 
'f67c4112-0b70-4309-9b15-83387fa316dd', 1573187250, 
'd4985d85-d508-4565-bf7a-e125de44a4e5', 0, 
'42bb9964-7026-4af2-849b-592858a899dd', 2, True, 1, 
'51bd75d3-ab1c-4782-b73c-81f0605c2881:VirtualMachine:vm-153', 
'1;0;0;16741;1;0;0;0;0;0;0;1573183778;1573183778;1573183778', '', False, 
False, '3', False)]


But when I try the following
*for row in postgres_db(postgres_db.vmhive.deletion_time > 
0).select():*
*print(row.name)*

ValueError: invalid literal for int() with base 10: 
'9f750dab-48e3-4a98-a62c-41e38b6b1ce1'



But when I check the Field type and length

*print(postgres_db.vmhive.id.type)*
*print(postgres_db.vmhive.id.length)*

id
512


Other Fields are fine

*print(postgres_db.vmhive.owner.type)*
*print(postgres_db.vmhive.fsid.type)*
*print(postgres_db.vmhive.name.type)*
*print(postgres_db.vmhive.hms_host_id.type)*
*print(postgres_db.vmhive.rb_ignore.type)*

uuid
bigint
citext
text
boolean


Now this is a pre-populated database, so I cant change anything on it.
I am wondering how to force "id" Field to not behave like a int Field ?

Thanks in Advance.


-- 
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/2d89e80c-57aa-474b-b09d-397fc5279e0b%40googlegroups.com.


[web2py] Off topic : visual diagrams anyone ???

2019-11-27 Thread António Ramos
Hard to find a tool like this for my web2py app

https://mermaidjs.github.io/#/

-- 
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/CAEM0BxM2C%2B1VrpfCAv_eac3pYyZ_dY0%3D_xy8z51V%3DwOPMAmfHw%40mail.gmail.com.


[web2py] Re: Error opening upload files after upgrading to python 3

2019-11-27 Thread Áureo Dias Neto


I updated the ubuntu packages and everything worked as normal. I didn't know 
there was a relationship between pydal outside the web2py environment. thanks


Em quarta-feira, 27 de novembro de 2019 12:03:39 UTC-3, Áureo Dias Neto 
escreveu:
>
> I upgraded from python 2 to 3.6.8 and can no longer open the uploaded 
> images, attached error and following version information:
>
> web2py: 2.18.5-stable + timestamp.2019.04.08.04.22.03
> Running on gunicorn / 19.7.1, Python 3.6.8
>

-- 
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/cad70aed-a2e9-41d8-a364-8ab1a9180ffa%40googlegroups.com.


Re: [web2py] No Column error

2019-11-27 Thread Maurice Waka
I got this error after installing psycopg2



Traceback (most recent call last):
  File "/home/mauricewaka/web2py/gluon/restricted.py", line 219, in
restricted
exec(ccode, environment)
  File
"/home/mauricewaka/web2py/applications/myappname/controllers/default.py",
line 219, in 
  File "/home/mauricewaka/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File
"/home/mauricewaka/web2py/applications/myappname/controllers/default.py",
line 84, in user
return dict(form=auth())
  File "/home/mauricewaka/web2py/gluon/tools.py", line 1801, in __call__
return getattr(self, args[0])()
  File "/home/mauricewaka/web2py/gluon/tools.py", line 2586, in login
user = table_user(**{username: entered_username})
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/objects.py", line
596, in __call__
orderby_on_limitby=False).first()
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/objects.py", line
2395, in select
return adapter.select(self.query, fields, attributes)
  File
"/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line
763, in select
return self._select_aux(sql, fields, attributes, colnames)
  File
"/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line
719, in _select_aux
rows = self._select_aux_execute(sql)
  File
"/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line
713, in _select_aux_execute
self.execute(sql)
  File
"/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/__init__.py",
line 67, in wrap
return f(*args, **kwargs)
  File
"/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line
413, in execute
rv = self.cursor.execute(command, *args[1:], **kwargs)
psycopg2.ProgrammingError: column auth_user.gender does not exist
LINE 1: ...set_password_key", "auth_user"."registration_id", "auth_user...
 ^


On Wed, Nov 27, 2019 at 12:21 AM Dave S  wrote:

>
>
> On Tuesday, November 26, 2019 at 4:48:28 AM UTC-8, Maurice Waka wrote:
>>
>> More on this
>>
>> Traceback
>>
>> Traceback (most recent call last):
>>   File "/home/mauricewaka/web2py/gluon/contrib/pg8000/core.py", line
>> 1891, in execute
>> ps = cache['ps'][key]
>>
>
> You're using pg8000.  That has been NOT RECOMMENDED for several years
> now.  Please try psycopg2.  When I first switched to PostGres, I used
> pg8000 and there were some strange things that occurred from time to time.
> When I figured out how to get psycopg2 going, things worked beautifully.
>
>
>
> KeyError: ('SELECT "auth_user"."id", "auth_user"."first_name",
>> "auth_user"."last_name", "auth_user"."email", "auth_user"."password",
>> "auth_user"."registration_key", "auth_user"."reset_password_key",
>> "auth_user"."registration_id", "auth_user"."gender", "auth_user"."city",
>> "auth_user"."country", "auth_user"."phoneNo", "auth_user"."pic",
>> "auth_user"."spams", "auth_user"."premium" FROM "auth_user" WHERE
>> ("auth_user"."email" = \'hes...@gmail.com\') LIMIT 1 OFFSET 0;', ())
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>>   File "/home/mauricewaka/web2py/gluon/restricted.py", line 219, in
>> restricted
>> exec(ccode, environment)
>>   File
>> "/home/mauricewaka/web2py/applications/myappname/controllers/default.py",
>> line 219, in 
>>   File "/home/mauricewaka/web2py/gluon/globals.py", line 421, in 
>> self._caller = lambda f: f()
>>   File
>> "/home/mauricewaka/web2py/applications/myappname/controllers/default.py",
>> line 84, in user
>> return dict(form=auth())
>>   File "/home/mauricewaka/web2py/gluon/tools.py", line 1801, in __call__
>> return getattr(self, args[0])()
>>   File "/home/mauricewaka/web2py/gluon/tools.py", line 2586, in login
>> user = table_user(**{username: entered_username})
>>   File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/objects.py",
>> line 596, in __call__
>> orderby_on_limitby=False).first()
>>   File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/objects.py",
>> line 2395, in select
>> return adapter.select(self.query, fields, attributes)
>>   File
>> "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line
>> 763, in select
>> return self._select_aux(sql, fields, attributes, colnames)
>>   File
>> "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line
>> 719, in _select_aux
>> rows = self._select_aux_execute(sql)
>>   File
>> "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line
>> 713, in _select_aux_execute
>> self.execute(sql)
>>   File
>> "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/__init__.py",
>> line 67, in wrap
>> return f(*args, **kwargs)
>>   File
>> "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/postgres.py",
>> line 203, in execute
>> return super(PostgrePG8000, self).execute(*args, **kwargs)
>>   File
>> "/

[web2py] Re: Problem passing a json object to controller

2019-11-27 Thread Patito Feo
Paco, thanks for your help!

Y Olé


El miércoles, 20 de noviembre de 2019, 18:32:47 (UTC-5), Paco Bernal 
escribió:
>
> H again :)
>
> I think the problem is this
>
> Instead of 
>
> request.vars.items[json1]
>>
>
> use this
>
> request.vars['items[json1]']
>>
>
> because the var is 'items[json1]' requests.vars.items[json1] will look for 
> the key 'json1' in the dict var items and there is no items var only a 
> 'items[json1]' var that's why you need to use ['items[json1]'] and not 
> items[json1]
>
> Regards
>
> El miércoles, 20 de noviembre de 2019, 23:12:45 (UTC+1), Patito Feo 
> escribió:
>>
>> Paco here is the reponse:
>>
>>
>>1. {vars: {…}, respuesta: "noexiste"}
>>   1. respuesta: "noexiste"
>>   2. vars: {tarea: "solicitudguardar", items[json1]: "[1,2,3]"}
>>   3. __proto__: Object
>>
>>
>>
>> Thanks in advance,
>>
>>
>> El miércoles, 20 de noviembre de 2019, 16:39:22 (UTC-5), Paco Bernal 
>> escribió:
>>>
>>> Hi,
>>>
>>> Try this, write down at the begin of the controller
>>>
>>> print request.vars

>>>
>>> you will see how the controller receives the information and then you 
>>> will know if it's a js problem or a server side problem.
>>>
>>> with your code what the controller receives is 
>>>
>>> >>> '{"make":"Ford","model":"Mustang","year":1969}'}>

>>>
>>> you don't need to use  json.loads, you just need this
>>>

 mydata = request.vars['items[json1]']
 print mydata
 {"make":"Ford","model":"Mustang","year":1969}

>>>
>>> Regards from spain Ugly Duckling :)
>>>
>>> El miércoles, 20 de noviembre de 2019, 18:08:03 (UTC+1), Patito Feo 
>>> escribió:

 Hi,

 Ive been trying to pass an object with keys to the controller. But i 
 havent been able to extract the request.vars.

 Here is my view:

 var Cars = {}
 Cars.make = 'Ford';
 Cars.model = 'Mustang';
 Cars.year = 1969;

 $.post( "{{=URL('default', 'transcriptor')}}", //request.post_vars.json1
{ 
  tarea: 'solicitudguardar', items: { json1: JSON.stringify( 
 Cars ) }
}, )


 Here is my function:

 elif request.vars.tarea == 'solicitudguardar':

var = json.loads ( request.post_vars.items[json1] )



 Here is one of the errors i got:

 global name 'json1' is not defined


 I dont understand why the array object is not being process as a json 
 array in controller. 

 Any help will be much appreciated.


 Cheers,

>>>

-- 
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/76ccd537-0808-4385-b536-38a36a7f23c7%40googlegroups.com.


[web2py] Re: Handling OPTIONS request in a web2py RESTful API

2019-11-27 Thread mcamel
I think you have to add code to handle OPTIONS the same way is described in 
the manual for GET, POST, PUT, DELETE.

In my case it worked just adding this:

def OPTIONS(*args, **vars):
return dict()




El viernes, 10 de mayo de 2013, 13:47:05 (UTC+2), Daniel Gonzalez escribió:
>
> Hi,
>
> I have implemented a RESTful api in web2py which handle the usual GET, 
> POST, PUT, DELETE. (using @request.restful())
> Is there a standard mechanism in web2py to implement OPTIONS requests?
>
> Thanks,
> Daniel
>

-- 
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/27d5-90ce-43e7-82dd-2be17b9fb9f8%40googlegroups.com.