[web2py] retrieving GET request (parameters; @service.json)

2022-08-03 Thread Vlad
If the following is exposed:

@service.json
def test(a, b):


it works just fine when I submit url?a=val1;b=val2

but when I submit a dictionary - {"a":"val1", "b":val2"} - I can't figure 
out how to catch the parameters in the function test()  - it gives an error 
that they are missing. 

I am not fully controlling the client that does the request - I am just 
giving this client url and the dictionary containing parameters. 

on the server side - i.e. in test() - how do I figure out what exactly the 
client is doing - how exactly the parameters are passed so that I could 
read and process them in test()? 

-- 
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/fb2e4ba8-b4f7-4023-8890-28cbe14b1f88n%40googlegroups.com.


Re: [web2py] having to use migrate=false after migrating the database

2022-07-18 Thread Eliezer (Vlad) Tseytkin
Ah, that doesn't change - permissions are good - I am using the same app,
just switching the database provider, so that's not a problem. Only
pointing to a different db.



On Mon, Jul 18, 2022 at 12:36 PM Massimiliano  wrote:

> Hello Vlad,
>
> Sorry for the misunderstanding,
>
> ‘database’ or ‘databases’ I don’t remember is a folder inside you web2py
> applications directory.
>
> ~/web2py/applications/yourapplication/database
>
> Inside of that DAL keeps metadata informations about the tables managed.
>
> I was referring to the filesystem permissions for that folder.
>
>
>
>
> Il giorno lun 18 lug 2022 alle 15:22 Eliezer (Vlad) Tseytkin <
> westgate6...@gmail.com> ha scritto:
>
>> I am not familiar with "databases folder permissions" - where can I look
>> this up, the way web2py uses them so that I would be able to ask
>> elephantsql customer support about it?
>>
>> It seems strange to me: when I start from an empty database - everything
>> works like a charm, the way it has to.
>> but when I pg_dump and pg_restore the database from elsewhere (seems to
>> restore everything correctly) - this is where problems start: migrate=True
>> attempts to recreate the existing tables; migrate=False works perfectly
>> fine (and fake_migrate worked by itself, but didn't help to fix the
>> issue...)
>>
>>
>>
>> On Sun, Jul 17, 2022 at 11:31 AM Massimiliano 
>> wrote:
>>
>>> Should be
>>>
>>> migrate = True
>>> fake_migrate = True
>>> db = DAL(db_uri, migrate=migrate, fake_migrate=fake_migrate)
>>>
>>> And after one run, that recreate metadata files in databases folder:
>>>
>>> migrate = True
>>> fake_migrate = False
>>> db = DAL(db_uri, migrate=migrate, fake_migrate=fake_migrate)
>>>
>>> maybe you can also check your databases folder permissions. Web2py needs
>>> to be able to write into.
>>>
>>> Il giorno dom 17 lug 2022 alle ore 17:17 Vlad 
>>> ha scritto:
>>>
>>>> Massimiliano, thank you for the suggestion.
>>>>
>>>> I tried fake_migrate=True - it works fine, but then I switched it back
>>>> to migrate=True  , and it crashed again.
>>>> (migrate=False works perfectly.)
>>>>
>>>> Any ideas?
>>>>
>>>> On Sunday, July 17, 2022 at 5:42:11 AM UTC-4 Massimiliano wrote:
>>>>
>>>>> You can try fake_migrate=True so that DAL recreates tables metafata
>>>>> files in the database folder.
>>>>> Once done, you can restore fake_migrate=False and migrate=True.
>>>>>
>>>>> Should work
>>>>>
>>>>> Il giorno dom 17 lug 2022 alle ore 07:06 Vlad 
>>>>> ha scritto:
>>>>>
>>>>>> I've been using PythonAnywhere Postgres hosting for a while. Used
>>>>>> pg_dump and pg_restore to recreate the database in ElephantSQL.
>>>>>> Not sure if this has contributed to the problem, but had to use
>>>>>> options that drop owner and privileges (otherwise pg_restore generated
>>>>>> errors, complaining about non-existing roles etc.)
>>>>>> In the end, everything works perfectly except that I must use
>>>>>> migrate=false option only.
>>>>>> If migrate=true - it attempts to recreate all the tables and,
>>>>>> obviously, complains that tables already exist - because they do exist.
>>>>>> Greatly appreciate suggestions on how to fix this.
>>>>>>
>>>>>> A side question on efficiency: visually I notice that PythonAnywhere
>>>>>> postgres hosting works quicker (but ElephantSQL is theoretically better
>>>>>> hosting). Is it because in PA both app and db run "in close proximity",
>>>>>> presumably on the same server?
>>>>>>
>>>>>> --
>>>>>> 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...@googlegrou

Re: [web2py] having to use migrate=false after migrating the database

2022-07-18 Thread Eliezer (Vlad) Tseytkin
I am not familiar with "databases folder permissions" - where can I look
this up, the way web2py uses them so that I would be able to ask
elephantsql customer support about it?

It seems strange to me: when I start from an empty database - everything
works like a charm, the way it has to.
but when I pg_dump and pg_restore the database from elsewhere (seems to
restore everything correctly) - this is where problems start: migrate=True
attempts to recreate the existing tables; migrate=False works perfectly
fine (and fake_migrate worked by itself, but didn't help to fix the
issue...)



On Sun, Jul 17, 2022 at 11:31 AM Massimiliano  wrote:

> Should be
>
> migrate = True
> fake_migrate = True
> db = DAL(db_uri, migrate=migrate, fake_migrate=fake_migrate)
>
> And after one run, that recreate metadata files in databases folder:
>
> migrate = True
> fake_migrate = False
> db = DAL(db_uri, migrate=migrate, fake_migrate=fake_migrate)
>
> maybe you can also check your databases folder permissions. Web2py needs
> to be able to write into.
>
> Il giorno dom 17 lug 2022 alle ore 17:17 Vlad  ha
> scritto:
>
>> Massimiliano, thank you for the suggestion.
>>
>> I tried fake_migrate=True - it works fine, but then I switched it back to
>> migrate=True  , and it crashed again.
>> (migrate=False works perfectly.)
>>
>> Any ideas?
>>
>> On Sunday, July 17, 2022 at 5:42:11 AM UTC-4 Massimiliano wrote:
>>
>>> You can try fake_migrate=True so that DAL recreates tables metafata
>>> files in the database folder.
>>> Once done, you can restore fake_migrate=False and migrate=True.
>>>
>>> Should work
>>>
>>> Il giorno dom 17 lug 2022 alle ore 07:06 Vlad  ha
>>> scritto:
>>>
>>>> I've been using PythonAnywhere Postgres hosting for a while. Used
>>>> pg_dump and pg_restore to recreate the database in ElephantSQL.
>>>> Not sure if this has contributed to the problem, but had to use options
>>>> that drop owner and privileges (otherwise pg_restore generated errors,
>>>> complaining about non-existing roles etc.)
>>>> In the end, everything works perfectly except that I must use
>>>> migrate=false option only.
>>>> If migrate=true - it attempts to recreate all the tables and,
>>>> obviously, complains that tables already exist - because they do exist.
>>>> Greatly appreciate suggestions on how to fix this.
>>>>
>>>> A side question on efficiency: visually I notice that PythonAnywhere
>>>> postgres hosting works quicker (but ElephantSQL is theoretically better
>>>> hosting). Is it because in PA both app and db run "in close proximity",
>>>> presumably on the same server?
>>>>
>>>> --
>>>> 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.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/web2py/abcae64b-e9b3-4d30-9ae7-98ff01cb51ban%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/web2py/abcae64b-e9b3-4d30-9ae7-98ff01cb51ban%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>>
>>>
>>> --
>>> Massimiliano
>>>
>> --
>> 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/872ddea5-4c39-4cf8-ad94-ac852f674dd3n%40googlegroups.com
>> <https://groups.google.com/d/msgid/web2py/872ddea5-4c39-4cf8-ad94-ac852f674dd3n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
>
> --
> Massimiliano
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com

Re: [web2py] having to use migrate=false after migrating the database

2022-07-17 Thread Vlad
 Massimiliano, thank you for the suggestion. 

I tried fake_migrate=True - it works fine, but then I switched it back to 
migrate=True  , and it crashed again. 
(migrate=False works perfectly.) 

Any ideas? 

On Sunday, July 17, 2022 at 5:42:11 AM UTC-4 Massimiliano wrote:

> You can try fake_migrate=True so that DAL recreates tables metafata files 
> in the database folder.
> Once done, you can restore fake_migrate=False and migrate=True.
>
> Should work
>
> Il giorno dom 17 lug 2022 alle ore 07:06 Vlad  ha 
> scritto:
>
>> I've been using PythonAnywhere Postgres hosting for a while. Used pg_dump 
>> and pg_restore to recreate the database in ElephantSQL. 
>> Not sure if this has contributed to the problem, but had to use options 
>> that drop owner and privileges (otherwise pg_restore generated errors, 
>> complaining about non-existing roles etc.)
>> In the end, everything works perfectly except that I must use 
>> migrate=false option only. 
>> If migrate=true - it attempts to recreate all the tables and, obviously, 
>> complains that tables already exist - because they do exist. 
>> Greatly appreciate suggestions on how to fix this. 
>>
>> A side question on efficiency: visually I notice that PythonAnywhere 
>> postgres hosting works quicker (but ElephantSQL is theoretically better 
>> hosting). Is it because in PA both app and db run "in close proximity", 
>> presumably on the same server? 
>>
>> -- 
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/abcae64b-e9b3-4d30-9ae7-98ff01cb51ban%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/abcae64b-e9b3-4d30-9ae7-98ff01cb51ban%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>
>
> -- 
> Massimiliano
>

-- 
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/872ddea5-4c39-4cf8-ad94-ac852f674dd3n%40googlegroups.com.


[web2py] having to use migrate=false after migrating the database

2022-07-16 Thread Vlad
I've been using PythonAnywhere Postgres hosting for a while. Used pg_dump 
and pg_restore to recreate the database in ElephantSQL. 
Not sure if this has contributed to the problem, but had to use options 
that drop owner and privileges (otherwise pg_restore generated errors, 
complaining about non-existing roles etc.)
In the end, everything works perfectly except that I must use migrate=false 
option only. 
If migrate=true - it attempts to recreate all the tables and, obviously, 
complains that tables already exist - because they do exist. 
Greatly appreciate suggestions on how to fix this. 

A side question on efficiency: visually I notice that PythonAnywhere 
postgres hosting works quicker (but ElephantSQL is theoretically better 
hosting). Is it because in PA both app and db run "in close proximity", 
presumably on the same server? 

-- 
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/abcae64b-e9b3-4d30-9ae7-98ff01cb51ban%40googlegroups.com.


Re: [web2py] Re: sessions folder under application

2022-07-07 Thread Eliezer (Vlad) Tseytkin
Oops, I missed this section.
Thank you very much

On Thu, Jul 7, 2022, 4:07 AM Niphlod  wrote:

> there's an handy session cleaner   web2py/sessions2trash.py at master ·
> web2py/web2py (github.com)
> <https://github.com/web2py/web2py/blob/master/scripts/sessions2trash.py> and
> a whole section in the docs  web2py - Deployment recipes
> <http://www.web2py.com/books/default/chapter/29/13/deployment-recipes?search=session2trash#Cleaning-up-sessions>
>
> On Wednesday, July 6, 2022 at 3:22:43 PM UTC+2 Vlad wrote:
>
>> Invalidating existing sessions is not a problem; they can login again. As
>> long as it doesn't break things...
>>
>> Thank you, Jim!
>>
>>
>> On Wed, Jul 6, 2022, 9:20 AM Jim S  wrote:
>>
>>> I believe that you can.
>>>
>>> However, this will invalidate all active sessions and all active users
>>> will have to log in again.
>>>
>>> Are there date stamps you can use to delete old session files but keep
>>> current ones?
>>>
>>> -Jim
>>>
>>> On Tuesday, July 5, 2022 at 10:44:35 PM UTC-5 Vlad wrote:
>>>
>>>> I was checking memory usage and noticed that the sessions folder (under
>>>> one specific application) takes over 1G of disk space. Can I just delete
>>>> everything in there? Trying to clean up the space to optimize disk usage -
>>>>
>>> --
>>> 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/VBkKItehYfQ/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+un...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/ef6ffa3f-1f27-43ed-9f70-8a8e694d501bn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/web2py/ef6ffa3f-1f27-43ed-9f70-8a8e694d501bn%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
> 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/VBkKItehYfQ/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/6bf23f74-2677-48bb-a1fd-6673dcd4efb7n%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/6bf23f74-2677-48bb-a1fd-6673dcd4efb7n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCAvrRJnUmxVBBnWrMb%2B5BkX4nRiCpXiKST0DC953LwQeg%40mail.gmail.com.


Re: [web2py] Re: sessions folder under application

2022-07-06 Thread Eliezer (Vlad) Tseytkin
Invalidating existing sessions is not a problem; they can login again. As
long as it doesn't break things...

Thank you, Jim!


On Wed, Jul 6, 2022, 9:20 AM Jim S  wrote:

> I believe that you can.
>
> However, this will invalidate all active sessions and all active users
> will have to log in again.
>
> Are there date stamps you can use to delete old session files but keep
> current ones?
>
> -Jim
>
> On Tuesday, July 5, 2022 at 10:44:35 PM UTC-5 Vlad wrote:
>
>> I was checking memory usage and noticed that the sessions folder (under
>> one specific application) takes over 1G of disk space. Can I just delete
>> everything in there? Trying to clean up the space to optimize disk usage -
>>
> --
> 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/VBkKItehYfQ/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/ef6ffa3f-1f27-43ed-9f70-8a8e694d501bn%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/ef6ffa3f-1f27-43ed-9f70-8a8e694d501bn%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCCwiBfXFns4FBVrYvuhitnyjbj3w5s17TpP3gPHqQixUg%40mail.gmail.com.


[web2py] sessions folder under application

2022-07-05 Thread Vlad
I was checking memory usage and noticed that the sessions folder (under one 
specific application) takes over 1G of disk space. Can I just delete 
everything in there? Trying to clean up the space to optimize disk usage - 

-- 
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/c12b100d-faf4-43d1-b83e-3bd545d17ff1n%40googlegroups.com.


[web2py] Groupby tricky question

2022-06-09 Thread Vlad
Please help - I can't figure it out! 
My question is a bit detailed, but it's not about details - I am totally 
missing how to properly handle this kind of thing:

I have the following query:

query = (db.ladore_order.created_on>=dt1) & 
(db.ladore_order.created_on<=dt2)

rows = db(query).select(db.ladore_order.customer,
db.ladore_order.created_on.max(),
groupby=[db.ladore_order.customer],
orderby=[~db.ladore_order.created_on.max()])

I have 3 issues here that I am looking to resolve:

1) It shows all the orders between the range of dates dt1 and dt2. However, 
the same customer may have ordered after dt2 also (so that created_on of 
the later order would be greater than dt2). I am looking ONLY for those 
customers/orders that ordered between dt1 and dt2 and haven't ordered since 
then.

2) Besides db.ladore_order.customer in the select, I also need 
db.ladore_order.id which corresponds to the latest order of the customer. I 
can run db.ladore_order.created_on.max(), but, obviously, I can't do the 
same for the id field. If I just keep db.ladore_order.id , without any 
aggregate function, in the select, it still works for sqlite, but it 
doesn't work for stricter db, like postgres. And it really shouldn't work 
with a field which is missing an aggregate function in the place of groupby.

