fun = database
zip = table name
inform = Field name
   this enters data into the database but I would prefer it run only once 
at registration.   
    fun.zipdip.insert(infom=result)

An interesting behavior is when I run the above I get 20 dates in the db. 
 But when I run 
--auth.settings.register_onaccept.append(fun.zipdip.insert(infom=result))-- 
I end up with quite a few more, about 60, which is preferable.  

The behavior is to generate a number of semi random dates within a range. 
 What I am looking for is each user to have his own unique set of dates; a 
scheduler will run daily and perform some action based on if today's date = 
date in the db or in this case "fun".  


On Friday, May 19, 2017 at 3:40:50 PM UTC-7, Anthony wrote:
>
> What is fun.zipdip.insert(inform=result), and how does the other code you 
> have shown come into play?
>
> On Friday, May 19, 2017 at 5:59:06 PM UTC-4, R U wrote:
>>
>> I would like to add a list of dates into my data base when the user signs 
>> up.
>>
>> from datetime import date, datetime, timedelta
>> import random
>> from random import randint
>> dog = randint(3,25)
>> def perdelta(start, end, delta):
>>     curr = start
>>     while curr < end:
>>         yield curr
>>         curr += delta
>>
>> for result in perdelta(date(2017, 11, 11), date(2018, 12, 12), 
>> timedelta(days=dog)):
>>     print str(result)
>>  
>> ##I have tried this but it does not make it contingent on registering.
>>
>>     
>> auth.settings.register_onaccept.append(fun.zipdip.insert(infom=result))
>>
>> Rob
>>
>

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

Reply via email to