[web2py] Problem to pack all the application without past deleted file file

2016-02-02 Thread Alessio Varalta
Hi, I have a problem with my web2py application. I have worked for three 
weeks online in a debian server and i have created-deleted many files. My 
problem is if i make now a pack all and after i ricreate the application in 
locale web2py i see my file but after the old file that i have deleted. 
There is the possibilty to take only the last files?

-- 
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: .one() and .one_or_none() in DAL

2016-02-02 Thread Anthony
On Tuesday, February 2, 2016 at 2:41:22 AM UTC-5, Niphlod wrote:
>
> whatever_query.first()
> do you really want an exception raised if no results are found and write
>
> try:
>  whatever_query.one()
> except:
>  didn't find anything
>
> instead of
>
> if not whatever_query.first():
> didn't find anything 
>

The .one method raises an exception unless there is *exactly* one matching 
record, so in web2py would be equivalent to something like:

rows = db(query).select()
if len(rows) > 1:
raise MultipleResultsFound
elif len(rows) < 1:
raise NoResultsFound
else:
row = rows.first()

Not sure how useful it is, though. If you want to enforce uniqueness under 
particular conditions, you would typically do that by defining constraints 
in the database (or at least via validators) -- in other words, deal with 
it at write time rather than read time . I suppose there could also be 
cases where you don't want to enforce uniqueness but instead simply want to 
do something different depending on whether there is exactly one match -- 
but I'm not sure raising an exception would be the most straightforward 
approach in that case. It would be interesting to see some common use cases 
for the .one method.

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: Nested queries

2016-02-02 Thread Alfonso Serra

Yep thats right, i edited the post.  that was just an example, they arent 
real tables in my project. I like plurals for tables since they are 
collections of records and singular for field names. 

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


[web2py] Re: How to keep project separate from web2py itself?

2016-02-02 Thread Anthony
On Tuesday, February 2, 2016 at 2:38:59 AM UTC-5, Niphlod wrote:
>
> some things in web2py are not app-dependant so I guess it'll be quite not 
> possible to have a per-app folder.
>

Presumably if there were some configuration file mapping applications to 
folders (perhaps even in routes.py), it could be made to work (not saying 
we should do it).

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: sequence of actions / general rules for code organization

2016-02-02 Thread Pierre
hello Anthony,

by action concatenation I mean something like :

result=funcc(funcb(funca(data)))

I would like to stick to optimization recommandations so to disable sessions

Since Byte compiling the app is also required, i intend to do this as well. 
Howewer in such case what happens if an unexpected bug occurs and one 
doesn't have access to the source code ?

there's also the server requirement issue. Does a provider like 
pythonanywhere know how to set up web2py and nginx for best performances ?


-- 
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: Auth User split by tables

2016-02-02 Thread Anthony
On Monday, February 1, 2016 at 9:40:07 PM UTC-5, Ron Chatterjee wrote:
>
> Come to think Anthony, the best way to do it will be similar to this. 
> Having hidden field and tables and once selected the user_type, all the 
> other fields or tables shows up. 
>
>
> https://stackoverflow.com/questions/17380476/web2py-authenticating-two-types-of-profile
>
> But the implementation is wrong. 
>
> hidden_fields = (user_extra_fields if request.args(1) == 'tutor') 
>
> request.args(1) will never get satisfied like that. Need to process the table 
> and then set the argument. I am thinking...but I could be wrong.
>
>
In that particular question, the premise was that the user type would be 
specified in the URL (in request.args(1)) -- so I believe the proposed 
implementation would work in that case. If you cannot determine user type 
until after login, then yes, you would need an alternative setup.

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: sequence of actions / general rules for code organization

2016-02-02 Thread Anthony
On Tuesday, February 2, 2016 at 10:30:42 AM UTC-5, Pierre wrote:
>
> hello Anthony,
>
> by action concatenation I mean something like :
>
> result=funcc(funcb(funca(data)))
>

Still not clear what you are trying to achieve. Are you saying you want the 
user to visit several pages in succession, or that you just want to pass 
the results of one function to the next and to the next and so on? If the 
latter, just do what you have written above.
 

> Since Byte compiling the app is also required, i intend to do this as 
> well. Howewer in such case what happens if an unexpected bug occurs and one 
> doesn't have access to the source code ?
>