3) If possible, I would also love to have the very same thing created with 
SQLFORM.grid() (I mean, I need both - rows with select, and also the 2nd 
way to do it with grid, if this is possible.

Thank you for help!! 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/9fd6ac75-d39f-4bad-8fa3-46ea3e73b3dan%40googlegroups.com.


[web2py] Re: customizing field's visibility in user's profile

2022-06-09 Thread Vlad
Got it, thank you very much! 

On Thursday, June 9, 2022 at 4:54:26 AM UTC-4 gauravv...@gmail.com wrote:

> In controllers/default.py, inside *user* function set *readable* and 
> *writable* to *False* for the fields that you want to hide.
>
> def user():
>
> *db.auth_user.field_name.readable = False
> db.auth_user.field_name.writable = False*
> return dict(form=auth())
>
> On Wednesday, June 8, 2022 at 2:02:54 AM UTC+5:30 Vlad wrote:
>
>> I added a few fields to auth_user, but they are for internal usage, so I 
>> don't want users to see those when they are logged in. How do I manage the 
>> visibility of the fields in the user profile? 
>>
>

-- 
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/376f8875-60fb-40cb-8a6e-404f5a740a86n%40googlegroups.com.


[web2py] Re: customizing field's visibility in user's profile

2022-06-09 Thread Vlad
Thank you, Jim, I was aware of this parameter, but I wasn't sure where 
exactly to set it. But just got the answer. Thank you very much. 

On Wednesday, June 8, 2022 at 11:01:24 AM UTC-4 Jim S wrote:

> Can you just set readable and writable to False?
>
> -Jim
>
>
> On Tuesday, June 7, 2022 at 3:32:54 PM UTC-5 Vlad wrote:
>
>> I added a few fields to auth_user, but they are for internal usage, so I 
>> don't want users to see those when they are logged in. How do I manage the 
>> visibility of the fields in the user profile? 
>>
>

-- 
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/bb06c5c3-919e-47a9-8716-3752a0971bfdn%40googlegroups.com.


Re: [web2py] Abridged summary of web2py@googlegroups.com - 1 update in 1 topic

2022-06-08 Thread Eliezer (Vlad) Tseytkin
Jim,
Thank you,
I understand this variable, and I use it all the time; I just don't know
where exactly to set it when it comes to user profile, as it is somewhere
in the system - I don't directly write/control it.

On Wed, Jun 8, 2022, 4:46 PM  wrote:

> web2py@googlegroups.com
> <https://groups.google.com/forum/?utm_source=digest_medium=email#!forum/web2py/topics>
>  Google
> Groups
> <https://groups.google.com/forum/?utm_source=digest_medium=email/#!overview>
> <https://groups.google.com/forum/?utm_source=digest_medium=email/#!overview>
> Today's topic summary
> View all topics
> <https://groups.google.com/forum/?utm_source=digest_medium=email#!forum/web2py/topics>
>
>- customizing field's visibility in user's profile
><#m_-5995939714933507823_group_thread_0> - 1 Update
>
> customizing field's visibility in user's profile
> <http://groups.google.com/group/web2py/t/6f3d34f8c0e91725?utm_source=digest_medium=email>
> Jim S : Jun 08 08:01AM -0700
>
> Can you just set readable and writable to False?
>
> -Jim
>
>
> On Tuesday, June 7, 2022 at 3:32:54 PM UTC-5 Vlad wrote:
>
> ...more
> <http://groups.google.com/group/web2py/msg/1637a67d9cc06?utm_source=digest_medium=email>
> Back to top <#m_-5995939714933507823_digest_top>
> You received this digest because you're subscribed to updates for this
> group. You can change your settings on the group membership page
> <https://groups.google.com/forum/?utm_source=digest_medium=email#!forum/web2py/join>
> .
> To unsubscribe from this group and stop receiving emails from it send an
> email to web2py+unsubscr...@googlegroups.com.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCC81UQJiC3gaB0o7tuTNWrsgdHiqhCBoQmddRQXDJ2Mjg%40mail.gmail.com.


[web2py] customizing field's visibility in user's profile

2022-06-07 Thread Vlad
I added a few fields to auth_user, but they are for internal usage, so I 
don't want users to see those when they are logged in. How do I manage the 
visibility of the fields in the user profile? 

-- 
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/77c94854-07f8-42b2-84b5-3829c7dbd520n%40googlegroups.com.


[web2py] auth_user missing signature

2022-06-07 Thread Vlad
I just realized that auth_user has no signature by default. I've just 
changed it, but wondering if there is a trick to find out when the existing 
users were created - maybe some history / log of some kind somewhere?  

-- 
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/0b81f213-d9c4-4cdd-92dc-fa79f4b4e832n%40googlegroups.com.


[web2py] Re: web2py.com down

2022-01-31 Thread Vlad
Indeed. 

On Sunday, January 30, 2022 at 10:20:06 PM UTC-6 Raul Monares wrote:

> The site is down :(

-- 
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/6b9c90a0-aba8-462e-9db4-ac0a362b07d1n%40googlegroups.com.


[web2py] CAS setting the callback URL

2022-01-28 Thread Vlad
I have both consumer and provider behind Apache, with actual names (*as 
opposed to localhost:port) *, however when doing CAS, the provider sends 
the request back to the instance:port location instead of the URL I am 
accessing it with.

The provider is defined in terms of its "external" URL (that is, not 
instance:port). That part works well.

Is there a way to setup the consumer server name so that the callback is 
sent to the correct location?

To note, if I manually adjust the callback URL, the consumer correctly 
manages the login. 

-- 
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/4c6e6679-5045-4be6-9d18-121fa6542837n%40googlegroups.com.


[web2py] The site hosted on PA is giving an error - an exception in db module

2021-09-23 Thread Vlad
 File 
/home/vladtseytkin/web2py-vt/applications/vt/databases/c8b669d15150d7109e5f7ab36744a5b7_podcast.table
 
appears corrupted

I haven't changed or updated anything for a while, so it's not caused by 
anything that I would have done. Any ideas on how to restore the good 
behavior and get rid of this problem? It seems that it's something 
internal... 

*Traceback (most recent call last):*
*  File 
"/home/vladtseytkin/web2py-vt/gluon/packages/dal/pydal/migrator.py", line 
296, in create_table*
*sql_fields_old = pickle.load(tfile)*
*EOFError: Ran out of input*

*During handling of the above exception, another exception occurred:*

*Traceback (most recent call last):*
*  File "/home/vladtseytkin/web2py-vt/gluon/restricted.py", line 219, in 
restricted*
*exec(ccode, environment)*
*  File "/home/vladtseytkin/web2py-vt/applications/vt/models/db.py", line 
168, in *
*Field('explicit', default='no'))*
*  File "/home/vladtseytkin/web2py-vt/gluon/packages/dal/pydal/base.py", 
line 590, in define_table*
*table = self.lazy_define_table(tablename, *fields, **kwargs)*
*  File "/home/vladtseytkin/web2py-vt/gluon/packages/dal/pydal/base.py", 
line 624, in lazy_define_table*
*polymodel=polymodel)*
*  File 
"/home/vladtseytkin/web2py-vt/gluon/packages/dal/pydal/adapters/base.py", 
line 798, in create_table*
*return self.migrator.create_table(*args, **kwargs)*
*  File 
"/home/vladtseytkin/web2py-vt/gluon/packages/dal/pydal/migrator.py", line 
299, in create_table*
*raise RuntimeError('File %s appears corrupted' % table._dbt)*
*RuntimeError: File 
/home/vladtseytkin/web2py-vt/applications/vt/databases/c8b669d15150d7109e5f7ab36744a5b7_podcast.table
 
appears corrupted*

Error snapshot help
RuntimeError(File 
/home/vladtseytkin/web2py-vt/applications/vt/databases/c8b669d15150d7109e5f7ab36744a5b7_podcast.table
 
appears corrupted)
Frames
File /home/vladtseytkin/web2py-vt/gluon/restricted.py in restricted at line 
219
File /home/vladtseytkin/web2py-vt/applications/vt/models/db.py in  
at line 168
File /home/vladtseytkin/web2py-vt/gluon/packages/dal/pydal/base.py in 
define_table at line 590
File /home/vladtseytkin/web2py-vt/gluon/packages/dal/pydal/base.py in 
lazy_define_table at line 624
File /home/vladtseytkin/web2py-vt/gluon/packages/dal/pydal/adapters/base.py 
in create_table at line 798
File /home/vladtseytkin/web2py-vt/gluon/packages/dal/pydal/migrator.py in 
create_table at line 299

*Code listing*
*tfile = self.file_open(table._dbt, 'rb')*
*try:*
*sql_fields_old = pickle.load(tfile)*
*except EOFError:*
*self.file_close(tfile)*
*raise RuntimeError('File %s appears corrupted' % 
table._dbt)*
*self.file_close(tfile)*
*# add missing rnames*
*for key, item in sql_fields_old.items():*
*tmp = sql_fields.get(key)*

-- 
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/313db595-fe76-40c8-b0ec-b880cc6d5eb9n%40googlegroups.com.


[web2py] Using min(), max(), count() with groupby in SQLFORM.grid

2020-12-23 Thread Vlad
Is there a limitation in the way SQLFORM.grid() can be used with groupby in 
the sense that functions like min(), max(), count() can't be used? 

the following gives an error: 
fields = [db.auth_user.id, db.my_table.created_on.min(), 
db.my_table.created_on.max()]
grid = SQLFORM.grid(query, fields=fields, groupby= db.auth_user.id)

the error is: 
 'Expression' object has no attribute 'tablename'  

-- 
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/b8e906f1-8e9b-4d00-8010-c0cb941171fan%40googlegroups.com.


[web2py] rendering rows as a generator and displaying via SQLTABLE

2020-12-23 Thread Vlad
I'm getting the rows as a result of the select:
*rows = db(query).select(*fields)*
and want to display as 
*table = SQLTABLE(rows, _class='table')*
but before displaying need to reformat based on field representation, so 
rendering first: 
*rendered_rows = rows.render()*
now I simply want to display the rendered_rows, like this: 
*table = SQLTABLE(rendered_rows, _class='table')* 
which is impossible because rendered_rows is a generator. I can iterate row 
by row, but don't know how to use it with SQLTABLE. 

Is there an easy way to transform the generator into the format that 
SQLTABLE understands? 
 

-- 
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/1c913a15-e00d-4551-afd1-97517eb3c047n%40googlegroups.com.


[web2py] modifying rows content before displaying in SQLTable (_extra in rows)

2020-11-21 Thread Vlad
I've got the following query: 

rows = 
db(query).select(db.ladore_order.total.sum().with_alias('Total'),
  
 db.ladore_order.total.count().with_alias('Transactions'),
  
 db.auth_user.first_name.with_alias('First_name'),
  
 db.auth_user.last_name.with_alias('Last_name'),
   groupby=groupy,
  
 orderby=[~db.ladore_order.total.sum()])

Need to modify the Total column before displaying rows (using SQLTABLE for 
that).

The problem is that something like rows[0].Total=123 doesn't work here, 
because the rows has the following structure: 



SQLTable which I use to display rows is not using row.Total , but rather 
gets info from _extra . 

How do I modify the column is rows properly, to be picked up by SQLTable? I 
don't really understand what this _extra is about and why the data in each 
rows gets duplicated like 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/395090d0-eda8-494a-a7a8-ed1467336e0an%40googlegroups.com.


Re: [web2py] Re: How to reject request based on location

2020-10-27 Thread Eliezer (Vlad) Tseytkin
Got it,
Thank you!

On Tue, Oct 27, 2020, 3:57 PM Val K  wrote:

> It seems PA doesnt support low-level-IP-blocking
> https://www.pythonanywhere.com/forums/topic/8212/
> So you have to use db.py as Chris mentioned (or something like
> *_block_list.py* in models dir - file name should be top most
> alphabetical)
> Also you can modify PA-starting script to catch bad-IP before passing
> request to web2py, but in this case you have to restart server after each
> change.
>
>
>
>
> вт, 27 окт. 2020 г. в 20:45, Eliezer (Vlad) Tseytkin <
> westgate6...@gmail.com>:
>
>> I see... Could you please give me a hint on where to find how to
>> accomplish this in nginx? (I use PythonAnywhere)
>>
>> On Tue, Oct 27, 2020 at 1:15 AM valq...@gmail.com 
>> wrote:
>>
>>> It is better to do this at front server like nginx, Apache or even at
>>> os-level. In web2py, models files are processed for each request, so you
>>> can just raise HTTP at db.py
>>>
>>> вторник, 27 октября 2020 г. в 04:52:57 UTC+3, Vlad:
>>>
>>>> I've discovered that my site is constantly bothered by weird locations
>>>> - not that there is anything  intrinsically  wrong with those countries,
>>>> but those locations have nothing to do with actual customers. I want to
>>>> reject the requests from those locations altogether.
>>>>
>>>> I can reject any specific page in controller code, but how do I reject
>>>> ANY request altogether, without coding it into multiple places?
>>>>
>>> --
>>> 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/af2Ct41wEE0/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/36ef2c26-b63f-48f1-b032-51f4774171c6n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/web2py/36ef2c26-b63f-48f1-b032-51f4774171c6n%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> 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/af2Ct41wEE0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/CABZ%2BKCCmiak3RNNqhWxDmy0YCuutZS5z3FU9QbQLUnDCcBO91w%40mail.gmail.com
>> <https://groups.google.com/d/msgid/web2py/CABZ%2BKCCmiak3RNNqhWxDmy0YCuutZS5z3FU9QbQLUnDCcBO91w%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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/af2Ct41wEE0/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/CAM94u4-roMZUNNg95Q%2BF13p5QgmEde11RXZq34tPYUz0piX39Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/web2py/CAM94u4-roMZUNNg95Q%2BF13p5QgmEde11RXZq34tPYUz0piX39Q%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCDbkpXAVyrtM1H-dvP0_hVQxV7dmEPrw7tzxxq-vDg8nA%40mail.gmail.com.


Re: [web2py] Re: How to reject request based on location

2020-10-27 Thread Eliezer (Vlad) Tseytkin
I see... Could you please give me a hint on where to find how to accomplish
this in nginx? (I use PythonAnywhere)

On Tue, Oct 27, 2020 at 1:15 AM valq...@gmail.com 
wrote:

> It is better to do this at front server like nginx, Apache or even at
> os-level. In web2py, models files are processed for each request, so you
> can just raise HTTP at db.py
>
> вторник, 27 октября 2020 г. в 04:52:57 UTC+3, Vlad:
>
>> I've discovered that my site is constantly bothered by weird locations -
>> not that there is anything  intrinsically  wrong with those countries, but
>> those locations have nothing to do with actual customers. I want to reject
>> the requests from those locations altogether.
>>
>> I can reject any specific page in controller code, but how do I reject
>> ANY request altogether, without coding it into multiple places?
>>
> --
> 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/af2Ct41wEE0/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/36ef2c26-b63f-48f1-b032-51f4774171c6n%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/36ef2c26-b63f-48f1-b032-51f4774171c6n%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCCmiak3RNNqhWxDmy0YCuutZS5z3FU9QbQLUnDCcBO91w%40mail.gmail.com.


[web2py] How to reject request based on location

2020-10-26 Thread Vlad
I've discovered that my site is constantly bothered by weird locations - 
not that there is anything  intrinsically  wrong with those countries, but 
those locations have nothing to do with actual customers. I want to reject 
the requests from those locations altogether. 

I can reject any specific page in controller code, but how do I reject ANY 
request altogether, without coding it into multiple places? 

-- 
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/7f38178e-872c-40f5-8626-4a213f9856e2n%40googlegroups.com.


[web2py] Re: Connecting to mysql with TLS

2020-10-11 Thread Vlad
in fact, I can connect via CLI with just adding "--ssl" to the standard 
client. 

Any way to achieve that with web2py DAL ?

On Sunday, October 11, 2020 at 1:47:16 PM UTC-5 Vlad wrote:

