Re: [web2py] Re: Confused about web2py sessions handling in the filesystem, versus the db handling.

2018-04-11 Thread Anthony

>
> About locking sessions, I see there is a "locked" boolean field in the 
> sessions table. What's stands for? I mean, I expect that it has something 
> to do with sessions locking, but when and where it is triggered?
>

As far as I can tell, that field is not actually used for anything. Maybe 
it was intended to allow locking, but the functionality was never 
implemented.

Anthony

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


[web2py] Re: Strange behaviour in grid with computed field

2018-04-11 Thread greenpoise
I wish I could change the main subject for this. I just realized is my 
computed field. I believe this use to work before. 

Field('description',compute=lambda r: r['seriesname']+" "+r['color']+" "+r[
'tilesize']),

Like I wrote before, when I edit the record, it does not take me back to 
the grid nor updates whichever field I change.




On Wednesday, April 11, 2018 at 1:39:56 PM UTC-7, greenpoise wrote:
>
> So, I have this two applications with different bootstrap versions. One is 
> older version with Bootstrap 3 and the grid works perfectly. I am able to 
> view and edit the item and it takes me back to the grid. Meanwhile the new 
> version, Bootstrap4, I click on Edit for a specific item and I edit a 
> field, click submit and it refreshes but does not take me back to the grid 
> and even if I click back, the edited field does not update. Anyone has 
> experienced this?
>

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


Re: [web2py] Re: Confused about web2py sessions handling in the filesystem, versus the db handling.

2018-04-11 Thread AlighaThor
Sorry for my delay. Thanks both Anthony and Richard for your excellent 
explanations!

Well, I changed for now to DB sessions. The settings mentioned by Anthony 
about renewing sessions are great, I did'nt know that. Anyway I still found 
that DB handling is by far easier/scalable/performant to me. :)

About locking sessions, I see there is a "locked" boolean field in the 
sessions table. What's stands for? I mean, I expect that it has something 
to do with sessions locking, but when and where it is triggered?

Thanks again guys!

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


[web2py] Strange behaviour between two grids and different Bootstrap versions

2018-04-11 Thread greenpoise
So, I have this two applications with different bootstrap versions. One is 
older version with Bootstrap 3 and the grid works perfectly. I am able to 
view and edit the item and it takes me back to the grid. Meanwhile the new 
version, Bootstrap4, I click on Edit for a specific item and I edit a 
field, click submit and it refreshes but does not take me back to the grid 
and even if I click back, the edited field does not update. Anyone has 
experienced this?

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


Re: [web2py] Reverse relationships

2018-04-11 Thread Richard Vézina
I think it coming from DAL vs ORM.

:)

Richard

On Wed, Apr 11, 2018 at 2:13 PM, pbreit  wrote:

> It's interesting that Rails & Django have a reverse relationship concept
> but Web2py apparently does not. Whenever I run into this in the various
> Rails/Django tutorials I don't understand it and find it confusing. Is that
> another instance where Massimo spared us from unnecessary complexity?
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Reverse relationships

2018-04-11 Thread pbreit
It's interesting that Rails & Django have a reverse relationship concept 
but Web2py apparently does not. Whenever I run into this in the various 
Rails/Django tutorials I don't understand it and find it confusing. Is that 
another instance where Massimo spared us from unnecessary complexity?

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


Re: [web2py] How to retrieve info about sessions when they are stored in Redis?

2018-04-11 Thread Richard Vézina
I gave a look directly in the redis shell

redis-cli -h localhost -p 6379 -a PASSWORD_IF_YOU_SET_ONE

It appears that each session store will have a different key which goes
like that : w2p:sess:APP_NAME:SOME_ID

And w2p:sess:APP_NAME:id_idx will contains a set of each unique session
existings, so you would have to access this list of session id then access
the actual session.

You can list keys in redis with :

SCAN 0

Better then KEYS that could cause lock and lot of memory usage

To list the set of existing sessions in ...:id_idx you need to use

smembers w2p:sess:APP_NAME:id_idx

It migth help you figure out how to manage you redis sessions form python
and better understand session contrib :
https://github.com/web2py/web2py/blob/0d646fa5e7c731cb5c392adf6a885351e77e4903/gluon/contrib/redis_session.py

Good luck

Richard



On Mon, Apr 9, 2018 at 12:11 AM, Lisandro 
wrote:

> Recently I moved the sessions from the database to Redis, and I'm
> wondering: is there a way to retrieve info about sessions when they are
> stored in Redis?
> For example, when sessions are stored in the database, you have the option
> to use SQL to do some stuff like counting or deleting sessions. How to do
> it when sessions are stored in Redis?
>
> I also use Redis to cache HTML responses from web2py and any other stuff
> that can be cached (lists, dictionaries, etc). In order to be able to list
> the keys cached by one specific web2py application, I have written this
> custom function to retrieve those keys.
> I've read that it's not a good idea to use cache.redis.r_server.keys()
> method on production
> ,
> so I written this code based on what I saw in the clear() method at
> gluon.contrib.redis_cache
> 
> :
>
> def get_cache_keys(application, prefix=''):
> import re
> result = []
> regex = ':%s*' % prefix
> prefix = 'w2p:%s' % application
> cache_set = 'w2p:%s:___cache_set' % application
> r = re.compile(regex)
> buckets = current.cache.redis.r_server.smembers(cache_set)  # get all
> buckets
> if buckets:  # get all keys in buckets
> keys = current.cache.redis.r_server.sunion(buckets)
> else:
> return result
> for a in keys:
> if r.match(str(a).replace(prefix, '', 1)):
> result.append(a)
> return result
>
>
> With that code, I'm able to list all the keys cached by a web2py
> application.
> As I'm also using Redis to store sessions, I want to be able to list all
> the session keys.
> I've tried a similar code to the one showed above, replacing this:
>
> prefix = 'w2p:sess:%s' % application
> cache_set = 'w2p:sess:%s:id_idx' % application
>
> But that doesn't work. Is it possible to achieve what I want? Any
> suggestion will be much appreciated.
>
> Regards,
> Lisandro.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] License expiry date management

2018-04-11 Thread Anthony
And if you need that to happen automatically on a regular schedule, you can 
use the web2py 
scheduler: 
http://web2py.com/books/default/chapter/29/04/the-core#web2py-Scheduler.

Anthony

On Wednesday, April 11, 2018 at 10:52:03 AM UTC-4, Richard wrote:
>
> Something like that :
>
> next_week_sunday_date = \
> (request.now.date() + datetime.timedelta(days=7)) + 
> datetime.timedelta(days=6 - request.now.weekday())
>
> rows_with_records_of_software_license_that_will_end_the_next_sunday = 
> db(db.table_name.field_date_name == next_week_sunday_date
> ).select(db.table_name.ALL)
>
> Then :
>
> for r in 
> rows_with_records_of_software_license_that_will_end_the_next_sunday:
> # get data you require from you table row and send you email
>
> Richard
>
> On Wed, Apr 11, 2018 at 4:01 AM, Prabhakar Shanmugam  
> wrote:
>
>> Dear All,
>>
>> I have just started learning web2py and I have hands on in python. 
>>
>> Please just give some pointers. Iam sure this might be a trivial 
>> question, but I thought during the learning process I will ask this trivial 
>> question.
>>
>> I was seeing if i can write a license expiry daet management app, so 
>> that, we get a notification well before the license expires.
>>
>> I was going through the documentation, and I got some examples for 
>> sending emails, however, am not finding a way to identify a field value say 
>> a expiry date field and then calculating it and seeing if it is 40 or less 
>> days from today and notify. 
>>
>> What are the options available to me to achieve this.
>>
>> Regards,
>> Prabhakar
>>
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


Re: [web2py] License expiry date management

2018-04-11 Thread Richard Vézina
Something like that :

next_week_sunday_date = \
(request.now.date() + datetime.timedelta(days=7)) +
datetime.timedelta(days=6 - request.now.weekday())

rows_with_records_of_software_license_that_will_end_the_next_sunday =
db(db.table_name.field_date_name == next_week_sunday_date
).select(db.table_name.ALL)

Then :

for r in
rows_with_records_of_software_license_that_will_end_the_next_sunday:
# get data you require from you table row and send you email

Richard

On Wed, Apr 11, 2018 at 4:01 AM, Prabhakar Shanmugam 
wrote:

> Dear All,
>
> I have just started learning web2py and I have hands on in python.
>
> Please just give some pointers. Iam sure this might be a trivial question,
> but I thought during the learning process I will ask this trivial question.
>
> I was seeing if i can write a license expiry daet management app, so that,
> we get a notification well before the license expires.
>
> I was going through the documentation, and I got some examples for sending
> emails, however, am not finding a way to identify a field value say a
> expiry date field and then calculating it and seeing if it is 40 or less
> days from today and notify.
>
> What are the options available to me to achieve this.
>
> Regards,
> Prabhakar
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] License expiry date management

2018-04-11 Thread Prabhakar Shanmugam
Dear All,

I have just started learning web2py and I have hands on in python. 

Please just give some pointers. Iam sure this might be a trivial question, 
but I thought during the learning process I will ask this trivial question.

I was seeing if i can write a license expiry daet management app, so that, 
we get a notification well before the license expires.

I was going through the documentation, and I got some examples for sending 
emails, however, am not finding a way to identify a field value say a 
expiry date field and then calculating it and seeing if it is 40 or less 
days from today and notify. 

What are the options available to me to achieve this.

Regards,
Prabhakar


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