You can compile the app but still retain the original source code files 
(when the app is compiled, web2py automatically executes the .pyc files and 
ignores the .py files -- but you can keep the .py files there).
 

> there's also the server requirement issue. Does a provider like 
> pythonanywhere know how to set up web2py and nginx for best performances ?
>

They seem to think so: https://www.pythonanywhere.com/details/web2py_hosting

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: Duplicate entries in Auth_user DB table upon sign in

2016-02-02 Thread Michael Messmer
Yes it does.  Submitted: https://github.com/web2py/web2py/issues/1178

On Wednesday, January 27, 2016 at 3:08:16 PM UTC-8, Massimo Di Pierro wrote:
>
> Are you saying that fixes it? Please submit your patch to git and we will 
> improve it if necessary. Thanks.
>
>
> On Tuesday, 26 January 2016 16:45:33 UTC-6, Michael M wrote:
>>
>> Ok,  I inadvertently lied.  
>>
>> Not everything was the same.  Part of my install script is to download 
>> the source from the internet of web2py.
>>
>> I switched my DB back to SQLite and and tried a login.  Same deal with 
>> LDAP/AD login on SQLite was still getting the same issue of two line items 
>> in 'db.auth_user'
>>
>> What I did to fix it was.
>>
>> ldap_auth.py ~line 425 added " 'username': username " to the 
>> "update_or_insert_values" dictionary 
>>
>> update_or_insert_values = {'first_name': store_user_firstname,
>>'last_name': 
>> store_user_lastname,
>>'email': store_user_mail,
>>'username': username}
>>
>>
>> ldap_auth.py ~line 429 added " ,'username' " to the fields array
>>
>> fields = ['first_name', 'last_name', 'email','username']
>>
>>
>> I dont know what else to link to.  Should I submit a bugfix on Git?
>>
>>
>> On Friday, January 22, 2016 at 5:36:31 PM UTC-8, Michael M wrote:
>>>
>>> I just asked my guys on my DBA team to do a trace.  So they ran the 
>>> trace while I logged in.
>>>
>>> They sent me this:
>>>
>>> As discussed, We traced application login activity. Following are the 
>>> INSERT statements against WEB2PY_OracleProject.AUTH_USER table
>>>
>>>
>>> INSERT INTO auth_user(username,first_name,last_name,registration_id,
>>> reset_password_key,registration_key,email)
>>> VALUES
>>> ('','Michael','Messmer [mmessmer]','','','','mmess...@something.com 
>>> ')
>>>
>>>
>>> INSERT INTO auth_user(username,first_name,last_name,registration_id,
>>> reset_password_key,registration_key,email)
>>> VALUES
>>> ('mmessmer','mmessmer','','','','','')
>>>
>>>
>>> Module - uw...@servername.something.com  (TNS V1-V3)
>>>
>>> User - WEB2PY_OracleProject
>>>
>>>
>>>
>>> On Thursday, January 21, 2016 at 5:24:36 PM UTC-8, Michael Messmer wrote:

 When I use the following on SQLite 

manage_groups= True,
manage_user = True,

 1 entry in would come into db.auth_user

 When I transferred to Oracle 11g
 a new user logs in and I get two entries.

 42  Mi Me [mme...mme@...NoneNoneNone   
  NoneNone
 43  mmeNoneNonemmeNoneNoneNone   
  mme

 Log out and log in again. 
 Then I get: 

 43  Mi Me [mme...mme@...mmeNoneNone   
  Nonemme

 So row 43 is now getting updated.

 Any thoughts.  Again the the only thing that chaged was default SQLite 
 to Oracle 11g  as the main DB


 See Context below:
 ---

 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
 auth = Auth(db)
 crud, service, plugins = Crud(db), Service(), PluginManager()


 ## create all tables needed by auth if not custom tables
 auth.define_tables(username=True, signature=False)

 # all we need is login

 auth.settings.actions_disabled=['register','change_password','request_reset_password','retrieve_username','profile']
 #auth.settings.login_onvalidation = []
 # you don't have to remember me
 auth.settings.remember_me_form = False

 #
 http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm
 # ldap authentication and not save password on web2py
 from gluon.contrib.login_methods.ldap_auth import ldap_auth
 auth.settings.login_methods = [ldap_auth(mode='ad',
manage_groups= True,
db = db,
manage_user = True,
user_firstname_attrib = 'cn:1',
user_lastname_attrib = 'sn',
group_member_attrib = 'member',
group_filterstr = 'objectClass=Group',
server='somethign.com',
base_dn='DC=corp,DC=something,DC=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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Granular transactions on scheduled tasks

2016-02-02 Thread Antonio Salazar
I have a scheduled task that midway should divide its work in two database 
transactions.

It's obvious it should db.commit() after the first transaction, but how do 
I start the second transaction?

-- 
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: sequence of actions / general rules for code organization

2016-02-02 Thread Pierre
Yes Yes

nothing extraordinary

I just want to pass variables from one controller/function to another 
controller/function and so on and my question was is redirect the only way 
to do this ?


as for visiting a predefined sequence of urls automatically: isn't this 
called a video  ?  :)

-- 
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: sequence of actions / general rules for code organization

2016-02-02 Thread Richard Vézina
redirect(URL('controller', 'function', 'args',
'vars_dict_where_the_stuff_you_want_to_pass_to_other_controller_goes'))

Richard

On Tue, Feb 2, 2016 at 1:05 PM, Pierre  wrote:

> Yes Yes
>
> nothing extraordinary
>
> I just want to pass variables from one controller/function to another
> controller/function and so on and my question was is redirect the only way
> to do this ?
>
>
> as for visiting a predefined sequence of urls automatically: isn't this
> called a video  ?  :)
>
> --
> 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] autocomplete widget

2016-02-02 Thread Richard Vézina
This should be a name or id html field issue...

Can you have a look at the HTML and tell us what is the name and id
attributes values of these two widget?

On Tue, Feb 2, 2016 at 2:21 PM, Pierre  wrote:

>
> Is it only ONE autocomplete widget allowed per table ?
>
> this code uses 2 widgets but the second autocomplete field is never filled
> :
>
> db.define_table('person',
> Field('name', unique=True, requires=IS_NOT_IN_DB(db,'
> person.name')),
> Field('country'),
> Field('age','integer'))
>
> db.define_table('thing',
> Field('name'),
> Field('persona'),
> Field('personb'))
>
> db.thing.persona.widget = SQLFORM.widgets.autocomplete(request,
> db.person.name, id_field=db.person.id)
> db.thing.personb.widget = SQLFORM.widgets.autocomplete(request,
> db.person.name, id_field=db.person.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.
> 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] autocomplete widget

2016-02-02 Thread Richard Vézina
And does the second widget change the selected value of the first one ?

Richard

On Tue, Feb 2, 2016 at 2:25 PM, Richard Vézina 
wrote:

> This should be a name or id html field issue...
>
> Can you have a look at the HTML and tell us what is the name and id
> attributes values of these two widget?
>
> On Tue, Feb 2, 2016 at 2:21 PM, Pierre  wrote:
>
>>
>> Is it only ONE autocomplete widget allowed per table ?
>>
>> this code uses 2 widgets but the second autocomplete field is never
>> filled :
>>
>> db.define_table('person',
>> Field('name', unique=True, requires=IS_NOT_IN_DB(db,'
>> person.name')),
>> Field('country'),
>> Field('age','integer'))
>>
>> db.define_table('thing',
>> Field('name'),
>> Field('persona'),
>> Field('personb'))
>>
>> db.thing.persona.widget = SQLFORM.widgets.autocomplete(request,
>> db.person.name, id_field=db.person.id)
>> db.thing.personb.widget = SQLFORM.widgets.autocomplete(request,
>> db.person.name, id_field=db.person.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.
>> 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] autocomplete widget

2016-02-02 Thread Richard Vézina
The code is here :
https://github.com/web2py/web2py/blob/63bb4a7e8a39f466f6269e2f98c7b741d001def9/gluon/sqlhtml.py#L643

On Tue, Feb 2, 2016 at 2:27 PM, Richard Vézina 
wrote:

> And does the second widget change the selected value of the first one ?
>
> Richard
>
> On Tue, Feb 2, 2016 at 2:25 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> This should be a name or id html field issue...
>>
>> Can you have a look at the HTML and tell us what is the name and id
>> attributes values of these two widget?
>>
>> On Tue, Feb 2, 2016 at 2:21 PM, Pierre  wrote:
>>
>>>
>>> Is it only ONE autocomplete widget allowed per table ?
>>>
>>> this code uses 2 widgets but the second autocomplete field is never
>>> filled :
>>>
>>> db.define_table('person',
>>> Field('name', unique=True, requires=IS_NOT_IN_DB(db,'
>>> person.name')),
>>> Field('country'),
>>> Field('age','integer'))
>>>
>>> db.define_table('thing',
>>> Field('name'),
>>> Field('persona'),
>>> Field('personb'))
>>>
>>> db.thing.persona.widget = SQLFORM.widgets.autocomplete(request,
>>> db.person.name, id_field=db.person.id)
>>> db.thing.personb.widget = SQLFORM.widgets.autocomplete(request,
>>> db.person.name, id_field=db.person.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.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>

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


[web2py] Re: sequence of actions / general rules for code organization

2016-02-02 Thread Pierre
allright

thanks Richard


now this is clear

-- 
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] autocomplete widget

2016-02-02 Thread Pierre

Is it only ONE autocomplete widget allowed per table ?

this code uses 2 widgets but the second autocomplete field is never filled :

db.define_table('person',
Field('name', unique=True, 
requires=IS_NOT_IN_DB(db,'person.name')),
Field('country'),
Field('age','integer'))

db.define_table('thing',
Field('name'),
Field('persona'),
Field('personb'))

db.thing.persona.widget = SQLFORM.widgets.autocomplete(request, 
db.person.name, id_field=db.person.id)
db.thing.personb.widget = SQLFORM.widgets.autocomplete(request, 
db.person.name, id_field=db.person.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.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] autocomplete widget

2016-02-02 Thread Richard Vézina
Is the models you show are the exact model definition you test?

You did not define the persona and personb type which is 'reference
person', which may cause the issue...

Richard

On Tue, Feb 2, 2016 at 2:30 PM, Richard Vézina 
wrote:

> The code is here :
> https://github.com/web2py/web2py/blob/63bb4a7e8a39f466f6269e2f98c7b741d001def9/gluon/sqlhtml.py#L643
>
> On Tue, Feb 2, 2016 at 2:27 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> And does the second widget change the selected value of the first one ?
>>
>> Richard
>>
>> On Tue, Feb 2, 2016 at 2:25 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> This should be a name or id html field issue...
>>>
>>> Can you have a look at the HTML and tell us what is the name and id
>>> attributes values of these two widget?
>>>
>>> On Tue, Feb 2, 2016 at 2:21 PM, Pierre  wrote:
>>>

 Is it only ONE autocomplete widget allowed per table ?

 this code uses 2 widgets but the second autocomplete field is never
 filled :

 db.define_table('person',
 Field('name', unique=True, requires=IS_NOT_IN_DB(db,'
 person.name')),
 Field('country'),
 Field('age','integer'))

 db.define_table('thing',
 Field('name'),
 Field('persona'),
 Field('personb'))

 db.thing.persona.widget = SQLFORM.widgets.autocomplete(request,
 db.person.name, id_field=db.person.id)
 db.thing.personb.widget = SQLFORM.widgets.autocomplete(request,
 db.person.name, id_field=db.person.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.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>
>

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


[web2py] Re: Auth User split by tables

2016-02-02 Thread Ron Chatterjee
So, In my application. I have two user type. User and Tutor. 

Once they register, if user_type = 'User', I want it to go through the 
registration process and create a user_profile by redirecting to 
"user_profile". If user_type = 'Tutor', create a tutor_profile and get 
redirected

in my default controller, auth(): I have:

form = auth();

if form.accepted:
if request.args(0) in ['register']:
if (db.auth_user.user_type == 'User'):
redirect(URL('user_profile'))
else:
redirect(URL('teacher_profile'))

But this don't work. It register and gets redirected to index. 





On Tuesday, February 2, 2016 at 10:32:34 AM UTC-5, Anthony wrote:

> On Monday, February 1, 2016 at 9:40:07 PM UTC-5, Ron Chatterjee wrote:
>>
>> Come to think Anthony, the best way to do it will be similar to this. 
>> Having hidden field and tables and once selected the user_type, all the 
>> other fields or tables shows up. 
>>
>>
>> https://stackoverflow.com/questions/17380476/web2py-authenticating-two-types-of-profile
>>
>> But the implementation is wrong. 
>>
>> hidden_fields = (user_extra_fields if request.args(1) == 'tutor') 
>>
>> request.args(1) will never get satisfied like that. Need to process the 
>> table and then set the argument. I am thinking...but I could be wrong.
>>
>>
> In that particular question, the premise was that the user type would be 
> specified in the URL (in request.args(1)) -- so I believe the proposed 
> implementation would work in that case. If you cannot determine user type 
> until after login, then yes, you would need an alternative setup.
>
> 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: Granular transactions on scheduled tasks

2016-02-02 Thread Niphlod
you have only one transaction at your disposal per connection...
every command you send down the pipe gets queued and the queue can be 
commit()ted or rollback()ed. 
This queue of commands (in regards of multiple write operations, 
(update/insert/delete)) is atomically "executed" though a transaction, once 
you commit() it.
once you db.commit() (or rollback()), another "queue" is "opened" 
implicitly.
if you need to treat two separate "queues" of commands, and retain the 
possibility to commit() both, or one, or none, or rollback() both, or one, 
or none, you NEED to use two different connections (i.e. db = DAL('') 
and db2 = DAL('...'))

On Tuesday, February 2, 2016 at 6:59:55 PM UTC+1, Antonio Salazar wrote:
>
> I have a scheduled task that midway should divide its work in two database 
> transactions.
>
> It's obvious it should db.commit() after the first transaction, but how do 
> I start the second transaction?
>

-- 
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: autocomplete widget

2016-02-02 Thread Pierre

No the second widget doesn't change the first widget selection

here is the html :


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: autocomplete widget

2016-02-02 Thread Pierre
In fact Yes


the second input replaces the first :

personb replaces persona and personb ends up empty

-- 
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: autocomplete widget

2016-02-02 Thread Richard Vézina
Did you try to set the type to these fields?

db.define_table('thing',
Field('name'),
Field('persona', 'reference person'),
Field('personb', 'reference person'))

On Tue, Feb 2, 2016 at 3:10 PM, Pierre  wrote:

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

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


[web2py] Re: daily scheduler task

2016-02-02 Thread Tim Richardson

>
>
>> But of course it would be good to know what's going on here and why this 
>> can happen.
>>
>
Must be unusual. I've been doing something similar for about two years over 
various web2py versions (on windows and ubuntu) and haven't seen this 
behaviour. 

-- 
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: autocomplete widget

2016-02-02 Thread Richard Vézina
Pierre,

You crop the interresting part... after the etc

The error is surely coming from the jQuery which for some reason don't get
generated properly by the widget...

Richard

On Tue, Feb 2, 2016 at 3:29 PM, Richard Vézina 
wrote:

> Did you try to set the type to these fields?
>
> db.define_table('thing',
> Field('name'),
> Field('persona', 'reference person'),
> Field('personb', 'reference person'))
>
> On Tue, Feb 2, 2016 at 3:10 PM, Pierre  wrote:
>
>> In fact Yes
>>
>>
>> the second input replaces the first :
>>
>> personb replaces persona and personb ends up empty
>>
>> --
>> 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] Re: autocomplete widget

2016-02-02 Thread Richard Vézina
If you can pack a dummy app to help us reproduce the problem it could
help...

Richard

On Tue, Feb 2, 2016 at 3:31 PM, Richard Vézina 
wrote:

> Pierre,
>
> You crop the interresting part... after the etc
>
> The error is surely coming from the jQuery which for some reason don't get
> generated properly by the widget...
>
> Richard
>
> On Tue, Feb 2, 2016 at 3:29 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Did you try to set the type to these fields?
>>
>> db.define_table('thing',
>> Field('name'),
>> Field('persona', 'reference person'),
>> Field('personb', 'reference person'))
>>
>> On Tue, Feb 2, 2016 at 3:10 PM, Pierre  wrote:
>>
>>> In fact Yes
>>>
>>>
>>> the second input replaces the first :
>>>
>>> personb replaces persona and personb ends up empty
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>

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


[web2py] Re: Auth User split by tables

2016-02-02 Thread Anthony
auth.register() automatically does a redirect after registration, so to do 
your own redirect, you should either pass a callback as the onaccept 
argument to auth.register() or specify the callback via 
auth.settings.register_onaccept.

Also, this condition:

if (db.auth_user.user_type == 'User'):

will not do what you want. Because db.auth_user.user_type is a Field 
object, the above is simply a Query object (and since a Query object is not 
falsey in Python, the above will always evaluate to True).

Instead, assuming you use the onaccept callback, note that the registration 
Form object gets passed to the callback, so you could do:

def after_registration(form):
if form.vars.user_type == 'User':
redirect(...)
etc.

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.


Re: [web2py] Re: autocomplete widget

2016-02-02 Thread Richard Vézina
Error come from :
https://github.com/web2py/web2py/blob/63bb4a7e8a39f466f6269e2f98c7b741d001def9/gluon/sqlhtml.py#L648

And here :
https://github.com/web2py/web2py/blob/63bb4a7e8a39f466f6269e2f98c7b741d001def9/gluon/sqlhtml.py#L657

The widget can't use the same field name...

There is already a ticket on github about that :
https://github.com/web2py/web2py/issues/940


Can be reproduce with this code :

# model
db.define_table('person',
Field('name', unique=True, requires=IS_NOT_IN_DB(db,'
person.name')),
Field('country', 'string'),
Field('age', 'integer'))

db.define_table('thing',
Field('name', 'string'),
Field('persona', 'reference person', requires=IS_IN_DB(db, '
person.id', '%(name)s')),
Field('personb', 'reference person', requires=IS_IN_DB(db, '
person.id', '%(name)s'))
 )

db.thing.persona.widget = SQLFORM.widgets.autocomplete(request,
db.person.name, id_field=db.person.id)
db.thing.personb.widget = SQLFORM.widgets.autocomplete(request,
db.person.name, id_field=db.person.id)


# controller
def create():
form = SQLFORM(db[request.args(0)])
form.process(detect_record_change=True)
if form.record_changed:
pass
# do something
elif form.accepted:
pass
# do something else
else:
pass
# do nothing
return dict(form=form)

You need to pass : person or thing as argument 0

Richard

On Tue, Feb 2, 2016 at 3:32 PM, Richard Vézina 
wrote:

> If you can pack a dummy app to help us reproduce the problem it could
> help...
>
> Richard
>
> On Tue, Feb 2, 2016 at 3:31 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Pierre,
>>
>> You crop the interresting part... after the etc
>>
>> The error is surely coming from the jQuery which for some reason don't
>> get generated properly by the widget...
>>
>> Richard
>>
>> On Tue, Feb 2, 2016 at 3:29 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Did you try to set the type to these fields?
>>>
>>> db.define_table('thing',
>>> Field('name'),
>>> Field('persona', 'reference person'),
>>> Field('personb', 'reference person'))
>>>
>>> On Tue, Feb 2, 2016 at 3:10 PM, Pierre  wrote:
>>>
 In fact Yes


 the second input replaces the first :

 personb replaces persona and personb ends up empty

 --
 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] Re: autocomplete widget

2016-02-02 Thread Richard Vézina
You can workaround that problem like this :

db.define_table('person',
Field('name', unique=True, requires=IS_NOT_IN_DB(db,'
person.name')),
Field('country', 'string'),
Field('age', 'integer'))

db.define_table('thing',
Field('name', 'string'),
Field('persona', 'reference person', requires=IS_IN_DB(db, '
person.id', '%(name)s')),
Field('personb', 'reference person', requires=IS_IN_DB(db, '
person.id', '%(name)s'))
 )

db.thing.persona.widget = SQLFORM.widgets.autocomplete(request,
db.person.name, id_field=db.person.id,
*keyword='_autocomplete_thing_persona'*)
db.thing.personb.widget = SQLFORM.widgets.autocomplete(request,
db.person.name, id_field=db.person.id,
*keyword='_autocomplete_thing_personb'*)

Which was maybe the intent of having keyword attribute... I don't know...

Richard

On Tue, Feb 2, 2016 at 3:54 PM, Richard Vézina 
wrote:

> Error come from :
> https://github.com/web2py/web2py/blob/63bb4a7e8a39f466f6269e2f98c7b741d001def9/gluon/sqlhtml.py#L648
>
> And here :
> https://github.com/web2py/web2py/blob/63bb4a7e8a39f466f6269e2f98c7b741d001def9/gluon/sqlhtml.py#L657
>
> The widget can't use the same field name...
>
> There is already a ticket on github about that :
> https://github.com/web2py/web2py/issues/940
>
>
> Can be reproduce with this code :
>
> # model
> db.define_table('person',
> Field('name', unique=True, requires=IS_NOT_IN_DB(db,'
> person.name')),
> Field('country', 'string'),
> Field('age', 'integer'))
>
> db.define_table('thing',
> Field('name', 'string'),
> Field('persona', 'reference person', requires=IS_IN_DB(db,
> 'person.id', '%(name)s')),
> Field('personb', 'reference person', requires=IS_IN_DB(db,
> 'person.id', '%(name)s'))
>  )
>
> db.thing.persona.widget = SQLFORM.widgets.autocomplete(request,
> db.person.name, id_field=db.person.id)
> db.thing.personb.widget = SQLFORM.widgets.autocomplete(request,
> db.person.name, id_field=db.person.id)
>
>
> # controller
> def create():
> form = SQLFORM(db[request.args(0)])
> form.process(detect_record_change=True)
> if form.record_changed:
> pass
> # do something
> elif form.accepted:
> pass
> # do something else
> else:
> pass
> # do nothing
> return dict(form=form)
>
> You need to pass : person or thing as argument 0
>
> Richard
>
> On Tue, Feb 2, 2016 at 3:32 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> If you can pack a dummy app to help us reproduce the problem it could
>> help...
>>
>> Richard
>>
>> On Tue, Feb 2, 2016 at 3:31 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Pierre,
>>>
>>> You crop the interresting part... after the etc
>>>
>>> The error is surely coming from the jQuery which for some reason don't
>>> get generated properly by the widget...
>>>
>>> Richard
>>>
>>> On Tue, Feb 2, 2016 at 3:29 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Did you try to set the type to these fields?

 db.define_table('thing',
 Field('name'),
 Field('persona', 'reference person'),
 Field('personb', 'reference person'))

 On Tue, Feb 2, 2016 at 3:10 PM, Pierre  wrote:

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


>>>
>>
>

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


[web2py] Re: sequence of actions / general rules for code organization

2016-02-02 Thread Anthony
On Tuesday, February 2, 2016 at 1:05:29 PM UTC-5, Pierre wrote:
>
> Yes Yes
>
> nothing extraordinary
>
> I just want to pass variables from one controller/function to another 
> controller/function and so on and my question was is redirect the only way 
> to do this ?
>

Sure, redirect is one possibility, depending on what you are trying to 
achieve, but in your example you showed an immediate progression passing 
the results of one function into another and then another. Controller 
actions are for responding to HTTP requests, so you wouldn't chain them 
together in that fashion. But yes, you can certainly do a redirect when 
appropriate. Aside from passing data via the URL query string, you can also 
store data in the session.

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: Auth User split by tables

2016-02-02 Thread Ron Chatterjee
You are the best Anthony! I did this:

auth.settings.register_onaccept = lambda form: after_registration(form) in 
my model 

in my controller worked fine.

Now all I want to do is append my menu with user profile (see attached). 
But user profile will have the same attributes like regular profile. Means 
if the user profile has already been created it will have all the inserted 
texts and user can modify/edit and then do "apply changes". Rather than 
having another link to "update profile". Wish you can point me somewhere . 
lol. 

Thank you for all the help! Appreciate it. 



On Tuesday, February 2, 2016 at 3:45:12 PM UTC-5, Anthony wrote:
>
> auth.register() automatically does a redirect after registration, so to do 
> your own redirect, you should either pass a callback as the onaccept 
> argument to auth.register() or specify the callback via 
> auth.settings.register_onaccept.
>
> Also, this condition:
>
> if (db.auth_user.user_type == 'User'):
>
> will not do what you want. Because db.auth_user.user_type is a Field 
> object, the above is simply a Query object (and since a Query object is not 
> falsey in Python, the above will always evaluate to True).
>
> Instead, assuming you use the onaccept callback, note that the 
> registration Form object gets passed to the callback, so you could do:
>
> def after_registration(form):
> if form.vars.user_type == 'User':
> redirect(...)
> etc.
>
> 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: Granular transactions on scheduled tasks

2016-02-02 Thread Antonio Salazar
This is good for my case, basically I just need to commit whenever I want 
the current transaction to end, and a new one will begin.

The "commit and rollback" section of the manual mentions this in the 
context of models, controllers, views and modules, but the scheduler is a 
special case of model, so I wasn't sure. Thanks for the clarification.

On Tuesday, February 2, 2016 at 1:43:53 PM UTC-6, Niphlod wrote:
>
> you have only one transaction at your disposal per connection...
> every command you send down the pipe gets queued and the queue can be 
> commit()ted or rollback()ed. 
> This queue of commands (in regards of multiple write operations, 
> (update/insert/delete)) is atomically "executed" though a transaction, once 
> you commit() it.
> once you db.commit() (or rollback()), another "queue" is "opened" 
> implicitly.
> if you need to treat two separate "queues" of commands, and retain the 
> possibility to commit() both, or one, or none, or rollback() both, or one, 
> or none, you NEED to use two different connections (i.e. db = DAL('') 
> and db2 = DAL('...'))
>
> On Tuesday, February 2, 2016 at 6:59:55 PM UTC+1, Antonio Salazar wrote:
>>
>> I have a scheduled task that midway should divide its work in two 
>> database transactions.
>>
>> It's obvious it should db.commit() after the first transaction, but how 
>> do I start the second transaction?
>>
>

-- 
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: Auth User split by tables

2016-02-02 Thread Anthony

>
> I guess I can do this:
> https://groups.google.com/forum/#!topic/web2py/AYORqIEpc9E
> But that kills all the style. Then I got to custom style it. 
>

Just look at the HTML generated by auth.navbar() and replicate that HTML, 
just making the changes you need in the links.

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: off topic: pg_dump syntax for pythonanywhere

2016-02-02 Thread Alex Glaros
got it to work but doesn't seem to match pythonAnywhere documentation: 
https://help.pythonanywhere.com/pages/RegularPostgresBackups

for example, instead of "--name=" should be "--username=",  and filename has 
extra error-causing parm ("mydb")

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


[web2py] Re: How to move Postgres apps?

2016-02-02 Thread Alex Glaros
is the correct method to do a "Pack Custom" without the "databases", then 
send the rest to the new site, along with the Postgres dump file?

In other words would be sending

   1. just code and other stuff (controller, static, db.py, etc)  without 
   data, and
   2. pg_dump file separately
   3. then do the restore at new site


or do most people just pack the whole thing "Pack All" and send that along 
with the pg_dump file?

thanks,

Alex

Select Files to Package 
 /ES1 
   
   -  ABOUT
   -  LICENSE
   -  progress.log
   -  routes.example.py
   -  routes.py
   -  __init__.py
   -  __init__.pyc
   -  \cache 
   -  \controllers 
   -  \cron 
   -  \databases 
   -  \errors 
   -  \languages 
   -  \models 
   -  \modules 
   -  \private 
   -  \sessions 
   -  \static 
   -  \uploads 
   -  \views 

-- 
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: Need method for authenticating on multiple fields

2016-02-02 Thread Cody Landry
I'm experimenting with this approach and cannot find a way to allow users 
that belong to different tenants to have the same username.  Is this 
possible?

On Wednesday, January 27, 2016 at 6:22:09 PM UTC-5, Massimo Di Pierro wrote:
>
> You could use multi-tenancy
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Common-fields-and-multi-tenancy
>
> On Wednesday, 27 January 2016 17:05:57 UTC-6, Cody Landry wrote:
>>
>>
>> I'm working on a project using web2py and we'd like to use the built in 
>> auth, however we need to authenticate on a combination of company and 
>> username (ie the same username can be used with different companies) Adding 
>> the field to the auth forms is easy enough, but after looking at the auth 
>> source, I only see email and username as options for login with the 
>> exception of using a Centralized Authentication System (CAS). (not an 
>> option)
>>
>>
>> One idea we've had is presenting the company, username and password to 
>> the user and combining them into 'company/username' internally. We could 
>> possibly use virtual fields and the filter_in/filter_out methods to do this.
>>
>>
>> Is there a better/cleaner way of accomplishing 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.


[web2py] Re: scheduler -- tracking the last time

2016-02-02 Thread Dave S


On Sunday, January 31, 2016 at 4:13:07 AM UTC-8, Niphlod wrote:
>
>
>
> On Sunday, January 31, 2016 at 7:12:41 AM UTC+1, Dave S wrote:
>>
>>
>>
>> On Saturday, January 30, 2016 at 8:50:32 PM UTC-8, Niphlod wrote:
>>>
>>> scheduler_run is the only way to keep track of executions.
>>>
>>
>> And there is no session to carry a value over in, is there?
>>
>
> sorry, what ?
>

More precisely, there is a session, but it "expires" at the end of each 
run, so provides no persistance  between runs.

/dps
 

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