> web2py 2.11.2 
>
> Ok so I only need the CA to be validated. 
>
> Providing the path to the CA file like:
>
> DAL("mysql://remoteuser:password@remotedbserver/database", 
> driver_args={'ssl':{'ca':'path/to/ca/file'}})
>
> I get
> "/path/to/web2py/gluon/contrib/pymysql/connections.py", line 822, in 
> _send_authentication self.socket = ssl.wrap_self.socketet(self.socket, 
> keyfile=self.key, AttributeError: 'module' object has no attribute 
> 'wrap_self'
>
> I know this was asked before, but there was no comment given on that, 
> other than to work around it via SSH tunnel.
>
> Not an alternative in my case, long story.
>

-- 
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/03d179b9-79a6-4ccd-80ed-0aa6597ddad0n%40googlegroups.com.


[web2py] Connecting to mysql with TLS

2020-10-11 Thread Vlad
web2py 2.11.2 

Ok so I only need the CA to be validated. 

Providing the path to the CA file like:

DAL("mysql://remoteuser:password@remotedbserver/database", 
driver_args={'ssl':{'ca':'path/to/ca/file'}})

I get
"/path/to/web2py/gluon/contrib/pymysql/connections.py", line 822, in 
_send_authentication self.socket = ssl.wrap_self.socketet(self.socket, 
keyfile=self.key, AttributeError: 'module' object has no attribute 
'wrap_self'

I know this was asked before, but there was no comment given on that, other 
than to work around it via SSH tunnel.

Not an alternative in my case, long story.

-- 
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/ea10033e-6e26-42d4-bd9b-5d156ca1104fn%40googlegroups.com.


Re: [web2py] Re: Db fields in the "links" of the grid

2020-10-08 Thread Eliezer (Vlad) Tseytkin
Jim,

Thank you very much for your help,

This is a perfect solution for me. It just took me time to figure out what
was going on.

I don't think that this can be classified as a bug in web2py. It's just
very confusing for anybody who encounters this situation. However, if I am
the only one who has encountered it for the past 10 years, we can live with
it :)

Thank you!


On Thu, Oct 8, 2020, 10:58 AM Jim S  wrote:

> Vlad
>
> The behavior is exactly as you said it is.
>
> I don't know if I'd go as far as saying this is a problem with web2py.  I
> got around it by using this instead of the try/except in GetCartsGridLink
>
> id = row.cart.id if 'cart' in row else row.id
>
> I know it isn't ideal and isn't what you were looking for, but as you
> found, it isn't that hard to get around.  I'm just surprised that I haven't
> run into this over the years I've been working with web2py because I do
> similar linking in my apps all the time.
>
> Sorry I couldn't be of more help.
>
> Anyone else have any thoughts on this?
>
> -Jim
>
>
> On Thursday, October 8, 2020 at 8:45:41 AM UTC-5, Vlad wrote:
>>
>> Just realized that there is another field, virtual one, referenced in the
>> code. In case the problem doesn't reproduce without it, here is the
>> definition (but I don't think that this would be necessary):
>>
>> db.cart.count = Field.Virtual(lambda row: db(db.cart_content.cart==
>> row.cart.id
>> ).select(db.cart_content.quantity.count()).first()[db.cart_content.quantity.count()])
>>
>> And here is the model (and data attached):
>>
>> db.define_table('cart_content',
>>Field('cart','reference cart'),
>>Field('product','reference product'),
>>Field('formula','reference formula'),
>>Field('description','string',default=None),
>>Field('flavor','reference flavor'),
>>Field('quantity','integer',requires=[IS_NOT_EMPTY()],default=1),
>>Field('price','integer',represent=lambda x, row: '$' + str(x/100)),
>>Field('imported','boolean'),
>>auth.signature)
>>
>>
>>
>> On Thursday, October 8, 2020 at 9:37:34 AM UTC-4 Vlad wrote:
>>
>>> Sure, the sample data attached (are these 2 tables enough?), and the
>>> models are as follows:
>>>
>>> db.define_table('cart',
>>>Field('description','string',default='My Cart (%s)' %
>>> str((datetime.now().strftime("%m/%d/%Y %I:%M%p",
>>>auth.signature)
>>>
>>> db.define_table('cart_ownership',
>>> Field('description', 'string'),
>>> Field('boss','reference auth_user'),
>>> Field('cart', 'reference cart'),
>>> Field('status', 'string', requires=IS_IN_SET(['current','onhold'])),
>>> auth.signature)
>>>
>>>
>>> On Thursday, October 8, 2020 at 9:18:53 AM UTC-4 Jim S wrote:
>>>
>>>> any chance you have a model and a small sample-set of data you could
>>>> share that cause the inconsistencies to be shown?  Just 3 records or so in
>>>> each table that can show the inconsistency?
>>>>
>>>>
>>>> On Thursday, October 8, 2020 at 7:38:48 AM UTC-5, Vlad wrote:
>>>>
>>>>> Yes, there is always a corresponding record in the second table
>>>>> (doesn't have to be, but I do clean up ownerless carts, so when I am
>>>>> testing things, the corresponding record is always there).
>>>>>
>>>>> Here is the complete creation of the grid (where GetCartsGridLink is
>>>>> the function that now has try/except clause to flip between row.id
>>>>> and row.cart.id):
>>>>>
>>>>> def show_carts():
>>>>>> query = db.cart
>>>>>> headers = {'cart.id':'ID', 'cart.description':'Name',
>>>>>> 'cart_ownership.boss':'Owner', 'cart_ownership.status':'Status',
>>>>>> 'cart.count':'Items'}
>>>>>> fields = [db.cart.id, db.cart.description,
>>>>>> db.cart_ownership.boss, db.cart_ownership.status, db.cart.count]
>>>>>> links = [dict(header='View', body=GetCartsGridLink)]
>>>>>>
>>>>>> grid = SQLFORM.grid(query,
>>>>>> editable=True,
>>>>>> details=True,
>>>>>> create=True,
>>>>>> links=links,
>>>>>> fields=fields,
>>>>>> headers=headers,
>&g

Re: [web2py] Re: Db fields in the "links" of the grid

2020-10-08 Thread Vlad
Just realized that there is another field, virtual one, referenced in the 
code. In case the problem doesn't reproduce without it, here is the 
definition (but I don't think that this would be necessary): 

db.cart.count = Field.Virtual(lambda row: 
db(db.cart_content.cart==row.cart.id).select(db.cart_content.quantity.count()).first()[db.cart_content.quantity.count()])

And here is the model (and data attached):

db.define_table('cart_content',
   Field('cart','reference cart'),
   Field('product','reference product'),
   Field('formula','reference formula'),
   Field('description','string',default=None),
   Field('flavor','reference flavor'),
   Field('quantity','integer',requires=[IS_NOT_EMPTY()],default=1),
   Field('price','integer',represent=lambda x, row: '$' + str(x/100)),
   Field('imported','boolean'),
   auth.signature)



On Thursday, October 8, 2020 at 9:37:34 AM UTC-4 Vlad wrote:

> Sure, the sample data attached (are these 2 tables enough?), and the 
> models are as follows: 
>
> db.define_table('cart',
>Field('description','string',default='My Cart (%s)' % 
> str((datetime.now().strftime("%m/%d/%Y %I:%M%p",
>auth.signature)
>
> db.define_table('cart_ownership',
> Field('description', 'string'),
> Field('boss','reference auth_user'),
> Field('cart', 'reference cart'),
> Field('status', 'string', requires=IS_IN_SET(['current','onhold'])),
> auth.signature)
>
>
> On Thursday, October 8, 2020 at 9:18:53 AM UTC-4 Jim S wrote:
>
>> any chance you have a model and a small sample-set of data you could 
>> share that cause the inconsistencies to be shown?  Just 3 records or so in 
>> each table that can show the inconsistency?
>>
>>
>> On Thursday, October 8, 2020 at 7:38:48 AM UTC-5, Vlad wrote:
>>
>>> Yes, there is always a corresponding record in the second table (doesn't 
>>> have to be, but I do clean up ownerless carts, so when I am testing things, 
>>> the corresponding record is always there). 
>>>
>>> Here is the complete creation of the grid (where GetCartsGridLink is the 
>>> function that now has try/except clause to flip between row.id and 
>>> row.cart.id):
>>>
>>> def show_carts():
>>>> query = db.cart
>>>> headers = {'cart.id':'ID', 'cart.description':'Name', 
>>>> 'cart_ownership.boss':'Owner', 'cart_ownership.status':'Status', 
>>>> 'cart.count':'Items'}
>>>> fields = [db.cart.id, db.cart.description, db.cart_ownership.boss, 
>>>> db.cart_ownership.status, db.cart.count]
>>>> links = [dict(header='View', body=GetCartsGridLink)]
>>>>
>>>> grid = SQLFORM.grid(query,
>>>> editable=True,
>>>> details=True,
>>>> create=True,
>>>> links=links,
>>>> fields=fields,
>>>> headers=headers,
>>>> orderby=[~db.cart.created_on],
>>>> left = [db.cart_ownership.on(db.cart.id
>>>> ==db.cart_ownership.cart)],
>>>> formname='carts_grid',
>>>> field_id=db.cart.id,
>>>> )
>>>>
>>>> return grid
>>>
>>>  
>>>
>>>
>>>
>>> On Wed, Oct 7, 2020 at 11:12 PM Jim Steil  wrote:
>>>
>> I will take a look tomorrow to see if I can code something up to 
>>>> reproduce the error.
>>>>
>>>> Which tackle are you setting as the 'primary' table, by that I mean 
>>>> what field are you specifying in the field_id parameter?  And, is there 
>>>> ALWAYS a matching record in the secondary table? 
>>>>
>>>> Oh, just thought of another thing. How about specifying db.cart.id in 
>>>> fields=[], and the also specifying it in hidden_fields=[]?
>>>>
>>>> Jim
>>>>
>>>>
>>>>
>>>> On Wed, Oct 7, 2020, 9:50 PM Eliezer (Vlad) Tseytkin <
>>>> westga...@gmail.com> wrote:
>>>>
>>> Jom, you said " I'm having trouble understanding why you need the 
>>>>> try/except" - this is exactly the trouble I'm having too :) 
>>>>>
>>>>> I do use the left join. So I should simply specify the table name - 
>>>>> correct?
>>>>>
>>>>> Well, if I do - then the grid itself works fine, but once I click 
&g

Re: [web2py] Re: Db fields in the "links" of the grid

2020-10-08 Thread Vlad
Sure, the sample data attached (are these 2 tables enough?), and the models 
are as follows: 

db.define_table('cart',
   Field('description','string',default='My Cart (%s)' % 
str((datetime.now().strftime("%m/%d/%Y %I:%M%p",
   auth.signature)

db.define_table('cart_ownership',
Field('description', 'string'),
Field('boss','reference auth_user'),
Field('cart', 'reference cart'),
Field('status', 'string', requires=IS_IN_SET(['current','onhold'])),
auth.signature)


On Thursday, October 8, 2020 at 9:18:53 AM UTC-4 Jim S wrote:

> any chance you have a model and a small sample-set of data you could share 
> that cause the inconsistencies to be shown?  Just 3 records or so in each 
> table that can show the inconsistency?
>
>
> On Thursday, October 8, 2020 at 7:38:48 AM UTC-5, Vlad wrote:
>
>> Yes, there is always a corresponding record in the second table (doesn't 
>> have to be, but I do clean up ownerless carts, so when I am testing things, 
>> the corresponding record is always there). 
>>
>> Here is the complete creation of the grid (where GetCartsGridLink is the 
>> function that now has try/except clause to flip between row.id and 
>> row.cart.id):
>>
>> def show_carts():
>>> query = db.cart
>>> headers = {'cart.id':'ID', 'cart.description':'Name', 
>>> 'cart_ownership.boss':'Owner', 'cart_ownership.status':'Status', 
>>> 'cart.count':'Items'}
>>> fields = [db.cart.id, db.cart.description, db.cart_ownership.boss, 
>>> db.cart_ownership.status, db.cart.count]
>>> links = [dict(header='View', body=GetCartsGridLink)]
>>>
>>> grid = SQLFORM.grid(query,
>>> editable=True,
>>> details=True,
>>> create=True,
>>> links=links,
>>> fields=fields,
>>> headers=headers,
>>> orderby=[~db.cart.created_on],
>>> left = [db.cart_ownership.on(db.cart.id
>>> ==db.cart_ownership.cart)],
>>> formname='carts_grid',
>>> field_id=db.cart.id,
>>> )
>>>
>>> return grid
>>
>>  
>>
>>
>>
>> On Wed, Oct 7, 2020 at 11:12 PM Jim Steil  wrote:
>>
> I will take a look tomorrow to see if I can code something up to reproduce 
>>> the error.
>>>
>>> Which tackle are you setting as the 'primary' table, by that I mean what 
>>> field are you specifying in the field_id parameter?  And, is there ALWAYS a 
>>> matching record in the secondary table? 
>>>
>>> Oh, just thought of another thing. How about specifying db.cart.id in 
>>> fields=[], and the also specifying it in hidden_fields=[]?
>>>
>>> Jim
>>>
>>>
>>>
>>> On Wed, Oct 7, 2020, 9:50 PM Eliezer (Vlad) Tseytkin <
>>> westga...@gmail.com> wrote:
>>>
>> Jom, you said " I'm having trouble understanding why you need the 
>>>> try/except" - this is exactly the trouble I'm having too :) 
>>>>
>>>> I do use the left join. So I should simply specify the table name - 
>>>> correct?
>>>>
>>>> Well, if I do - then the grid itself works fine, but once I click 
>>>> "view" or "edit"  - it crashes. To fix that crash, I must specify 
>>>> try/except clause in the function used by the "links". WIthout that 
>>>> try/except the actions of view and edit don' work! 
>>>>
>>>> That's exactly what I am saying - with the left join, the grid expects 
>>>> the table name, but the view/edit actions of this grid expect no table 
>>>> name 
>>>> and in fact crash when the table name is there.  
>>>>
>>>> On Wed, Oct 7, 2020 at 10:38 PM Jim S  wrote:
>>>>
>>> I'm having trouble understanding why you need the try/except.  To me it 
>>>>> seems like "if you specify a left" -> you need to use the table name.  
>>>>> "if 
>>>>> you don't specify a left" -> omit the table name
>>>>>
>>>>> Do you have an occasion where sometimes different rows in the same 
>>>>> grid require you to specify the field differently?
>>>>>
>>>>> -Jim
>>>>>
>>>>> On Wednesday, October 7, 2020 at 9:30:28 PM UTC-5

Re: [web2py] Re: Db fields in the "links" of the grid

2020-10-08 Thread Eliezer (Vlad) Tseytkin
Yes, there is always a corresponding record in the second table (doesn't
have to be, but I do clean up ownerless carts, so when I am testing things,
the corresponding record is always there).

Here is the complete creation of the grid (where GetCartsGridLink is the
function that now has try/except clause to flip between row.id and
row.cart.id):

def show_carts():
> query = db.cart
> headers = {'cart.id':'ID', 'cart.description':'Name',
> 'cart_ownership.boss':'Owner', 'cart_ownership.status':'Status',
> 'cart.count':'Items'}
> fields = [db.cart.id, db.cart.description, db.cart_ownership.boss,
> db.cart_ownership.status, db.cart.count]
> links = [dict(header='View', body=GetCartsGridLink)]
>
> grid = SQLFORM.grid(query,
> editable=True,
> details=True,
> create=True,
> links=links,
> fields=fields,
> headers=headers,
> orderby=[~db.cart.created_on],
> left = [db.cart_ownership.on(db.cart.id
> ==db.cart_ownership.cart)],
> formname='carts_grid',
> field_id=db.cart.id,
> )
>
> return grid





On Wed, Oct 7, 2020 at 11:12 PM Jim Steil  wrote:

> I will take a look tomorrow to see if I can code something up to reproduce
> the error.
>
> Which tackle are you setting as the 'primary' table, by that I mean what
> field are you specifying in the field_id parameter?  And, is there ALWAYS a
> matching record in the secondary table?
>
> Oh, just thought of another thing. How about specifying db.cart.id in
> fields=[], and the also specifying it in hidden_fields=[]?
>
> Jim
>
>
>
> On Wed, Oct 7, 2020, 9:50 PM Eliezer (Vlad) Tseytkin <
> westgate6...@gmail.com> wrote:
>
>> Jom, you said " I'm having trouble understanding why you need the
>> try/except" - this is exactly the trouble I'm having too :)
>>
>> I do use the left join. So I should simply specify the table name -
>> correct?
>>
>> Well, if I do - then the grid itself works fine, but once I click "view"
>> or "edit"  - it crashes. To fix that crash, I must specify try/except
>> clause in the function used by the "links". WIthout that try/except the
>> actions of view and edit don' work!
>>
>> That's exactly what I am saying - with the left join, the grid expects
>> the table name, but the view/edit actions of this grid expect no table name
>> and in fact crash when the table name is there.
>>
>> On Wed, Oct 7, 2020 at 10:38 PM Jim S  wrote:
>>
>>> I'm having trouble understanding why you need the try/except.  To me it
>>> seems like "if you specify a left" -> you need to use the table name.  "if
>>> you don't specify a left" -> omit the table name
>>>
>>> Do you have an occasion where sometimes different rows in the same grid
>>> require you to specify the field differently?
>>>
>>> -Jim
>>>
>>> On Wednesday, October 7, 2020 at 9:30:28 PM UTC-5, Vlad wrote:
>>>>
>>>> But shouldn't it be the same for the grid and for the record of the
>>>> grid? The difference confuses me - having to specify the table should be
>>>> consistent when I use the grid for all the transactions of the
>>>> grid, including view/edit etc..
>>>>
>>>> In other words, having to specify the table is perfectly fine - but it
>>>> should be consistent and I should as well specify the table for the
>>>> view/edit action of the grid record. Different structures for the gird and
>>>> fo the record of the grid seems inconsistent to me.It took me time to
>>>> figure this out - now that I know how this works, I simply have the
>>>> try/except to solve it - this makes practical sense, as it solves the
>>>> problem, but it makes no logical sense. Do you know what I mean? Anybody
>>>> who encounters such a situation will presumably be messed up and have to
>>>> spend time figuring out what's going on.
>>>>
>>>> On Wed, Oct 7, 2020 at 10:22 PM Jim Steil  wrote:
>>>>
>>>>> I think that is a result of having a left join specified.  With the
>>>>> left join you now have to specify which table the field is in as well.
>>>>>
>>>>> Or, am I missing something?
>>>>>
>>>>> -Jim
>>>>>
>>>>> On Wed, Oct 7, 2020 at 9:13

Re: [web2py] Re: Db fields in the "links" of the grid

2020-10-07 Thread Eliezer (Vlad) Tseytkin
Jom, you said " I'm having trouble understanding why you need the
try/except" - this is exactly the trouble I'm having too :)

I do use the left join. So I should simply specify the table name - correct?

Well, if I do - then the grid itself works fine, but once I click "view" or
"edit"  - it crashes. To fix that crash, I must specify try/except clause
in the function used by the "links". WIthout that try/except the actions of
view and edit don' work!

That's exactly what I am saying - with the left join, the grid expects the
table name, but the view/edit actions of this grid expect no table name and
in fact crash when the table name is there.

On Wed, Oct 7, 2020 at 10:38 PM Jim S  wrote:

> I'm having trouble understanding why you need the try/except.  To me it
> seems like "if you specify a left" -> you need to use the table name.  "if
> you don't specify a left" -> omit the table name
>
> Do you have an occasion where sometimes different rows in the same grid
> require you to specify the field differently?
>
> -Jim
>
> On Wednesday, October 7, 2020 at 9:30:28 PM UTC-5, Vlad wrote:
>>
>> But shouldn't it be the same for the grid and for the record of the grid?
>> The difference confuses me - having to specify the table should be
>> consistent when I use the grid for all the transactions of the
>> grid, including view/edit etc..
>>
>> In other words, having to specify the table is perfectly fine - but it
>> should be consistent and I should as well specify the table for the
>> view/edit action of the grid record. Different structures for the gird and
>> fo the record of the grid seems inconsistent to me.It took me time to
>> figure this out - now that I know how this works, I simply have the
>> try/except to solve it - this makes practical sense, as it solves the
>> problem, but it makes no logical sense. Do you know what I mean? Anybody
>> who encounters such a situation will presumably be messed up and have to
>> spend time figuring out what's going on.
>>
>> On Wed, Oct 7, 2020 at 10:22 PM Jim Steil  wrote:
>>
>>> I think that is a result of having a left join specified.  With the left
>>> join you now have to specify which table the field is in as well.
>>>
>>> Or, am I missing something?
>>>
>>> -Jim
>>>
>>> On Wed, Oct 7, 2020 at 9:13 PM Eliezer (Vlad) Tseytkin <
>>> westga...@gmail.com> wrote:
>>>
>>>> Jim,
>>>>
>>>> Thank you for the suggestions.
>>>>
>>>> I do specify field_id (it wasn't there in the simplified code, but the
>>>> complete code does have it).
>>>>
>>>> When I use a function, instead of the lambda, I indeed can have a
>>>> solution, but at the same time it emphasizes that something is wrong:
>>>>
>>>> The links are now presented as such:
>>>>
>>>> links = [dict(header='View', body=GetCartsGridLink)]
>>>>
>>>>
>>>> And the GetCarrsGridLink function as follows:
>>>>
>>>> def GetCartsGridLink(row):
>>>>>
>>>>> id = None
>>>>>
>>>>> try:
>>>>>   id = row.cart.id # this works for the grid itself
>>>>> except:
>>>>>   id = row.id # this works for the view/edit of a record of the
>>>>> grid
>>>>>
>>>>> result = A(id,
>>>>>_href=URL('manage', 'view_cart', args=id,
>>>>> user_signature=True),
>>>>>_target='blank')
>>>>>
>>>>> return result
>>>>
>>>>
>>>> It does solve the problem, because try/except takes care of it, setting
>>>> up the id based on the context.
>>>>
>>>> I feel there is something wrong with the very necessity of having to
>>>> use try/except here. Why would it use different structures in the grid
>>>> itself vs. view/edit a row of the grid???
>>>>
>>>> The problem has been solved, but the mystery remains. I am still
>>>> missing something about it...
>>>>
>>>> On Wed, Oct 7, 2020 at 4:48 PM Jim S  wrote:
>>>>
>>>>> I have a couple of ideas, but none are tested
>>>>>
>>>>> First, can you try adding the field_id parameter to your
>>>>> SQLFORM.grid() call?  I believe that tells this grid which is your
>>>>> 'primary' table.
>>>>>

Re: [web2py] Re: Db fields in the "links" of the grid

2020-10-07 Thread Eliezer (Vlad) Tseytkin
But shouldn't it be the same for the grid and for the record of the grid?
The difference confuses me - having to specify the table should be
consistent when I use the grid for all the transactions of the
grid, including view/edit etc..

In other words, having to specify the table is perfectly fine - but it
should be consistent and I should as well specify the table for the
view/edit action of the grid record. Different structures for the gird and
fo the record of the grid seems inconsistent to me.It took me time to
figure this out - now that I know how this works, I simply have the
try/except to solve it - this makes practical sense, as it solves the
problem, but it makes no logical sense. Do you know what I mean? Anybody
who encounters such a situation will presumably be messed up and have to
spend time figuring out what's going on.

On Wed, Oct 7, 2020 at 10:22 PM Jim Steil  wrote:

> I think that is a result of having a left join specified.  With the left
> join you now have to specify which table the field is in as well.
>
> Or, am I missing something?
>
> -Jim
>
> On Wed, Oct 7, 2020 at 9:13 PM Eliezer (Vlad) Tseytkin <
> westgate6...@gmail.com> wrote:
>
>> Jim,
>>
>> Thank you for the suggestions.
>>
>> I do specify field_id (it wasn't there in the simplified code, but the
>> complete code does have it).
>>
>> When I use a function, instead of the lambda, I indeed can have a
>> solution, but at the same time it emphasizes that something is wrong:
>>
>> The links are now presented as such:
>>
>> links = [dict(header='View', body=GetCartsGridLink)]
>>
>>
>> And the GetCarrsGridLink function as follows:
>>
>> def GetCartsGridLink(row):
>>>
>>> id = None
>>>
>>> try:
>>>   id = row.cart.id # this works for the grid itself
>>> except:
>>>   id = row.id # this works for the view/edit of a record of the grid
>>>
>>> result = A(id,
>>>_href=URL('manage', 'view_cart', args=id,
>>> user_signature=True),
>>>_target='blank')
>>>
>>> return result
>>
>>
>> It does solve the problem, because try/except takes care of it, setting
>> up the id based on the context.
>>
>> I feel there is something wrong with the very necessity of having to use
>> try/except here. Why would it use different structures in the grid itself
>> vs. view/edit a row of the grid???
>>
>> The problem has been solved, but the mystery remains. I am still missing
>> something about it...
>>
>> On Wed, Oct 7, 2020 at 4:48 PM Jim S  wrote:
>>
>>> I have a couple of ideas, but none are tested
>>>
>>> First, can you try adding the field_id parameter to your SQLFORM.grid()
>>> call?  I believe that tells this grid which is your 'primary' table.
>>>
>>> Secondly (this is the way I typically handle it) - instead of coding
>>> everything in a lambda, call a function to build your buttons and just pass
>>> it the id of the row.  Then, in your function you can retrieve the entire
>>> row and get all the data you need even if it isn't included in the grid
>>> fields.
>>>
>>> Not sure that completely addresses your concern, but if you run through
>>> those ideas it might help you onto a solution.
>>>
>>> -Jim
>>>
>>>
>>> On Wednesday, October 7, 2020 at 1:44:41 PM UTC-5, Vlad wrote:
>>>>
>>>> Seems to me this is an inconsistency in the way how grid operates
>>>> (which breaks it, as I show below, but, of course, most probably I am just
>>>> missing something.)
>>>>
>>>> The following code crashes:
>>>>
>>>> query = db.cart
>>>> fields = [db.cart.id]
>>>> links = [dict(header='View', body=lambda row: str(*row.cart.id
>>>> <http://row.cart.id>*))]
>>>> grid = SQLFORM.grid(query, editable=True, details=True,
>>>> links=links, fields=fields)
>>>>
>>>> This is because row.cart is undefined in the links. Instead, the links
>>>> should be made as such:
>>>>
>>>> links = [dict(header='View', body=lambda row: str(*row.id
>>>> <http://row.id>*))]
>>>>
>>>> Now this works.
>>>>
>>>> However, when I add more fields in the code, like this:
>>>>
>>>> fields = [db.cart.id, db.cart.description, db.cart_ownership.boss,
>>>> db.cart_ownership.status, db.cart.count]

Re: [web2py] Re: Db fields in the "links" of the grid

2020-10-07 Thread Eliezer (Vlad) Tseytkin
Jim,

Thank you for the suggestions.

I do specify field_id (it wasn't there in the simplified code, but the
complete code does have it).

When I use a function, instead of the lambda, I indeed can have a solution,
but at the same time it emphasizes that something is wrong:

The links are now presented as such:

links = [dict(header='View', body=GetCartsGridLink)]


And the GetCarrsGridLink function as follows:

def GetCartsGridLink(row):
>
> id = None
>
> try:
>   id = row.cart.id # this works for the grid itself
> except:
>   id = row.id # this works for the view/edit of a record of the grid
>
> result = A(id,
>_href=URL('manage', 'view_cart', args=id,
> user_signature=True),
>_target='blank')
>
> return result


It does solve the problem, because try/except takes care of it, setting up
the id based on the context.

I feel there is something wrong with the very necessity of having to use
try/except here. Why would it use different structures in the grid itself
vs. view/edit a row of the grid???

The problem has been solved, but the mystery remains. I am still missing
something about it...

On Wed, Oct 7, 2020 at 4:48 PM Jim S  wrote:

> I have a couple of ideas, but none are tested
>
> First, can you try adding the field_id parameter to your SQLFORM.grid()
> call?  I believe that tells this grid which is your 'primary' table.
>
> Secondly (this is the way I typically handle it) - instead of coding
> everything in a lambda, call a function to build your buttons and just pass
> it the id of the row.  Then, in your function you can retrieve the entire
> row and get all the data you need even if it isn't included in the grid
> fields.
>
> Not sure that completely addresses your concern, but if you run through
> those ideas it might help you onto a solution.
>
> -Jim
>
>
> On Wednesday, October 7, 2020 at 1:44:41 PM UTC-5, Vlad wrote:
>>
>> Seems to me this is an inconsistency in the way how grid operates (which
>> breaks it, as I show below, but, of course, most probably I am just missing
>> something.)
>>
>> The following code crashes:
>>
>> query = db.cart
>> fields = [db.cart.id]
>> links = [dict(header='View', body=lambda row: str(*row.cart.id
>> <http://row.cart.id>*))]
>> grid = SQLFORM.grid(query, editable=True, details=True, links=links,
>> fields=fields)
>>
>> This is because row.cart is undefined in the links. Instead, the links
>> should be made as such:
>>
>> links = [dict(header='View', body=lambda row: str(*row.id
>> <http://row.id>*))]
>>
>> Now this works.
>>
>> However, when I add more fields in the code, like this:
>>
>> fields = [db.cart.id, db.cart.description, db.cart_ownership.boss,
>> db.cart_ownership.status, db.cart.count]
>>
>> Now in the links I can't use "row.id". It must be "row.cart.id"
>>
>> This by itself would be fine, I could just use *row.id <http://row.id>*
>> or *row.card.id <http://row.card.id>* accordingly, depending on the
>> fields used (though I would like to control this structure), but I am
>> having the following problem further on:
>>
>> The grid described by the code
>>
>> query = db.cart
>> fields = [db.cart.id, db.cart.description, db.cart_ownership.boss,
>> db.cart_ownership.status, db.cart.count]
>> links = [dict(header='View', body=lambda row: str(row.cart.id))]
>> grid = SQLFORM.grid(query, editable=True, details=True, links=links,
>> fields=fields)
>>
>> crashes when I try to view or edit a row of the grid. This is because the
>> links takes  row.cart.id in the grid itself, but expects row.id in edit-
>> or view- actions (i.e. when editing or viewing a row). When viewing or
>> editing a row, row.cart is undefined in the links, so row.cart.id
>> crashes it (when "view" or "edit" buttons are clicked), while in the grid
>> itself row.cart.id works just fine (and row.id would not work).
>>
>> What am I missing here? How do I control how this field should be
>> expected in the links in the grid vs. in the view/edit a row of the grid?
>>
>> Here is still simplified but more complete code, in case I missed
>> something important in a "shortcut" code above:
>>
>> query = db.cart
>> fields = [db.cart.id, db.cart.description, db.cart_ownership.boss,
>> db.cart_ownership.status, db.cart.count]
>> links = [dict(header='View', body=lambda row: str(row.cart.id))]
>> grid = SQLFORM.grid(query,
>>  

[web2py] Db fields in the "links" of the grid

2020-10-07 Thread Vlad
Seems to me this is an inconsistency in the way how grid operates (which 
breaks it, as I show below, but, of course, most probably I am just missing 
something.)

The following code crashes: 

query = db.cart
fields = [db.cart.id]
links = [dict(header='View', body=lambda row: str(*row.cart.id*))]
grid = SQLFORM.grid(query, editable=True, details=True, links=links, 
fields=fields)
 
This is because row.cart is undefined in the links. Instead, the links 
should be made as such: 

links = [dict(header='View', body=lambda row: str(*row.id*))]

Now this works. 

However, when I add more fields in the code, like this: 

fields = [db.cart.id, db.cart.description, db.cart_ownership.boss, 
db.cart_ownership.status, db.cart.count]

Now in the links I can't use "row.id". It must be "row.cart.id"

This by itself would be fine, I could just use *row.id* or *row.card.id* 
accordingly, depending on the fields used (though I would like to control 
this structure), but I am having the following problem further on: 

The grid described by the code

query = db.cart
fields = [db.cart.id, db.cart.description, db.cart_ownership.boss, 
db.cart_ownership.status, db.cart.count]
links = [dict(header='View', body=lambda row: str(row.cart.id))]
grid = SQLFORM.grid(query, editable=True, details=True, links=links, 
fields=fields)

crashes when I try to view or edit a row of the grid. This is because the 
links takes  row.cart.id in the grid itself, but expects row.id in edit- or 
view- actions (i.e. when editing or viewing a row). When viewing or editing 
a row, row.cart is undefined in the links, so row.cart.id crashes it (when 
"view" or "edit" buttons are clicked), while in the grid itself row.cart.id 
works just fine (and row.id would not work). 

What am I missing here? How do I control how this field should be expected 
in the links in the grid vs. in the view/edit a row of the grid? 

Here is still simplified but more complete code, in case I missed something 
important in a "shortcut" code above: 

query = db.cart
fields = [db.cart.id, db.cart.description, db.cart_ownership.boss, 
db.cart_ownership.status, db.cart.count]
links = [dict(header='View', body=lambda row: str(row.cart.id))]
grid = SQLFORM.grid(query,
editable=True,
details=True,
links=links,
fields=fields,
left = 
[db.cart_ownership.on(db.cart.id==db.cart_ownership.cart)],
field_id=db.cart.id,
)

-- 
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/58611d49-3cd2-407c-97f4-b34c9f2223d3n%40googlegroups.com.


[web2py] formatting a field in SQLTABLE

2020-08-23 Thread Vlad
I've got the rows to be displayed in a table:

rows = db(query).select(db.orders.total.sum().with_alias('Total'), 
...)

and using 

 SQLTABLE(rows)

to show the data. 

How can I format this total.sum() in the SQLTABLE? More specifically, this 
total is the total amount in cents, and I need to display it in dollars, 
i.e. divide by 100 and append with '$'. 

It's easy to do it if using TABLE and iterating over rows, but SQLTABLE is 
pretty convenient to use, so I'd like to stick with it. 

Is there a way to customize the fields like this in SQLTABLE ?




-- 
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/5e7fe1f6-fb89-48d1-b353-1df884d0afadn%40googlegroups.com.


[web2py] Re: Nested menu item

2020-08-18 Thread Vlad
I may be missing something, but it seems to me that by design MENU helper 
produces regular, simple menu code, as it's not bootstrap-enabled by 
itself. I mean, this was my assumption to begin with; that's why I haven't 
even tried it - rather setting up menu as a list  of items  (i.e. data 
structure to be used in menu, which by default belongs to menu.py) and in 
layout.html I create an explicit bootstrap menu, iterating over the list, 
using appropriate html code, and this is how I use it. 

On Tuesday, August 18, 2020 at 4:55:06 AM UTC-4 Annet wrote:

> Hi,
>
> I've got a two level menu, however, calling 
>
> {{=MENU(response.app_menu)}}
>
> doesn't render a Bootstrap 4 menu like your resulting html code. It
> renders something pretty ugly:
>
> 
>   
>  class="fas fa-home">
> 
> 
>   Our network
>   Networks we joined
>  
>
>   
>  
>
>
> Do you have any idea how to solve this issue?
>
> Kind regards,
>
> Annet
>
> Op vrijdag 17 juli 2020 om 16:33:16 UTC+2 schreef Vlad:
>
>> Missing something basic, but seems to me that the following code should 
>> result in nested menu:
>>
>> response.menu = [['One', False, 'link1',
>>   [
>> ['Two', False, None,
>>['Three', False, 'link3']
>> ]
>>   ]
>>  ]
>> ]
>>
>> "One" menu items contains "two", as it should, but "two" comes out to be 
>> a simple menu item, not containing "three" in it. What's missing?? How do I 
>> make nested sub-menu items? 
>>
>> Here is the resulting html, where "three" sub-item is not even present: 
>>
>> 
>>  
>> One
>>  
>>   Two
>>  
>> 
>>
>>
>>
>>
>>

-- 
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/ac140d58-8f06-4455-b4e0-b9dd9fd028a0n%40googlegroups.com.


[web2py] Re: modules: NameError("name 'reload' is not defined",)

2020-08-16 Thread Vlad
same error, though with a lot more than 3 lines

On Wednesday, June 24, 2020 at 5:36:36 AM UTC-5 serge.bo...@gmail.com wrote:

>
> I have an issue saving my modues with the last version of web2py.
> Is there something I do wrong?
>
> Context: Ubuntu 18.04 / web2py version 2.20.4 / python 3.6.9
>
> How to reproduce this issue (a bug??) with a simple example:
>
> In the applications examples, create a module (for instance empty.py)
>
> Then open it, 
> => url: 
> 127.0.0.1:8000/admin/default/edit/examples/modules/empty.py?id=modules__empty__py
> The file contains 3 lines:
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
> from gluon import *
>
> do not change anything and save it (ctrl + S)...
>
> => Since the last version, I get the following message:
>
>  Impossible de recharger le module car:
>  NameError("name 'reload' is not defined",)
>
> Thanks for any advise...
>

-- 
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/beb7c0d2-dd93-4b03-b16f-34545e952a02n%40googlegroups.com.


[web2py] Form input for date does not start the calendar date picker

2020-08-02 Thread Vlad
Ok so I have this *non-SQLFORM* form

form = FORM(TABLE(TR(XML('Please enter/select below'),XML('')),
TR(XML('Created'),INPUT(_name='skillcreated', 
_value=skillsdict['created']), _type="text",   ),
TR(XML(''),XML('')),
TR(INPUT(_type='submit',_value="SUBMIT"),XML(''

I have tried using 
type="date"
_type="date"
requires = IS_DATE(format=T('%Y-%m-%d'),

but in neither case I can get the calendar picker automatically added for 
the field.

Tried to search doc, examples, even the code in an auto-generated web2py 
form, to no avail.

All help will be appreciated 



-- 
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/2c4b9884-ab72-42fa-8f9e-2a6ce12f62f3o%40googlegroups.com.


Re: [web2py] Nested menu item

2020-07-17 Thread Eliezer (Vlad) Tseytkin
Oops!

Got it, thank you

On Fri, Jul 17, 2020 at 11:03 AM AGRogers  wrote:

> I don't think bootstrap (which is what web2py utilises I think) allows for
> the second nested level. So to do it you would need to implement your own
> custom menu structure.
>
> On Sat, 18 Jul 2020, 12:33 am Vlad,  wrote:
>
>> Missing something basic, but seems to me that the following code should
>> result in nested menu:
>>
>> response.menu = [['One', False, 'link1',
>>   [
>> ['Two', False, None,
>>['Three', False, 'link3']
>> ]
>>   ]
>>  ]
>> ]
>>
>> "One" menu items contains "two", as it should, but "two" comes out to be
>> a simple menu item, not containing "three" in it. What's missing?? How do I
>> make nested sub-menu items?
>>
>> --
>> 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/8e2371ef-4b20-4369-86e0-1d1ebf911952o%40googlegroups.com
>> <https://groups.google.com/d/msgid/web2py/8e2371ef-4b20-4369-86e0-1d1ebf911952o%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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/OFGY4HLlYO4/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/CACWMBMPH458V35O1Jh%2BKto_Ed2HznYwOsL9wW1qh%2BRe-BP093Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/web2py/CACWMBMPH458V35O1Jh%2BKto_Ed2HznYwOsL9wW1qh%2BRe-BP093Q%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCA-zgkXoSfj0td4422BpGnmwv8SU44UqMO40mFZaexqsg%40mail.gmail.com.


[web2py] Nested menu item

2020-07-17 Thread Vlad
Missing something basic, but seems to me that the following code should 
result in nested menu:

response.menu = [['One', False, 'link1',
  [
['Two', False, None,
   ['Three', False, 'link3']
]
  ]
 ]
]

"One" menu items contains "two", as it should, but "two" comes out to be a 
simple menu item, not containing "three" in it. What's missing?? How do I 
make nested sub-menu items? 

-- 
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/8e2371ef-4b20-4369-86e0-1d1ebf911952o%40googlegroups.com.


Re: [web2py] Re: belongs to one table but not the other ...

2020-07-15 Thread Eliezer (Vlad) Tseytkin
Thank you!

On Wed, Jul 15, 2020, 2:40 AM Andrew Rogers  wrote:

> Try adding a '~' in front of it.
>
> db(~(db.cart.id.belongs(another_table_select))).select(db.cart.id)
>
> See:
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=lazy#Logical-operators
>
> On Wednesday, 15 July 2020 13:12:53 UTC+10, Vlad wrote:
>>
>> I have the following select to get the ids that are in one table, also
>> belonging to another table:
>>
>> db(db.cart.id.belongs(another_table_select)).select(db.cart.id)
>>
>> I can't figure out how to do just the opposite - to get the ids that do
>> NOT belong to the other table, i.e. exist in one table but not the other.
>> How do I specify opposite of "belongs" in such a query?
>> .
>>
> --
> 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/t07RuFIU8Ok/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/2e765687-25d1-4ff4-9c1c-a4d9c34ddd2fo%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/2e765687-25d1-4ff4-9c1c-a4d9c34ddd2fo%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCBQQGjZ7c%2BZiUAen06-2yGhdSE6kxHgnRfZm5H5DVxpEA%40mail.gmail.com.


[web2py] belongs to one table but not the other ...

2020-07-14 Thread Vlad
I have the following select to get the ids that are in one table, also 
belonging to another table:

db(db.cart.id.belongs(another_table_select)).select(db.cart.id)

I can't figure out how to do just the opposite - to get the ids that do NOT 
belong to the other table, i.e. exist in one table but not the other. 
How do I specify opposite of "belongs" in such a query?
. 

-- 
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/bfead405-c07f-4350-b82b-6eef15456bfbo%40googlegroups.com.


Re: [web2py] count() as a field in sqlform.grid

2020-07-14 Thread Vlad
Perfect solution for me; somehow didn't think about it - 
Thank you! 

On Tuesday, July 14, 2020 at 2:51:59 AM UTC-4, AGRogers wrote:
>
> Can you add a virtual field to the Cart table to do the counting for you? 
>
> On Tue, 14 Jul 2020, 4:34 pm Vlad, > 
> wrote:
>
>> The following doesn't work: 
>>
>> fields = [db.cart.id, db.cart.id.count()]
>>
>>
>> grid = SQLFORM.grid(db.cart,
>> fields=fields,
>> left = [db.cart_content.on(db.cart.id==db.
>> cart_content.cart)],
>> groupby=db.cart.id)
>>
>> what's the best way to accomplish this? 
>> I simply wan to count how many items in each cart. 
>> logically db.car.id.count() should really work here, but it doesn't.
>>
>> greatly appreciate any suggestions on how to do this properly. 
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/b49bb71f-2cfc-48eb-b1a4-84d8e828b1beo%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/b49bb71f-2cfc-48eb-b1a4-84d8e828b1beo%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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/54056b45-5348-4315-a89c-a4fa8adaaeaeo%40googlegroups.com.


[web2py] count() as a field in sqlform.grid

2020-07-14 Thread Vlad
The following doesn't work: 

fields = [db.cart.id, db.cart.id.count()]


grid = SQLFORM.grid(db.cart,
fields=fields,
left = [db.cart_content.on(db.cart.id==db.
cart_content.cart)],
groupby=db.cart.id)

what's the best way to accomplish this? 
I simply wan to count how many items in each cart. 
logically db.car.id.count() should really work here, but it doesn't.

greatly appreciate any suggestions on how to do this properly. 

-- 
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/b49bb71f-2cfc-48eb-b1a4-84d8e828b1beo%40googlegroups.com.


Re: [web2py] Re: I broke something

2020-05-24 Thread Vlad
I am having the exact same problem, removing session data did not help.

2.20.4-stable+timestamp.2020.05.03.05.18.50
(Running on Rocket 1.2.6, Python 3.7.2)

I downloaded the latest web2py source, the app I am running was originally 
in python2.7, however.

Are there any alternatives other than going back to the old python version?

On Tuesday, June 18, 2019 at 11:37:34 AM UTC-5, Massimiliano wrote:
>
> The error seems to be in:
>
> session_data = pickle.loads(row['session_data'])
>
> try to delete session files or data
>
> On Tue, Jun 18, 2019 at 10:11 AM Константин Комков  > wrote:
>
>> Also I see that error:
>> Ticket ID
>>
>> 10.250.10.160.2019-06-18.11-10-10.65f5c525-97e7-4cf4-985b-eea6fd89e420
>> Версия
>> web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
>> Python Python 3.7.3: C:\Python\python.exe (prefix: C:\Python)Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>>
>> Traceback (most recent call last):
>>   File ".\gluon\main.py", line 444, in wsgibase
>> serve_controller(request, response, session)
>>   File ".\gluon\main.py", line 179, in serve_controller
>> page = run_controller_in(request.controller, request.function, 
>> environment)
>>   File ".\gluon\compileapp.py", line 657, in run_controller_in
>> ccode = getcfs(layer, filename, lambda: compile2(code, filename))
>>   File ".\gluon\cfs.py", line 50, in getcfs
>> data = filter()
>>   File ".\gluon\compileapp.py", line 657, in 
>> ccode = getcfs(layer, filename, lambda: compile2(code, filename))
>>   File ".\gluon\restricted.py", line 205, in compile2
>> return compile(code, layer, 'exec')
>>   File "C:\inetpub\wwwroot\applications\stud\controllers/appadmin.py", line 
>> 270
>> except Exception, e:
>> ^
>> SyntaxError: invalid syntax
>>
>> Error snapshot [image: help] 
>> 
>>
>> SyntaxError(invalid syntax (controllers/appadmin.py, line 270))
>>
>> inspect attributes
>> Frames
>>
>>- 
>>
>>*File C:\inetpub\wwwroot\gluon\main.py in wsgibase at line 444* код 
>>аргументы переменные
>>- 
>>
>>*File C:\inetpub\wwwroot\gluon\main.py in serve_controller at line 
>>179* код аргументы переменные
>>- 
>>
>>*File C:\inetpub\wwwroot\gluon\compileapp.py in run_controller_in at 
>>line 657* код аргументы переменные
>>- 
>>
>>*File C:\inetpub\wwwroot\gluon\cfs.py in getcfs at line 50* код 
>>аргументы переменные
>>- 
>>
>>*File C:\inetpub\wwwroot\gluon\compileapp.py in  at line 657* 
>>код аргументы переменные
>>- 
>>
>>*File C:\inetpub\wwwroot\gluon\restricted.py in compile2 at line 205* 
>>код аргументы переменные
>>Function argument list
>>
>>(code='# -*- coding: utf-8 -*-\n\n# #...n 
>>ul_main\n\nresponse._vars=response._caller(hooks)', 
>>layer=r'C:\inetpub\wwwroot\applications\stud\controllers/appadmin.py')
>>Code listing
>>
>>200.
>>201.
>>202.
>>203.
>>204.
>>205.
>>206.
>>207.
>>208.
>>209.
>>
>>output = ""
>>return output
>>
>>
>>def compile2(code, layer):
>>return compile(code, layer, 'exec')
>>
>>
>>def restricted(ccode, environment=None, layer='Unknown', scode=None):
>>"""
>>
>>Variables
>>builtincompile 
>>code '# -*- coding: utf-8 -*-\n\n# #...n 
>>ul_main\n\nresponse._vars=response._caller(hooks)'
>>layer r'C:\inetpub\wwwroot\applications\stud\controllers/appadmin.py'
>>
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/b5139753-1f20-4252-ba1b-078a5fac2095%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Massimiliano
>

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

[web2py] customizing grid (color)

2020-04-27 Thread Vlad
Is there a way to customize colors in the w2p grid similar to bootstrap 
idea, for example something like .table_dark in bootstrap? 

I tried this: 


> .w2p_odd {
>background-color: brown;
>color:white;
> }
> .w2p_even {
>background-color: black;
>color:white;
> }
> 


and it gives weird results. wondering what's the most appropriate way there 
is for this kind of customization. 

-- 
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/13b058c9-5d55-44cb-a01c-20d3dc704888%40googlegroups.com.


Re: [web2py] Re: grid reloading the page on grid actions (and keeping the page's arguments)

2020-04-24 Thread Eliezer (Vlad) Tseytkin
I see. Thank you.

I also did some Googling and found what I think should be documented more
explicitly and perhaps more clearly in web2py docs (it's there, but unless
you know what to look for, you're guaranteed to miss it):

when creating grid, the following
   args=request.args[:1]
tells the grid to keep the arguments in place and reload on top of existing
one(s) - this seems to be a perfect solution by design!

On Fri, Apr 24, 2020 at 1:18 PM Jim S  wrote:

> So, you have to manage that yourself.
>
> I do it kind of like this.  Yes, I know it's ugly but it pretty much works.
>
> #  if the variable is passed in, get the value
> search_text = request.get_vars.search_text
>
> if request.wsgi.environ['QUERY_STRING'] != '':
> #  we get here if no vars were passed on the request - in
> #  this case, I want to see if I've saved a copy of them to session
> #  and if so, grab them and use them
> if not search_text:
> try:
> search_text = session['search_values']['search_text']
> except:
> search_text = ''
>
> #  now I use search text to build the query I'm going to pass to
> SQLFORM.grid
>
> #  store the current value of the variables back to your session
> session.search_values = dict(search_text=search_text)
>
> Not pretty, but it works for my use case.
>
> -Jim
>
>
>
>
> On Friday, April 24, 2020 at 11:58:23 AM UTC-5, Vlad wrote:
>>
>> Yes, there are arguments on the page already. I don't want the grid to
>> get rid of them when reloading for those actions.
>>
>> On Fri, Apr 24, 2020, 12:39 PM Jim S  wrote:
>>
>>> I thought it did keep track of paging.
>>>
>>> Are you looking for it to keep arguments that you supplied?
>>>
>>> -Jim
>>>
>>> On Friday, April 24, 2020 at 11:33:47 AM UTC-5, Vlad wrote:
>>>>
>>>> I've got a page with a grid on it.
>>>> grid reloads the page on create and other actions.
>>>> the page to begin with has arguments, for example, page/1/2/3.
>>>> I want the grid to keep these 1/2/3 in place when reloading the page on
>>>> those actions, for example, on new record it should use page/1/2/3/new
>>>> instead of page/new.
>>>> How do I achieve it? There must be a parameter that enables grid to
>>>> keep the args, but I can't find it -
>>>>
>>> --
>>> 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/llt-aRxLeBo/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/6638c197-7342-4e11-8b86-8b4606f1847a%40googlegroups.com
>>> <https://groups.google.com/d/msgid/web2py/6638c197-7342-4e11-8b86-8b4606f1847a%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
> 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/llt-aRxLeBo/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/3f80cee5-4f2d-44f5-95bb-458bcfd52c93%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/3f80cee5-4f2d-44f5-95bb-458bcfd52c93%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCDBsFgvHP1w-1-N8-hUx7MLS7B4hRJwP-gxkEzjr0qtag%40mail.gmail.com.


Re: [web2py] Re: grid reloading the page on grid actions (and keeping the page's arguments)

2020-04-24 Thread Eliezer (Vlad) Tseytkin
Yes, there are arguments on the page already. I don't want the grid to get
rid of them when reloading for those actions.

On Fri, Apr 24, 2020, 12:39 PM Jim S  wrote:

> I thought it did keep track of paging.
>
> Are you looking for it to keep arguments that you supplied?
>
> -Jim
>
> On Friday, April 24, 2020 at 11:33:47 AM UTC-5, Vlad wrote:
>>
>> I've got a page with a grid on it.
>> grid reloads the page on create and other actions.
>> the page to begin with has arguments, for example, page/1/2/3.
>> I want the grid to keep these 1/2/3 in place when reloading the page on
>> those actions, for example, on new record it should use page/1/2/3/new
>> instead of page/new.
>> How do I achieve it? There must be a parameter that enables grid to keep
>> the args, but I can't find it -
>>
> --
> 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/llt-aRxLeBo/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/6638c197-7342-4e11-8b86-8b4606f1847a%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/6638c197-7342-4e11-8b86-8b4606f1847a%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCAh%3DOjAOxzhhKmrqtcwu0P5jwwLFJNKSgYZChVWKT4W2A%40mail.gmail.com.


[web2py] grid reloading the page on grid actions (and keeping the page's arguments)

2020-04-24 Thread Vlad
I've got a page with a grid on it. 
grid reloads the page on create and other actions. 
the page to begin with has arguments, for example, page/1/2/3. 
I want the grid to keep these 1/2/3 in place when reloading the page on 
those actions, for example, on new record it should use page/1/2/3/new 
instead of page/new. 
How do I achieve it? There must be a parameter that enables grid to keep 
the args, but I can't find it - 

-- 
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/e6726180-a420-4aa0-a2e8-2ce01ddbf91b%40googlegroups.com.


Re: [web2py] Re: reg expression use in web2py/dal?

2020-03-31 Thread Eliezer (Vlad) Tseytkin
I mean, I understand how to use regexp for a simple pattern matching, but
here I need to use the "sub" feature. What am I missing?

On Tue, Mar 31, 2020, 6:38 AM Eliezer (Vlad) Tseytkin <
westgate6...@gmail.com> wrote:

> Is there any example / doc on how to use regexp? It's just mentioned in
> the book, but no details and no samples.
>
> On Tue, Mar 31, 2020, 3:35 AM Val K  wrote:
>
>> re.sub() is  invoked at python level not at db level. You should use
>> db.field.regexp(pattern)
>>
>> --
>> 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/gZfpGe7EcSI/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/9479f17a-0eae-449f-9d6c-b2b8bd974a3f%40googlegroups.com
>> .
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCDZ0UPwwWSf3uL1vYFegEfp6OLuyRtznQu7SiYs1BVy0w%40mail.gmail.com.


Re: [web2py] Re: reg expression use in web2py/dal?

2020-03-31 Thread Eliezer (Vlad) Tseytkin
Is there any example / doc on how to use regexp? It's just mentioned in the
book, but no details and no samples.

On Tue, Mar 31, 2020, 3:35 AM Val K  wrote:

> re.sub() is  invoked at python level not at db level. You should use
> db.field.regexp(pattern)
>
> --
> 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/gZfpGe7EcSI/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/9479f17a-0eae-449f-9d6c-b2b8bd974a3f%40googlegroups.com
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCAwvgTKWPXVsA2N3NicHVRGf%3D-afqRpgyNVaWEbYop_sw%40mail.gmail.com.


[web2py] Re: reg expression use in web2py/dal?

2020-03-30 Thread Vlad
Can't figure it out. Basically, I am looking for a correct way to do 
something like this (which is obviously incorrect, but at least expressive 
enough to show what's missing): 

left=db.auth_user.on(db.sms.sender==re.sub('[^0-9]','',db.auth_user.phone))

On Monday, March 30, 2020 at 11:09:07 AM UTC-4, Vlad wrote:
>
> I've got the following condition for the left join: 
>
> left=db.auth_user.on(db.sms.sender==db.auth_user.phone)
>
> the problem is that sms.sender is in a format like 12345678901 while 
> auth_user.phone can be something like (234)567-8901. Doesn't have to be in 
> any specific format, but I need to remove any non-digit characters and if 
> it's 10 digits - to add 1. Only then the 2 strings are comparable. 
>
> How is it possible to do it in web2py / dal?  
>

-- 
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/2d246d5e-0648-4016-8916-bca52ffaa150%40googlegroups.com.


[web2py] reg expression use in web2py/dal?

2020-03-30 Thread Vlad
I've got the following condition for the left join: 

left=db.auth_user.on(db.sms.sender==db.auth_user.phone)

the problem is that sms.sender is in a format like 12345678901 while 
auth_user.phone can be something like (234)567-8901. Doesn't have to be in 
any specific format, but I need to remove any non-digit characters and if 
it's 10 digits - to add 1. Only then the 2 strings are comparable. 

How is it possible to do it in web2py / dal?  

-- 
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/5fcc2be0-607a-4b34-9a5c-66896deedb18%40googlegroups.com.


Re: [web2py] Re: Looking for web2py developer for Italian small company

2020-02-12 Thread Vlad
I've used web2py happily until today, but seems need to switch to py4web :)

I've never looked into py4web; just saw msgs going back and forth about it. 

What's the best way to start? Any tutorials? Is there a book similar to the 
one on web2py? What's the home page (assuming it's separate from web2py 
itself)? 


On Monday, February 10, 2020 at 11:13:56 AM UTC-5, Massimo Di Pierro wrote:
>
> Hello Victor,
>
> I recommend everybody to move from web2py to py4web. I am using the latter 
> for my own projects and find it better.
> Honestly web2py has more features and it has been battle-tested but py4web 
> is catching up quickly and, if you do not need the grid, I think it is 
> already better.
>
> Massimo
>
>
>
> On Sunday, 9 February 2020 21:58:26 UTC-8, VJ Sosa wrote:
>>
>> Dear Massimo,
>>
>> One month ago I just started to develop some demos of a web application 
>> using web2py. I'm interested in go further with a more serious 
>> implementation,
>> but today I'm realizing that this group is also talking about py4web.
>> Considering that py4web is your new bet for a python framework, do you 
>> recommend me to go further with py4web instead of web2py?
>> Will be web2py deprecated in a close future?
>> Are you planning offer similar documentation (like a book) for py4web?
>>
>> Thanks in advance, I do appreciate your work.
>> Víctor.
>>
>> El jueves, 30 de enero de 2020, 7:10:45 (UTC+1), Massimo Di Pierro 
>> escribió:
>>>
>>> Yes. for me it is the future. It is usable. I recently tried to port 
>>> some of my apps from web2py to py4wb and f they do not use grid, the 
>>> transition is almost trivial. The code ends up cleaner and you can use 
>>> pylint and other tools to find errors. Converting complex Auth logic can be 
>>> tricky. 
>>>
>>> On Wednesday, 22 January 2020 08:12:04 UTC-8, Hugo Alberto Rivera Diaz 
>>> wrote:

 Massimo,an honor to salute you! One question so you would recommend the 
 use of py4web over web2py? Is py4web te next step for web2py developers?

 El mié., 22 ene. 2020 a las 0:23, Massimo Di Pierro (<
 massimo...@gmail.com>) escribió:

> I strongly recommend py4web + vue.js :-)
>
> On Tuesday, 21 January 2020 07:40:18 UTC-8, Ivan Gazzola wrote:
>
>> We are a small company in Italy, we need a new developer for our 
>> project (xortho.it)
>>
>> The web app is developed with jquery mobile and web2py, we are 
>> planning to move to angular and web2py or better py4web.
>>  
>> If you're interested please contact us.
>>
>> Ciao
>>
>> Ivan
>>
>> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to the Google 
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to web...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/web2py/fc6ea910-acbb-45b7-9553-2e33152d2863%40googlegroups.com
>  
> 
> .
>


 -- 
   * Saludos!*
*Hugo Alberto Rivera Diaz* 


>>>

-- 
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/46d74f88-d9ad-475a-b264-7f682fefdbe3%40googlegroups.com.


[web2py] confirm on form submit

2019-12-03 Thread Vlad
The view has the following link: 

{{=A('Refunded', callback=URL('refund', target='REFUND')}}
> 


The function 'refund' returns the form, and the idea is that this form can 
change from the initial form to a confirmation form: 

def refund():
>
> form=FORM('Refund:',
>   INPUT(_name='amount', requires=IS_NOT_EMPTY()),
>   INPUT(_type='submit'),
>   _name='form_one')
> if form.accepts(request, session, formname='form_one'):
>form2 = FORM.confirm('Are you sure to refund $%s?' % 
> (form.vars.amount))
>if form2.accepted:
>   return '%s refunded' % (form.vars.amount)
>return form2
>
> return form


On form submit form2 opens up, but on submit form2 the initial form is back 
(instead of displaying '%s refunded' ). 

What would be the way to implement the intended functionality correctly? 

I simply need to display form first, and on submit display 
form2-confirmation, and on form2 submit to do some operation and display 
the result. 


-- 
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/6895f84c-43ca-4452-9a79-faa3c17f2837%40googlegroups.com.


[web2py] Pydal validate issue 2.15.4

2019-10-30 Thread Vlad Doster
Hi all,

I am currently trying to get a dev environment up and running. I try to 
login and the pydal/object.py 
complains about __call__() taking 3 arguments but expecting exactly 2.

Is this a web2py issue or Python versioning issue?

Traceback (most recent call last):
  File "/home/vlad/V_ENVS/ims/web2py/gluon/restricted.py", line 219, in 
restricted
exec(ccode, environment)
  File "/home/vlad/V_ENVS/ims/web2py/applications/ims/controllers/default.py" 
<http://127.0.0.1:8000/admin/default/edit/ims/controllers/default.py>, line 
1210, in 
  File "/home/vlad/V_ENVS/ims/web2py/gluon/globals.py", line 414, in 
self._caller = lambda f: f()
  File "/home/vlad/V_ENVS/ims/web2py/applications/ims/controllers/default.py" 
<http://127.0.0.1:8000/admin/default/edit/ims/controllers/default.py>, line 
920, in user
user = auth.login_bare(email, password)
  File "/home/vlad/V_ENVS/ims/web2py/gluon/tools.py", line 2400, in login_bare
    settings.passfield].validate(password)[0]
  File "/home/vlad/V_ENVS/ims/web2py/gluon/packages/dal/pydal/objects.py", line 
2006, in validate
(value, error) = validator(value, record_id)
TypeError: __call__() takes exactly 2 arguments (3 given)


Any ideas? We are using Python2.7.

-- 
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/0b4ffbc7-026e-4157-ae31-b7e99525594a%40googlegroups.com.


[web2py] Re: auth_membership grid with both, group id and group roles displayed when adding a new record

2019-10-07 Thread Vlad
I don't fully understand it - will play with it to figure it out. 
Annet's suggestion worked right away, but still I really want to understand 
what's going on...
thank you!  

On Monday, October 7, 2019 at 6:38:24 AM UTC-4, villas wrote:
>
> By specifying requires = IS_IN_SET(ids), you are also overriding the 
> represent 
> too.
>
> See below, I hope it will point you in the right direction:
>
> mygroupdict = {1:'Public',2:'Private',3:'Admin'}
> db.auth_membership.group_id.requires = IS_IN_SET(mygroupdict,zero=None))
> db.auth_membership.group_id.represent = lambda group_id, row: mygroupdict[
> group_id]
>
>

-- 
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/678ca1e7-d349-4d10-bcb7-a6414746ab91%40googlegroups.com.


[web2py] Re: auth_membership grid with both, group id and group roles displayed when adding a new record

2019-10-07 Thread Vlad
thank you very much! 
works like a charm! 

On Monday, October 7, 2019 at 6:36:02 AM UTC-4, Annet wrote:
>
> Use IS_IN_DB()
>
>ids = [1,3,5]
>>
>
>
> db.auth_membership.group_id.requires = 
> IS_IN_DB(db(db.auth_group.id.belongs(ids)), 'auth_group.id', '%(role)s')
>
>
> Best,
>
> Annet
>

-- 
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/92ac0728-e22d-4411-b13d-520909dc37d1%40googlegroups.com.


[web2py] auth_membership grid with both, group id and group roles displayed when adding a new record

2019-10-07 Thread Vlad
the following line works perfectly: 

grid = SQLFORM.grid(db.auth_membership)

by "perfect" in the context, I mean that when I click "add record", the 
group id field contains both values, group id and group role (for example, 
"Manager (4)", "Loyal customer (9)", ... 

However, I want to limit what kind of membership a user can create, so here 
is what I do: 

   ids = [1,3,5]
   db.auth_membership.group_id.requires = IS_IN_SET(ids)
   grid = SQLFORM.grid(db.auth_membership)

This indeed limits group id field value that a user can specify when 
creating a new record. When clicking "Add record", the group id field is 
represented by a drop-down with the values "1, 3, 5", as expected. 

The problem is that now when limited to 1, 3, and 5, no roles are 
displayed. Only group id integer values are (to reiterate, without this 
limitation to 1,3,5 the drop-down contains both, group id and group role 
for each line, for all the groups). 

How can I ensure that the roles are also displayed, in addition to group 
ids, on add record, when using  requires=IS_IN_SET ? 

-- 
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/bbc19ca8-7701-43c3-a14d-2ac36639dbfe%40googlegroups.com.


Re: [web2py] Re: customizing menu items when MENU helper is used

2019-07-31 Thread Eliezer (Vlad) Tseytkin
It's not really about a menu as a whole (that would be easy). It's about
dynamically changing the background color for each menu item individually.
In this context I can't pass neither style nor class (in contrast with, for
example a list helper where elements/options are made up of another helper
and take class, style, and are fully configurable one at a time)...

On Wed, Jul 31, 2019, 2:48 AM Dave S  wrote:

>
>
> On Tuesday, July 30, 2019 at 3:09:24 PM UTC-7, Vlad wrote:
>>
>> what would be the best way to specify a background color (different for
>> each menu item, depending on some database-driven data) when I build the
>> menu with menu.append(...) in menu.py?
>>
>> I would love to have something like this:
>>
>> menu.append([description, False,
>> URL('catalog','regimen',args=[id]),[]],_style='background-color:red;')
>>
>> but of course, this doesn't work this way -
>>
>>
>>
> I'd look at using _class instead of _style.  (_class defaults to
> 'web2py-menu web2py-menu-vertical')
>
> /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/AXPsP-HlSLk/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/dcaea736-c629-43c7-924a-b07764ce952a%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/dcaea736-c629-43c7-924a-b07764ce952a%40googlegroups.com?utm_medium=email_source=footer>
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCBRrmGuERouF4w1HgAS%2Bq9tT%2BELCH7jwx%2BaSd%2BG%2Bm7PWA%40mail.gmail.com.


[web2py] customizing menu items when MENU helper is used

2019-07-30 Thread Vlad
what would be the best way to specify a background color (different for 
each menu item, depending on some database-driven data) when I build the 
menu with menu.append(...) in menu.py? 

I would love to have something like this: 

menu.append([description, False, 
URL('catalog','regimen',args=[id]),[]],_style='background-color:red;')

but of course, this doesn't work this way - 


-- 
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/bbc8c801-a94e-4ce2-acb7-c3ba493278a9%40googlegroups.com.


Re: [web2py] Using db.table.format (i.e. format attr outside of table definition)

2019-07-09 Thread Eliezer (Vlad) Tseytkin
Oh, I see, here is what's happening:

I now have the following code:

   db.product._format = lambda row: 'test'
   grid = SQLFORM.grid(db.flavor)

The table flavor has a column referencing the table product.

So, the grid displays the product column correctly now (with _format - this
is where just 'format' doesn't work and '_format" does). However, when I
add a new record to the flavor table (via the grid), I expect the product
column in the insert record form to contain a drop down list of records
from the product table to be represented by the same _format setting -
perhaps I am making a wrong assumption? So this column in adding new record
form ignores the _format.

Is this by design? Isn't the format option supposed to work the same way in
the new record form, as well as in the grid listing all the records?

On Tue, Jul 9, 2019 at 1:17 AM Val K  wrote:

> Show your code, please
>
> --
> 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/pQYWSHh-Pys/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/51b9b514-00da-4873-8bab-879c4cf2cc51%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Using db.table.format (i.e. format attr outside of table definition)

2019-07-08 Thread Eliezer (Vlad) Tseytkin
Nope, still doesn't work...

On Mon, Jul 8, 2019, 1:20 PM Val K  wrote:

> Try db.table._format=...
>
> --
> 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/pQYWSHh-Pys/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/536b2be5-50c9-483b-858f-247df07cba7f%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Using db.table.format (i.e. format attr outside of table definition)

2019-07-07 Thread Vlad
Please help! Any way to use this format property outside of a table definition? 

-- 
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/361da361-d199-4d83-af90-89a8a8524a2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Using db.table.format (i.e. format attr outside of table definition)

2019-07-03 Thread Vlad
Using the following

db.table.format = lambda row: 'test'

before SQLFORM.grid creation doesn't seem to work.

What's the proper way to set record representation outside of table definition? 

-- 
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/4b0f5f9c-ef15-4b21-8c95-c521f4b4a1d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] specifying an id of an ajax component (LOAD)

2019-07-01 Thread Eliezer (Vlad) Tseytkin
Got it,
Works like a charm,
Thank you!

On Mon, Jul 1, 2019, 11:10 AM Massimiliano  wrote:

>
> http://web2py.com/books/default/chapter/29/12/components-and-plugins#LOAD-signature
>
> you need to define *target *not *id*
>
> On Sun, Jun 30, 2019 at 5:12 PM Vlad  wrote:
>
>> I am using the LOAD helper in the view:
>>
>> {{=LOAD(c='customer',f='testimonials',extension='load',ajax=True,ajax_trap=True,content='loading
>> testimonials...',*_id='TESTIMONIALS_HERE'*)}}
>>
>> The id (_id) is specified explicitly.
>>
>> However, it ignores the id parameter and produces the following:
>>
>> loading testimonials...
>>
>> What am I missing?
>>
>> --
>> 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/4a07a293-6296-4aa4-b760-2643d44b13c2%40googlegroups.com
>> <https://groups.google.com/d/msgid/web2py/4a07a293-6296-4aa4-b760-2643d44b13c2%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Massimiliano
>
> --
> 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/N1k4l70un7U/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/CANPTPx%2BDkKVySq4tDmH82dFyRDp7rvgLCF9AvVJZXJ29nbSgTg%40mail.gmail.com
> <https://groups.google.com/d/msgid/web2py/CANPTPx%2BDkKVySq4tDmH82dFyRDp7rvgLCF9AvVJZXJ29nbSgTg%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] specifying an id of an ajax component (LOAD)

2019-06-30 Thread Vlad
I am using the LOAD helper in the view: 

{{=LOAD(c='customer',f='testimonials',extension='load',ajax=True,ajax_trap=True,content='loading
 
testimonials...',*_id='TESTIMONIALS_HERE'*)}}

The id (_id) is specified explicitly. 

However, it ignores the id parameter and produces the following: 

loading testimonials... 

What am I missing? 

-- 
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/4a07a293-6296-4aa4-b760-2643d44b13c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] redirecting domain

2019-06-20 Thread Vlad
what's the most efficient way to redirect domain to another domain entirely 
on a level of web2py?


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


Re: [web2py] Re: form's field having special characters transmitted via request.post_vars

2019-06-20 Thread Eliezer (Vlad) Tseytkin
Oops!
this is brilliant!
Thank you!!

I just had to introduce one extra step due to the way how json dumps
strings:

if string.startswith('"') and string.endswith('"'):
string = string[1:-1]



On Thu, Jun 20, 2019 at 3:09 PM Val K  wrote:

> Enter code here...
>
> Eureka! there is json!
> safe_js_str = json.dumps(string_with_any_bad_char)
>
> now you can insert it in js code as
> 'var s = %s' % safe_js_str # it is already quoted
>
>
>
> On Thursday, June 20, 2019 at 9:54:43 PM UTC+3, Vlad wrote:
>>
>> the problem is that I don't know what they may enter, it could be
>> anything.
>> I just need to feed back whatever they entered in the middle of some js
>> action.
>> the objective is that whatever they enter - any characters - should
>> simply be taken as a string by the browser
>>
>>
>> On Thu, Jun 20, 2019 at 2:52 PM Val K  wrote:
>>
>>> I think there is no universal way because js is just a string in python
>>> context,
>>> you have to escape quotes with backslash (replace " with \") where it is
>>> required to prevent crumbling strings in  js-code
>>> What is the second char? dot?
>>>
>>>
>>> On Thursday, June 20, 2019 at 8:32:08 PM UTC+3, Vlad wrote:
>>>>
>>>> I have a form with an input text field.
>>>>
>>>> The form is submitted via POST.
>>>>
>>>> The vars value is read and passed over into response.js to run some
>>>> action.
>>>>
>>>> All works perfect until that field has special characters, like " and
>>>> the like. Javascript does't like it. It doesn't see that as a string, but
>>>> rather as a part of the js code so it breaks.
>>>>
>>>> How do I encode / convert that field's value so that it wouldn't affect
>>>> html/js on the output?
>>>>
>>> --
>>> 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/fSTMUW9ObVU/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/254be43e-4d76-4b33-ab2b-7434eaad85b8%40googlegroups.com
>>> <https://groups.google.com/d/msgid/web2py/254be43e-4d76-4b33-ab2b-7434eaad85b8%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/fSTMUW9ObVU/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/98cd6c0e-d7c2-4e48-bfa1-5316be115b94%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/98cd6c0e-d7c2-4e48-bfa1-5316be115b94%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: form's field having special characters transmitted via request.post_vars

2019-06-20 Thread Eliezer (Vlad) Tseytkin
the problem is that I don't know what they may enter, it could be anything.
I just need to feed back whatever they entered in the middle of some js
action.
the objective is that whatever they enter - any characters - should simply
be taken as a string by the browser


On Thu, Jun 20, 2019 at 2:52 PM Val K  wrote:

> I think there is no universal way because js is just a string in python
> context,
> you have to escape quotes with backslash (replace " with \") where it is
> required to prevent crumbling strings in  js-code
> What is the second char? dot?
>
>
> On Thursday, June 20, 2019 at 8:32:08 PM UTC+3, Vlad wrote:
>>
>> I have a form with an input text field.
>>
>> The form is submitted via POST.
>>
>> The vars value is read and passed over into response.js to run some
>> action.
>>
>> All works perfect until that field has special characters, like " and the
>> like. Javascript does't like it. It doesn't see that as a string, but
>> rather as a part of the js code so it breaks.
>>
>> How do I encode / convert that field's value so that it wouldn't affect
>> html/js on the output?
>>
> --
> 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/fSTMUW9ObVU/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/254be43e-4d76-4b33-ab2b-7434eaad85b8%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/254be43e-4d76-4b33-ab2b-7434eaad85b8%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: emailing the content of the current page

2019-06-20 Thread Eliezer (Vlad) Tseytkin
this is simply awesome!
thank you !

On Thu, Jun 20, 2019 at 2:07 PM Val K  wrote:

> #pretty decorator
> def with_email_to(addr):
> def inner(f):
> def emailer():
> ret = f()
> html = response.render(ret)
> ... # send html to addr by email
> return html
> return emailer
> return inner
>
> @with_email_to('j...@google.com')
> def foo():
> ...
>
>
>
>
> On Thursday, June 20, 2019 at 8:39:45 PM UTC+3, Val K wrote:
>>
>> I mean the following logic:
>> def foo():
>> ...
>> ret = dict(...)
>> if email_required:
>> html = response.render(ret)
>> ... # send html by email
>> return html
>> return ret
>>
>>
>>
>> On Thursday, June 20, 2019 at 8:26:33 PM UTC+3, Vlad wrote:
>>>
>>> I couldn't figure out how this woks, so just rendered it again. Not a
>>> big deal - just a matter of convenience. The email requests come
>>> occasionally, so this extra render doesn't cause trouble.
>>>
>>> Thank you, Val!
>>>
>>> On Thursday, June 20, 2019 at 6:23:55 AM UTC-4, Val K wrote:
>>>>
>>>> I think you can try to yield rendered view from controller just by
>>>> 'return rendered_response'. If controller returns string (not dict) it will
>>>> be sent as is
>>>>
>>>
>
>
> On Thursday, June 20, 2019 at 8:48:58 PM UTC+3, Vlad wrote:
>>
>> oops
>> got it!
>> changing it right now!
>> simple and brilliant, as always :)
>>
>> On Thu, Jun 20, 2019 at 1:39 PM Val K  wrote:
>>
>>> I mean the following logic:
>>> def foo():
>>> ...
>>> ret = dict(...)
>>> if email_required:
>>> html = response.render(ret)
>>> ... # send html by email
>>> return html
>>> return ret
>>>
>>>
>>>
>>> On Thursday, June 20, 2019 at 8:26:33 PM UTC+3, Vlad wrote:
>>>>
>>>> I couldn't figure out how this woks, so just rendered it again. Not a
>>>> big deal - just a matter of convenience. The email requests come
>>>> occasionally, so this extra render doesn't cause trouble.
>>>>
>>>> Thank you, Val!
>>>>
>>>> On Thursday, June 20, 2019 at 6:23:55 AM UTC-4, Val K wrote:
>>>>>
>>>>> I think you can try to yield rendered view from controller just by
>>>>> 'return rendered_response'. If controller returns string (not dict) it 
>>>>> will
>>>>> be sent as is
>>>>>
>>>> --
>>> 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/kb42uKUVs6E/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/da397328-7304-49f7-a6a6-c9588f54d8ba%40googlegroups.com
>>> <https://groups.google.com/d/msgid/web2py/da397328-7304-49f7-a6a6-c9588f54d8ba%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/kb42uKUVs6E/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/833e8180-b48e-44de-80db-78e91a15a4a5%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/833e8180-b48e-44de-80db-78e91a15a4a5%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCCsS%2BjJU-5si60Dbdc3Bq9LDWZD_xazaJfk-N8-2_A1nw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: emailing the content of the current page

2019-06-20 Thread Eliezer (Vlad) Tseytkin
oops
got it!
changing it right now!
simple and brilliant, as always :)

On Thu, Jun 20, 2019 at 1:39 PM Val K  wrote:

> I mean the following logic:
> def foo():
> ...
> ret = dict(...)
> if email_required:
> html = response.render(ret)
> ... # send html by email
> return html
> return ret
>
>
>
> On Thursday, June 20, 2019 at 8:26:33 PM UTC+3, Vlad wrote:
>>
>> I couldn't figure out how this woks, so just rendered it again. Not a big
>> deal - just a matter of convenience. The email requests come occasionally,
>> so this extra render doesn't cause trouble.
>>
>> Thank you, Val!
>>
>> On Thursday, June 20, 2019 at 6:23:55 AM UTC-4, Val K wrote:
>>>
>>> I think you can try to yield rendered view from controller just by
>>> 'return rendered_response'. If controller returns string (not dict) it will
>>> be sent as is
>>>
>> --
> 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/kb42uKUVs6E/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/da397328-7304-49f7-a6a6-c9588f54d8ba%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/da397328-7304-49f7-a6a6-c9588f54d8ba%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] form's field having special characters transmitted via request.post_vars

2019-06-20 Thread Vlad
I have a form with an input text field. 

The form is submitted via POST. 

The vars value is read and passed over into response.js to run some action. 

All works perfect until that field has special characters, like " and the 
like. Javascript does't like it. It doesn't see that as a string, but 
rather as a part of the js code so it breaks. 

How do I encode / convert that field's value so that it wouldn't affect 
html/js on the output? 

-- 
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/6bba47cd-aa85-4839-9efd-4ebcc3f45597%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: emailing the content of the current page

2019-06-20 Thread Vlad
I couldn't figure out how this woks, so just rendered it again. Not a big 
deal - just a matter of convenience. The email requests come occasionally, 
so this extra render doesn't cause trouble. 

Thank you, Val!

On Thursday, June 20, 2019 at 6:23:55 AM UTC-4, Val K wrote:
>
> I think you can try to yield rendered view from controller just by 'return 
> rendered_response'. If controller returns string (not dict) it will be sent 
> as is
>

-- 
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/f5c3795e-b9fa-45dd-af81-a853248af0d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] emailing the content of the current page

2019-06-19 Thread Vlad
I'd like to send an email with html content - the current page:

mail.send('y...@example.com', 'Message subject', 'html body')

How do I make the html body available in python code? (i.e. how do I pass 
it from the view to the python code?)

to get it in js easy - document.documentElement.outerHTML - but it's a long 
thing, just args and vars presumably won't work. 

what would be the best way to pass it over / to make it available in the 
code in order to send by email? 

p.s. I don't want to render page the again, as it has been already 
rendered; otherwise response.render would be an option... 

-- 
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/6745391f-8699-4042-b36d-065c27aedfa9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: sqlform grid to show a field entirely, without cutting off the text

2019-06-18 Thread Vlad
works like a charm!!

thank you Annet!!!
thank you Anthony!!!



On Tuesday, June 18, 2019 at 3:11:08 PM UTC-4, Annet wrote:
>
> I think Anthony answered this question in this post:
>
> https://groups.google.com/forum/?fromgroups=#!topic/web2py/okMVqyQPKV8
>
> hope he did ;-)
>
>
> Regards,
>
> Annet
>

-- 
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/57a5c65f-f04f-4981-8a1f-f17df593daf7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: orderby=['alias'] - works in sqlite, but not in postgres

2019-06-18 Thread Eliezer (Vlad) Tseytkin
Got it,
Thank you very much

On Tue, Jun 18, 2019, 1:53 PM Anthony  wrote:

> On Tuesday, June 18, 2019 at 11:04:16 AM UTC-4, Vlad wrote:
>>
>> Anthony, it works like a charm, thank you very much!!
>>
>> (Val's solution with also worked great, but it felt awkward to use the
>> whole thing when an alias was created, so emotionally this solution with
>> alias feels better :)
>>
>
> You can always do:
>
> sum = db.cart_sharing.stats.sum()
>
> And then use sum in multiple places.
>
>
>> On a side note, for SQLite orderby=['~shares'] works perfect - it indeed
>> sorts it out properly. Just in case I've verified it again now.
>>
>
> I suppose it works in your case, as you are sorting integers, so the
> bitwise negation yields the expected order. However, it won't work in all
> cases (e.g., sorting strings). It is simply not the appropriate syntax for
> ordering in SQL.
>
>
>> By the way, Val's solution was orderby=[~db.cart_sharing.stats.count()] -
>> with tilda, and it worked even in Postgres. Somehow tilda doesn't work
>> specifically with an alias - but without an alias it's just fine on both
>> dbs.
>>
>
> ~db.cart_sharing.stats.sum() is Python code, not SQL. Here, the ~ is part
> of the DAL syntax, and the DAL translates that to:
>
> SUM("cart_sharing"."stats") DESC
>
> So, Postgres never sees the tilde, only "DESC".
>
> But in any case, orderby=['shares DESC'] works everywhere flawlessly and
>> feels good too, so it's a winner :)
>>
>
> Note in this case, 'shares DESC' is just a string, not Python code. The
> DAL therefore simply passes that string directly to the database as SQL
> code. Also, note there is no reason to put it inside a list.
>
> Anthony
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/87RAPjGI0_k/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/d89ca392-0d5f-4320-81b5-633ca95d51c2%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/d89ca392-0d5f-4320-81b5-633ca95d51c2%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] sqlform grid to show a field entirely, without cutting off the text

2019-06-18 Thread Vlad
Is there an easy way to force the SQLFORM grid to show one specific column 
entirely, without cutting it off, even if the row would have to be extended 
vertically, just whatever it takes to see the full text content? 

-- 
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/d32caca2-7920-4c7a-9fd3-6227f9300067%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: orderby=['alias'] - works in sqlite, but not in postgres

2019-06-18 Thread Vlad
Anthony, it works like a charm, thank you very much!! 

(Val's solution with also worked great, but it felt awkward to use the 
whole thing when an alias was created, so emotionally this solution with 
alias feels better :)

On a side note, for SQLite orderby=['~shares'] works perfect - it indeed 
sorts it out properly. Just in case I've verified it again now. 

By the way, Val's solution was orderby=[~db.cart_sharing.stats.count()] - 
with tilda, and it worked even in Postgres. Somehow tilda doesn't work 
specifically with an alias - but without an alias it's just fine on both 
dbs. 

But in any case, orderby=['shares DESC'] works everywhere flawlessly and 
feels good too, so it's a winner :)

Thank you! 



On Tuesday, June 18, 2019 at 10:41:21 AM UTC-4, Anthony wrote:
>
> In SQLite, the tilde (~) is a unary operator used for bitwise negation. If 
> used as a prefix for an order by column, SQLite will not throw an error (as 
> it is a valid operator), but nor will sort they way you expect. In 
> Postgres, the tilde is not a unary operator but a regular expression 
> operator, so when used in this way, it will throw an error. In any case, in 
> SQL, "DESC" is used to indicate descending order ("ASC" for ascending).
>
> So, you can do:
>
> orderby='shares DESC'
>
> Anthony
>
> On Monday, June 17, 2019 at 11:48:51 PM UTC-4, Vlad wrote:
>>
>> This works perfect in SQLite:
>>
>>rows = db(query).select(db.cart_sharing.created_by.with_alias('sharer'
>> ),
>>db.cart_sharing.stats.count().with_alias(
>> 'carts'),
>>db.cart_sharing.stats.sum().with_alias(
>> 'shares'),
>>groupby=db.cart_sharing.created_by,
>>orderby=['~shares'])
>>
>>
>> 'shares' is alias to sum(), and sqlite understands exactly what's needed 
>> - sorts by the number of shares. 
>>
>> Posgres doesn't like it: 
>>column "shares" does not exist 
>> LINE 1: ...NULL) GROUP BY "cart_sharing"."created_by" ORDER BY ~shares; ^
>>
>> What's the proper DAL syntax for such a thing compatible with Postgres? 
>>
>>
>>

-- 
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/d60f3d51-92ec-4ca7-a7e8-36fed3b1185d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: intercepting login & logout events

2019-06-18 Thread Eliezer (Vlad) Tseytkin
This is perfect,
I missed it,
Thank you!!

On Tue, Jun 18, 2019, 2:25 AM 'Annet' via web2py-users <
web2py@googlegroups.com> wrote:

> Web2py has auth.settings I used them to solve your problem
>
>
> auth.settings.login_onaccept = lambda form: __on_login()
> auth.settings.logout_onlogout = lambda user: __on_logout()
>
> and then in the functions the task you want to perform, in my case
> some set up things and messages, something like:
>
>
> def __on_login():
> # set up code
>
> # messages
> if auth.user.first_name:
> name = auth.user.first_name + ' '
> elif auth.user.title:
> name = auth.user.title + ' '
> if auth.user.familyNamePreposition:
> name += auth.user.familyNamePreposition + ' '
> name += auth.user.last_name
>
> session.messages_logged_out = 'You have successfully logged out,
> goodbye %s' %(name)
> session.flash =  'You have successfully logged in, welcome %s' %(name)
>
> return None
>
>
> def __on_logout():
> if session.forced_logout:
> auth.messages.logged_out = session.forced_logged_out_message
> else:
> auth.messages.logged_out = session.messages_logged_out
>
> return None
>
>
> Kind regards,
>
> Annet
>
> --
> 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/sai3zh46gvQ/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/4cb15666-ee77-41c9-b769-70324770b90e%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCBYcPBgqYfq6R1M%2BipOB8%2BF8pJo4E3FJO%3Dh%2B%2B8cyF9uHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] orderby=['alias'] - works in sqlite, but not in postgres

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

On Tue, Jun 18, 2019, 1:19 AM Val K  wrote:

> Try [~db.cart_sharing.stats.sum()]
>
> --
> 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/87RAPjGI0_k/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/026bdb99-f659-4d35-849c-3df119671f9e%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCDdah1JRM%3D-3F0AmGaZ_7LHR7Q7Xx5Ujywp%2BsUHPZogMw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] orderby=['alias'] - works in sqlite, but not in postgres

2019-06-17 Thread Vlad
This works perfect in SQLite:

   rows = db(query).select(db.cart_sharing.created_by.with_alias('sharer'),
   db.cart_sharing.stats.count().with_alias('carts'
),
   db.cart_sharing.stats.sum().with_alias('shares'),
   groupby=db.cart_sharing.created_by,
   orderby=['~shares'])


'shares' is alias to sum(), and sqlite understands exactly what's needed - 
sorts by the number of shares. 

Posgres doesn't like it: 
   column "shares" does not exist 
LINE 1: ...NULL) GROUP BY "cart_sharing"."created_by" ORDER BY ~shares; ^

What's the proper DAL syntax for such a thing compatible with Postgres? 


-- 
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/c3bfb0ea-6c29-48d8-85a3-3e4e21242b9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] intercepting login & logout events

2019-06-17 Thread Vlad
thank you ! 

On Monday, June 17, 2019 at 11:02:13 AM UTC-4, Yoel Benitez Fonseca wrote:
>
> Vlad, in the book:
>
>
> http://www.web2py.com/books/default/chapter/29/04/the-core#HTTP-and-redirect
>
> And i can comment out +/- the code:
>
> def user():
>
> # just a way to ensure form allways have a value
> form = CAT()
> 
> try:
>
> # the call to auth can return a lot of things
>
> # it can be a form (a login form for example or a registration form)
>
> # it can raise a redirect - for exple if the login is correct
>
> # it can be the login form with erros if the password is incorrect
>
> # etc
> form = auth()
> except HTTP as e:
> if e.status == 303'login' in request.args:
> if ('login' in request.args) and auth.user:
> # probably a success, the user has logged in
> do_your_loging_event_here() 
>
> # ensuere u do the redirect, for example a raise shoul do it
> elif 'logout' if request.args:
> do_your_logout_event_here()
> 
> # give the form to the view, can be register form, login form, etc
> return dict(form=form)
>
>
>
> El lun., 17 jun. 2019 a las 10:31, Vlad ( >) escribió:
>
>> Yoel, where could I look up how this works about the exception 303? 
>> Because I don't understand that part at all - I am not aware of exception 
>> being raised, why, and how it works in the flow - could you please point me 
>> to the direction where it's explained? 
>>
>> On Monday, June 17, 2019 at 10:16:58 AM UTC-4, Yoel Benitez Fonseca wrote:
>>>
>>> no, it is not.
>>>
>>> The first time the default/user is called - in the login process for 
>>> example - there not a HTTP(303) (redirect) exception, and the user get the 
>>> form.
>>> The second time, in this scenery, the call to auth() will cause a 
>>> redirect (HTTP exception) and the user is effectively logged into the 
>>> system.
>>>
>>> The same goes for the logout, but there is not a form in the middle.
>>>
>>> El lun., 17 jun. 2019 a las 9:57, Vlad () escribió:
>>>
>>>> but isn't such a scenario catching a user in a process of logging in or 
>>>> logging out, but before actual login/logout?
>>>>
>>>> On Monday, June 17, 2019 at 9:44:10 AM UTC-4, Yoel Benitez Fonseca 
>>>> wrote:
>>>>>
>>>>> I think you can do it in the default/user function. Having in account 
>>>>> that the call to auth() probably raises a HTTP exceptiong in case of a 
>>>>> success. This example is only a proof of concept:
>>>>>
>>>>> def user():
>>>>> form = CAT()
>>>>> 
>>>>> try:
>>>>> form = auth()
>>>>> except HTTP as e:
>>>>> if e.status == 303'login' in request.args:
>>>>> if ('login' in request.args) and auth.user:
>>>>> # probably a success, u can test if auth.user is o not 
>>>>> None
>>>>> do_your_loging_event_here() 
>>>>> elif 'logout' if request.args:
>>>>> do_your_logout_event_here()
>>>>> 
>>>>> return dict(form=form)
>>>>>
>>>>>
>>>>>
>>>>> El lun., 17 jun. 2019 a las 9:19, Vlad () 
>>>>> escribió:
>>>>>
>>>>>> What would be the simplest way to intercept login and logout? 
>>>>>> (i.e. I'd like to perform some additional tasks when a user is logged 
>>>>>> in, and when a user is logged out.)
>>>>>> web2py elegantly hides the functionality in default.user under 
>>>>>> form=auth() and {{=form}} and somehow I can't think of a simple way to 
>>>>>> be 
>>>>>> notified about successful login and logout actions... 
>>>>>>
>>>>>> -- 
>>>>>> Resources:
>>>>>> - http://web2py.com
>>>>>> - http://web2py.com/book (Documentation)
>>>>>> - http://github.com/web2py/web2py (Source code)
>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>>>> --- 
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "web2py-users&quo

Re: [web2py] intercepting login & logout events

2019-06-17 Thread Vlad
Yoel, where could I look up how this works about the exception 303? Because 
I don't understand that part at all - I am not aware of exception being 
raised, why, and how it works in the flow - could you please point me to 
the direction where it's explained? 

On Monday, June 17, 2019 at 10:16:58 AM UTC-4, Yoel Benitez Fonseca wrote:
>
> no, it is not.
>
> The first time the default/user is called - in the login process for 
> example - there not a HTTP(303) (redirect) exception, and the user get the 
> form.
> The second time, in this scenery, the call to auth() will cause a redirect 
> (HTTP exception) and the user is effectively logged into the system.
>
> The same goes for the logout, but there is not a form in the middle.
>
> El lun., 17 jun. 2019 a las 9:57, Vlad (>) 
> escribió:
>
>> but isn't such a scenario catching a user in a process of logging in or 
>> logging out, but before actual login/logout?
>>
>> On Monday, June 17, 2019 at 9:44:10 AM UTC-4, Yoel Benitez Fonseca wrote:
>>>
>>> I think you can do it in the default/user function. Having in account 
>>> that the call to auth() probably raises a HTTP exceptiong in case of a 
>>> success. This example is only a proof of concept:
>>>
>>> def user():
>>> form = CAT()
>>> 
>>> try:
>>> form = auth()
>>> except HTTP as e:
>>> if e.status == 303'login' in request.args:
>>> if ('login' in request.args) and auth.user:
>>> # probably a success, u can test if auth.user is o not None
>>> do_your_loging_event_here() 
>>> elif 'logout' if request.args:
>>> do_your_logout_event_here()
>>> 
>>> return dict(form=form)
>>>
>>>
>>>
>>> El lun., 17 jun. 2019 a las 9:19, Vlad () escribió:
>>>
>>>> What would be the simplest way to intercept login and logout? 
>>>> (i.e. I'd like to perform some additional tasks when a user is logged 
>>>> in, and when a user is logged out.)
>>>> web2py elegantly hides the functionality in default.user under 
>>>> form=auth() and {{=form}} and somehow I can't think of a simple way to be 
>>>> notified about successful login and logout actions... 
>>>>
>>>> -- 
>>>> Resources:
>>>> - http://web2py.com
>>>> - http://web2py.com/book (Documentation)
>>>> - http://github.com/web2py/web2py (Source code)
>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "web2py-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to web...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/web2py/b9dbb7bb-4500-48b2-82fd-cd8ea644f1fe%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/web2py/b9dbb7bb-4500-48b2-82fd-cd8ea644f1fe%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>> -- 
>>> Msc. Yoel Benítez Fonseca
>>>
>>>
>>>
>>>
>>>
>>>
>>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/ee8abe78-346c-44dd-b8a6-e9b243e4eb90%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/ee8abe78-346c-44dd-b8a6-e9b243e4eb90%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Msc. Yoel Benítez Fonseca
>
>
>
>
>
>
>

-- 
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/237c7ee1-72d9-4f3b-a3f5-f09fd34459ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] intercepting login & logout events

2019-06-17 Thread Vlad
but isn't such a scenario catching a user in a process of logging in or 
logging out, but before actual login/logout?

On Monday, June 17, 2019 at 9:44:10 AM UTC-4, Yoel Benitez Fonseca wrote:
>
> I think you can do it in the default/user function. Having in account that 
> the call to auth() probably raises a HTTP exceptiong in case of a success. 
> This example is only a proof of concept:
>
> def user():
> form = CAT()
> 
> try:
> form = auth()
> except HTTP as e:
> if e.status == 303'login' in request.args:
> if ('login' in request.args) and auth.user:
> # probably a success, u can test if auth.user is o not None
> do_your_loging_event_here() 
> elif 'logout' if request.args:
> do_your_logout_event_here()
> 
> return dict(form=form)
>
>
>
> El lun., 17 jun. 2019 a las 9:19, Vlad (>) 
> escribió:
>
>> What would be the simplest way to intercept login and logout? 
>> (i.e. I'd like to perform some additional tasks when a user is logged in, 
>> and when a user is logged out.)
>> web2py elegantly hides the functionality in default.user under 
>> form=auth() and {{=form}} and somehow I can't think of a simple way to be 
>> notified about successful login and logout actions... 
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/b9dbb7bb-4500-48b2-82fd-cd8ea644f1fe%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/b9dbb7bb-4500-48b2-82fd-cd8ea644f1fe%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Msc. Yoel Benítez Fonseca
>
>
>
>
>
>
>

-- 
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/ee8abe78-346c-44dd-b8a6-e9b243e4eb90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] intercepting login & logout events

2019-06-17 Thread Vlad
What would be the simplest way to intercept login and logout? 
(i.e. I'd like to perform some additional tasks when a user is logged in, 
and when a user is logged out.)
web2py elegantly hides the functionality in default.user under form=auth() 
and {{=form}} and somehow I can't think of a simple way to be notified 
about successful login and logout actions... 

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


Re: [web2py] switching to postgres [RuntimeError: No driver of supported ones ('psycopg2',) is available]

2019-06-16 Thread Vlad
Yes, it was a typo. There were quite a few things that went wrong and I missed 
this one even after looking at it dozens of times, checking each character... 

It's perfect now.

Thank you very much

-- 
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/47f795e0-0768-429a-89b3-f7941f33fa72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: please help: sycopg2.OperationalError: FATAL: password authentication failed for user "test"

2019-06-16 Thread Vlad
here is the full traceback, just in case:

Version
web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.

Traceback (most recent call last):
  File "/home/vladtseytkin/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/home/vladtseytkin/web2py/applications/test/controllers/default.py" 
<https://www.ladore.me/admin/edit/test/controllers/default.py>, line 72, in 

  File "/home/vladtseytkin/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/home/vladtseytkin/web2py/applications/test/controllers/default.py" 
<https://www.ladore.me/admin/edit/test/controllers/default.py>, line 19, in 
index
check_reserved=['all'])
  File "/home/vladtseytkin/web2py/gluon/packages/dal/pydal/base.py", line 171, 
in __call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "/home/vladtseytkin/web2py/gluon/packages/dal/pydal/base.py", line 477, 
in __init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "/home/vladtseytkin/web2py/gluon/packages/dal/pydal/base.py", line 457, 
in __init__
self._adapter = adapter(**kwargs)
  File 
"/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
27, in __call__
return AdapterMeta.__call__(cls, *args, **kwargs)
  File 
"/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 
39, in __call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File 
"/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
54, in __init__
driver_args, adapter_args, do_connect, after_connection)
  File "/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 369, in __init__
super(SQLAdapter, self).__init__(*args, **kwargs)
  File "/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 53, in __init__
self.reconnect()
  File "/home/vladtseytkin/web2py/gluon/packages/dal/pydal/helpers/classes.py", 
line 181, in _reconnect_and_configure
self._connection_reconnect()
  File "/home/vladtseytkin/web2py/gluon/packages/dal/pydal/connection.py", line 
174, in reconnect
self.connection = self.connector()
  File 
"/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
118, in connector
return self.driver.connect(**self.driver_args)
  File 
"/home/vladtseytkin/.local/lib/python3.7/site-packages/psycopg2/__init__.py", 
line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL:  password authentication failed for user 
"test"


On Sunday, June 16, 2019 at 5:47:57 PM UTC-4, Vlad wrote:
>
> I'm bringing this from another post, because I've narrowed down the 
> problem considerably, and it no longer corresponds neither to the headline 
> nor to the content of that post. 
>
> the following works fine, creating a valid connection:
>
> connection = psycopg2.connect(database="test_db", user="test", 
> password="xx", host="-994.postgres.pythonanywhere-services.com", 
> port=10994)
>
> the following fails: 
>
> db = DAL("postgres://test:xx?!@
> -994.postgres.pythonanywhere-services.com:10994/test_db",
>  pool_size=configuration.get('db.pool_size'),
>  migrate_enabled=configuration.get('db.migrate'),
>  check_reserved=['all'])
>
>  Failure to connect, tried 5 times: Traceback (most 
> recent call last): File 
> "/home/vladtseytkin/web2py/gluon/packages/dal/pydal/base.py", line 457, in 
> __init__ self._adapter = adapter(**kwargs) File 
> "/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/postgres.py", 
> line 27, in __call__ return AdapterMeta.__call__(cls, *args, **kwargs) File 
> "/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/__init__.py", 
> line 39, in __call__ obj = super(AdapterMeta, cls).__call__(*args, 
> **kwargs) File 
> "/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/postgres.py", 
> line 54, in __init__ driver_args, adapter_args, do_connect, 
> after_connection) File 
> "/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
> 369, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File 
> "/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
> 53, in __init__ self.reconnec

[web2py] please help: sycopg2.OperationalError: FATAL: password authentication failed for user "test"

2019-06-16 Thread Vlad
I'm bringing this from another post, because I've narrowed down the problem 
considerably, and it no longer corresponds neither to the headline nor to 
the content of that post. 

the following works fine, creating a valid connection:

connection = psycopg2.connect(database="test_db", user="test", 
password="xx", host="-994.postgres.pythonanywhere-services.com", 
port=10994)

the following fails: 

db = 
DAL("postgres://test:xx?!@-994.postgres.pythonanywhere-services.com:10994/test_db",
 pool_size=configuration.get('db.pool_size'),
 migrate_enabled=configuration.get('db.migrate'),
 check_reserved=['all'])

 Failure to connect, tried 5 times: Traceback (most 
recent call last): File 
"/home/vladtseytkin/web2py/gluon/packages/dal/pydal/base.py", line 457, in 
__init__ self._adapter = adapter(**kwargs) File 
"/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/postgres.py", 
line 27, in __call__ return AdapterMeta.__call__(cls, *args, **kwargs) File 
"/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/__init__.py", 
line 39, in __call__ obj = super(AdapterMeta, cls).__call__(*args, 
**kwargs) File 
"/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/postgres.py", 
line 54, in __init__ driver_args, adapter_args, do_connect, 
after_connection) File 
"/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
369, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File 
"/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
53, in __init__ self.reconnect() File 
"/home/vladtseytkin/web2py/gluon/packages/dal/pydal/helpers/classes.py", 
line 181, in _reconnect_and_configure self._connection_reconnect() File 
"/home/vladtseytkin/web2py/gluon/packages/dal/pydal/connection.py", line 
174, in reconnect self.connection = self.connector() File 
"/home/vladtseytkin/web2py/gluon/packages/dal/pydal/adapters/postgres.py", 
line 118, in connector return self.driver.connect(**self.driver_args) File 
"/home/vladtseytkin/.local/lib/python3.7/site-packages/psycopg2/__init__.py", 
line 126, in connect conn = _connect(dsn, 
connection_factory=connection_factory, **kwasync) 
psycopg2.OperationalError: FATAL: password authentication failed for user 
"test"

The password is correct. It can't possibly fail. Besides the password 
working in the db itself, t's the same very password that also works in 
psycopg2.connect() call above. 

How can I debug it further? What am I missing? What could be the reason?

I am getting exactly same problem (working for psycopg2.connect and not 
working for DAL constructor with exactly same error) when 1) doing it from 
web2py under PythonAnywhere and 2) web2py under my local windows PC (when 
local, running the ssh tunnel, as prescribed elsewhere). 

Please help! 

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


Re: [web2py] switching to postgres [RuntimeError: No driver of supported ones ('psycopg2',) is available]

2019-06-16 Thread Vlad
I've got 50% of the answer. They require ssh tunnel to be used and don't 
allow any direct connection. I understand that there is security reason for 
that, yet I am at loss on how to handle this better. 

Keeping ssh tunnel alive is problematic (for development it's fine, but for 
production...) 

So the only feasible solution for production environment to have "internal" 
db, i.e. hosted in the same very web2py server environment locally to avoid 
using tunnels. I mean, I am talking about cloud postgres providers - I 
don't think it's practical for me to become a postgres expert quickly and 
take care of its hosting by myself to allow a direct connection. 

Is this correct? 

But regardless of tunnels, I have a problem with PythonAnywhere thing, 
because there I use PA postgress and no tunnel required in such a 
configuration. So, while this opens a valid connection: 

import psycopg2
connection = psycopg2.connect(database="test_db", user="test", password=
"x", host="xxx-994.postgres.pythonanywhere-services.com", port=10994)

web2py reports a connection error (i.e. when I specify db in appconfig 
instead of opening a connection manually as above):

psycopg2.OperationalError: FATAL: password authentication failed for user 
"test"

So exact same settings fail when in web2py ( postgres://test:x?!@
xxx-994.postgres.pythonanywhere-services.com:10994/test_db )

Greatly appreciate some pointers to the db direction. I am at loss on how 
to handle this gracefully. SQLite has served perfect up until now, when I 
have to get to a real db... 




On Sunday, June 16, 2019 at 10:41:22 AM UTC-4, Vlad wrote:
>
> Okay, I recreated it in a simplest form, to get rid of any extra 
> parameters. Can't make it working neither on windows nor on linux. Here is 
> exactly what's going on: 
>
> *on linux: *
>
> the following code
> import psycopg2
> connection = psycopg2.connect(database="test_db", user="test", password=
> "x", host="xxx-994.postgres.pythonanywhere-services.com", port=10994)
> executes perfect. a valid connection is received. 
>
> However, when I specify exactly same in the appconfig 
> ( postgres://test:x?!@
> xxx-994.postgres.pythonanywhere-services.com:10994/test_db ) it fails 
> with the following error:
> psycopg2.OperationalError: FATAL: password authentication failed for user 
> "test"
>
> The user and the password are correct though - besides creating a 
> connection successfully by the code above, I've also verified in postgres 
> itself, to make sure that the user was created successfully and that the 
> permissions were given correctly. So it makes no sense that password 
> authentication fails. 
>
> *and here is what I have on windows: *
>
> the code above doesn't even create a valid connection. Here is the error: 
> "OperationalError(could not connect to server: Connection timed out 
> (0x274C/10060) Is the server running on host "
> xxx-994.postgres.pythonanywhere-services.com" (10.0.0.70) and accepting 
> TCP/IP connections on port 10994? )"
>
> and when I specify the db in appconfig, it's a similar error (just coming 
> from web2py wrapper, I guess): "psycopg2.OperationalError: could not 
> connect to server: Connection timed out (0x274C/10060) Is the server 
> running on host "xxx-994.postgres.pythonanywhere-services.com" 
> (10.0.0.70) and accepting TCP/IP connections on port 10994?"
>
> *So psycopg2 at this point is present and found by Python *(not even sure 
> what was the problem before, when it couldn't be found on windows), but *on 
> windows connection fails, while on linux password authentication fails*.
>
> Greatly appreciate any ideas. 
>
>
>
> On Sunday, June 16, 2019 at 7:54:20 AM UTC-4, Vlad wrote:
>>
>> On this one I run web2py on Windows. Using web2py from source. No idea 
>> what virtualenv is, so presumably not using it. Installed psycopg2 with 
>> pip3 specifically, to make sure it goes into the right Python. (I am not 
>> too familiar with this, but anything I install with pip goes to Python 2, 
>> and pip3 puts everything under Python 3 which I use for web2py). And yes, 
>> this is my development computer, so I restart web2py every time. 
>>
>> On Sun, Jun 16, 2019, 7:21 AM Val K  wrote:
>>
>>> Did you restart web2py after installation? 
>>>
>>> -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you 

Re: [web2py] switching to postgres [RuntimeError: No driver of supported ones ('psycopg2',) is available]

2019-06-16 Thread Vlad
Okay, I recreated it in a simplest form, to get rid of any extra 
parameters. Can't make it working neither on windows nor on linux. Here is 
exactly what's going on: 

*on linux: *

the following code
import psycopg2
connection = psycopg2.connect(database="test_db", user="test", password=
"x", host="xxx-994.postgres.pythonanywhere-services.com", port=10994)
executes perfect. a valid connection is received. 

However, when I specify exactly same in the appconfig 
( 
postgres://test:x?!@xxx-994.postgres.pythonanywhere-services.com:10994/test_db
 
) it fails with the following error:
psycopg2.OperationalError: FATAL: password authentication failed for user 
"test"

The user and the password are correct though - besides creating a 
connection successfully by the code above, I've also verified in postgres 
itself, to make sure that the user was created successfully and that the 
permissions were given correctly. So it makes no sense that password 
authentication fails. 

*and here is what I have on windows: *

the code above doesn't even create a valid connection. Here is the error: 
"OperationalError(could not connect to server: Connection timed out 
(0x274C/10060) Is the server running on host 
"xxx-994.postgres.pythonanywhere-services.com" (10.0.0.70) and accepting 
TCP/IP connections on port 10994? )"

and when I specify the db in appconfig, it's a similar error (just coming 
from web2py wrapper, I guess): "psycopg2.OperationalError: could not 
connect to server: Connection timed out (0x274C/10060) Is the server 
running on host "xxx-994.postgres.pythonanywhere-services.com" (10.0.0.70) 
and accepting TCP/IP connections on port 10994?"

*So psycopg2 at this point is present and found by Python *(not even sure 
what was the problem before, when it couldn't be found on windows), but *on 
windows connection fails, while on linux password authentication fails*.

Greatly appreciate any ideas. 



On Sunday, June 16, 2019 at 7:54:20 AM UTC-4, Vlad wrote:
>
> On this one I run web2py on Windows. Using web2py from source. No idea 
> what virtualenv is, so presumably not using it. Installed psycopg2 with 
> pip3 specifically, to make sure it goes into the right Python. (I am not 
> too familiar with this, but anything I install with pip goes to Python 2, 
> and pip3 puts everything under Python 3 which I use for web2py). And yes, 
> this is my development computer, so I restart web2py every time. 
>
> On Sun, Jun 16, 2019, 7:21 AM Val K  wrote:
>
>> Did you restart web2py after installation? 
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/UINJvjQAyZk/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/f86e442f-924a-4c97-b773-7865277006c4%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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


Re: [web2py] switching to postgres [RuntimeError: No driver of supported ones ('psycopg2',) is available]

2019-06-16 Thread Eliezer (Vlad) Tseytkin
On this one I run web2py on Windows. Using web2py from source. No idea what
virtualenv is, so presumably not using it. Installed psycopg2 with pip3
specifically, to make sure it goes into the right Python. (I am not too
familiar with this, but anything I install with pip goes to Python 2, and
pip3 puts everything under Python 3 which I use for web2py). And yes, this
is my development computer, so I restart web2py every time.

On Sun, Jun 16, 2019, 7:21 AM Val K  wrote:

> Did you restart web2py after installation?
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/UINJvjQAyZk/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/f86e442f-924a-4c97-b773-7865277006c4%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] making a secure db connection on top of already existing SSL for the site

2019-06-15 Thread Vlad
Here is a quote from the web2py docs: 

"Making a secure connection
Sometimes it is necessary (and advised) to connect to your database using 
secure connection, especially if your database is not on the same server as 
your application. In this case you need to pass additional parameters to 
the database driver. You should refer to database driver documentation for 
details.
For PostgreSQL with psycopg2 it should look like this:
DAL('postgres://user_name:user_password@server_addr/db_name',
driver_args={'sslmode': 'require', 'sslrootcert': 'root.crt',
 'sslcert': 'postgresql.crt', 'sslkey': 'postgresql.key'})"
<>

I am wondering if this feature is still necessary for a secure db 
connection in case I anyway use SSL for the site. 

Does this secure postgres feature need to be used on top of existing SSL 
connection? Or it's rather for non-ssl site to make a db connection secure? 

-- 
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/80a95bc2-94d3-49b0-af02-9f9681b7651e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] switching to postgres [RuntimeError: No driver of supported ones ('psycopg2',) is available]

2019-06-15 Thread Vlad
I am getting the following error:
RuntimeError: No driver of supported ones ('psycopg2',) is available

I used "pip3 install psycopg2"  and pip now reports that psycopg2 is 
installed. 

What am I still missing? What's the best (quickest, easiest, and 
hassle-free) way to use postgres from web2py? That is to say, I don't want 
to become a postgres expert - simply want to point to the postgres database 
and web2py to take care of the rest - this is exactly what DAL is about, 
isn't it? Ideally it should work out of the box, just like SQLite does...


-- 
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/0d2f5773-bc1b-439a-a390-a40a05d446e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

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

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

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

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


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

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

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

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

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

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

This will take care of www.domain1.com .

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

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

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

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


[web2py] 2 domains for 2 apps on 1 web2p

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

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

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

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

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

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



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/86a1e4b8-90df-4a81-b554-478d193bbaea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: managing users with no email

2019-06-11 Thread Vlad
sounds like a perfect solution
thank you!

p.s. I've made one enhancement: instead of fake email I created a catch-all 
email for the domain, and will instruct the admin to specify a "real" email 
for a new customer (like "customer.first_name.last_n...@mydomain.com") - it 
will be a fake, of course, but for all practical purposes it will forward 
all the invoices and receipts and whatever to the default inbox), so this 
will create a useful illusion for the admin that he is creating a "real" 
email for the customer... 

On Tuesday, June 11, 2019 at 3:11:53 PM UTC-4, Val K wrote:
>
> As far as I remember, it is possible add extra fields to auth_user table 
> +  you can make your own login form (phone/password)
> + you can retrieve record (and email that could be a fake) from  
> auth_user, using extra field (phone number) - db(auth_user.phone == 
> form.vars.phone).select(auth_user.email)
> + and you can login user using auth.login_bare(email, password)
>
> On Tuesday, June 11, 2019 at 9:41:40 PM UTC+3, Vlad wrote:
>>
>> seems to me that the ideal solution would be to allow an email field in 
>> auth_user to contain something other than email (for example, a phone 
>> number). but besides that I am not sure how to relax this requirement on 
>> the email field in auth_user, this solution seems to be politically 
>> incorrect, as this field is really expected to be an email (i.e. in a way 
>> how auth functions?) - 
>> so I am wondering what's the best way to make the thing to alternate 
>> between an email and a phone number for users as a unique account 
>> identifier...
>> greatly appreciate ideas... hope there is a simple and easy way to 
>> achieve this... 
>>
>> On Tuesday, June 11, 2019 at 2:37:23 PM UTC-4, Vlad wrote:
>>>
>>> Trying to figure out how to manage the following: 
>>>
>>> some users will manage themselves. this means that they have email and 
>>> they log into the system and do whatever they want. 
>>>
>>> other users don't use email (and generally aren't online altogether). so 
>>> I want an admin to manage them, i.e. they would call in or walk in and the 
>>> admin would do whatever needs to be done for them.
>>>
>>> the challenge is the email field. I don't want an admin to create a 
>>> unique email account for each user (simply because in real life they don't 
>>> use email and have no email account - though those always have a phone 
>>> number instead of email, if that helps), so an admin should be able to 
>>> create a customer who would never login by himself, but the admin would 
>>> manage what's going on in their account on their behalf. 
>>> What's the best way to handle it? 
>>>
>>>
>>>

-- 
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/c8a03de0-eaf5-427c-8d16-e025ed67c82a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: managing users with no email

2019-06-11 Thread Vlad
seems to me that the ideal solution would be to allow an email field in 
auth_user to contain something other than email (for example, a phone 
number). but besides that I am not sure how to relax this requirement on 
the email field in auth_user, this solution seems to be politically 
incorrect, as this field is really expected to be an email (i.e. in a way 
how auth functions?) - 
so I am wondering what's the best way to make the thing to alternate 
between an email and a phone number for users as a unique account 
identifier...
greatly appreciate ideas... hope there is a simple and easy way to achieve 
this... 

On Tuesday, June 11, 2019 at 2:37:23 PM UTC-4, Vlad wrote:
>
> Trying to figure out how to manage the following: 
>
> some users will manage themselves. this means that they have email and 
> they log into the system and do whatever they want. 
>
> other users don't use email (and generally aren't online altogether). so I 
> want an admin to manage them, i.e. they would call in or walk in and the 
> admin would do whatever needs to be done for them.
>
> the challenge is the email field. I don't want an admin to create a unique 
> email account for each user (simply because in real life they don't use 
> email and have no email account - though those always have a phone number 
> instead of email, if that helps), so an admin should be able to create a 
> customer who would never login by himself, but the admin would manage 
> what's going on in their account on their behalf. 
> What's the best way to handle it? 
>
>
>

-- 
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/eea8bc7c-a5a8-4393-ba43-bccf97690d87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] managing users with no email

2019-06-11 Thread Vlad
Trying to figure out how to manage the following: 

some users will manage themselves. this means that they have email and they 
log into the system and do whatever they want. 

other users don't use email (and generally aren't online altogether). so I 
want an admin to manage them, i.e. they would call in or walk in and the 
admin would do whatever needs to be done for them.

the challenge is the email field. I don't want an admin to create a unique 
email account for each user (simply because in real life they don't use 
email and have no email account - though those always have a phone number 
instead of email, if that helps), so an admin should be able to create a 
customer who would never login by himself, but the admin would manage 
what's going on in their account on their behalf. 
What's the best way to handle it? 


-- 
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/b8b9e3eb-78a2-44a9-8c09-d08df2c72efb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Hiding grid's columns (SQLFORM.grid) for smaller screen sizes

2019-06-11 Thread Vlad
how would I hide certain fields of the grid generated by SQLFORM.grid() 
depending on a screen size? 
normally I would use media breakpoints, but I am not sure how to manage it 
with SQLFORM.grid, as grid doesn't seem to expose any widgets explicitly... 

-- 
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/b9433a94-2203-4712-964c-e0d14cecb016%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   3   >