hi,
I made some progress. The problem looks to be in the area of writing
data to GAE. Until I do this I can register and login successful
(provided I tweak the code not to care about this populated data).
Once I call the populate() function below I can no longer register/
login.
class Salutations():
def __init__(self, db, T):
(self.db, self.T) = (db, T)
def populate( self):
'''
Envoy defines a short list of salutations
Salutations help build a relationship with a client
'''
T = self.T
salutations= (
(10, T('Mr')),
(20, T('Ms')),
(30, T('Mrs')),
(40, T('Miss')),
(50, T('Dr')),
(60, T('Prof.')) )
for salu in salutations:
dbsals = self.db
(self.db.salutations.salutation_order==salu[0]).select()
if not dbsals:
self.db.salutations.insert(salutation_order=salu[0],
salutation=unicode(salu[1]))
else:
dbsals[0].update_record( salutation_order=salu[0],
salutation=unicode(salu[1]))
return( len(salutations))
I tried changing the unicode() calls to str() but it made no material
difference.
Am I making a basic error in populate() ?
On Jan 16, 12:29 pm, Carl <[email protected]> wrote:
> Additional information...
>
> In thinking that perhaps GAE hadn't delete *all* my data and hence had
> hidden corruption I looked at an earlier version of my app.
>
> GAE allows me to run different versions of an app against the same
> database (big table data).
>
> I ran my previous version that is built on Web2py 1.67.2 and it
> registers/logins successfully.
> So although our issue is subtle at least it's on our side and I don't
> need to try talking to google staff :)
>
> On Jan 15, 9:20 pm, Carl <[email protected]> wrote:
>
>
>
> > I had deleted GAE's tables before contacting you; I've just deleted them
> > again but I get the same behaviour. There is perhaps a subtle difference
> > between dev_appserver and the real-deal GAE.
>
> > I'll put together a stand-alone app tomorrow.
>
> > 2010/1/15 mdipierro <[email protected]>
>
> > > One more test. What bothers me is that is works on dev_appserver but
> > > not when deployed. There must be some corrupted data in the database.
> > > Is it an option for you to delete all data on GAE?
>
> > > On Jan 15, 12:22 pm, Carl <[email protected]> wrote:
> > > > I've taken out the orderby clauses but the login failure still happens
> > > (I've
> > > > had those clauses in for earlier versions of web2py but it was worth
> > > > looking).
>
> > > > Perhaps these two statements (default.py in user() ) are the issue on
> > > GAE?
> > > > db.auth_user.billing_country.requires = IS_NULL_OR(IS_NOT_EMPTY())
> > > > db.auth_user.country.requires = IS_NULL_OR(IS_NOT_EMPTY())
>
> > > > I am using a custom form which doesn't not display these two fields so
> > > I've
> > > > added these two statements to keep the registration process happy which
> > > > would otherwise want values from the user for them.
>
> > > > in db.py both fields have the clause:
> > > > requires=IS_NULL_OR(IS_IN_DB(db,db.iso3166.id,'%(country)s')))
>
> > > > Does that aim/explanation make sense to you? The code is quite old but
> > > > perhaps Web2py is translating to GAE in a subtley different way? If I
> > > remove
> > > > both statements then registration fails so I can't simply remove them to
> > > > test if the app works on GAE.
>
> > > > Is there an alternative approach I could take? At least to test further?
>
> > > > 2010/1/15 mdipierro <[email protected]>
>
> > > > > I see a lot of orderby in those validators that create problems.
>
> > > > > I think the problem is there.
>
> > > > > Try remove the orderby and see if the error goes away.
>
> > > > > If it does there are two options:
> > > > > 1) you need an index
> > > > > 2) the query is somehow invalid on GAE
>
> > > > > Massimo
>
> > > > > On Jan 15, 11:17 am, Carl <[email protected]> wrote:
> > > > > > I made the changes you listed but the failed login still persists
> > > (you
> > > > > > probably expected it to but I was forever hopeful! :)
>
> > > > > > I'll see if I can create a small app that replicates the issue and
> > > send
> > > > > it
> > > > > > to you.
> > > > > > thanks for your time.
>
> > > > > > 2010/1/15 mdipierro <[email protected]>
>
> > > > > > > I do not know why you experience the behavior that you do but
> > > > > > > there
> > > > > > > are some errors in those commented lines:
>
> > > > > > > 1)
>
> > > > > > > #cdrdb.Field('country', db.iso3166, requires=IS_NULL_OR
> > > > > > > (IS_INT_IN_RANGE(0, 1e100))),
>
> > > > > > > should be
>
> > > > > > > cdrdb.Field('country', db.iso3166, requires=IS_IN_DB
> > > > > > > (db,db.iso3166.id,'%(country)s'))
>
> > > > > > > 2)
>
> > > > > > > #cdrdb.Field('agent_salutation', db.salutations,
> > > > > > > requires=IS_NULL_OR(IS_INT_IN_RANGE(0, 1e100))),
>
> > > > > > > should be
>
> > > > > > > cdrdb.Field('agent_salutation', db.salutations,
> > > > > > > requires=IS_NULL_OR(db,db.salutations.id,'%(salutation)s'))
>
> > > > > > > sure you want a reference for this and not a IS_IN_SET?
>
> > > > > > > 3)
>
> > > > > > > #cdrdb.Field('agent_country', db.iso3166, label='Country',
> > > > > > > requires=IS_NULL_OR(IS_INT_IN_RANGE(0, 1e100))),
>
> > > > > > > should be
>
> > > > > > > cdrdb.Field('agent_country', db.iso3166, label='Country',
> > > > > > > requires=IS_NULL_OR(IS_IN_DB(db,db.iso3166.id,'%(country)s'))
>
> > > > > > > 4)
>
> > > > > > > #cdrdb.Field('billing_country', db.iso3166, label='Billing
> > > > > > > country', requires=IS_NULL_OR(IS_INT_IN_RANGE(0, 1e100)))
>
> > > > > > > should be
>
> > > > > > > #cdrdb.Field('billing_country', db.iso3166, label='Billing
> > > > > > > country', requires=IS_NULL_OR(IS_IN_DB(db,db.iso3166.id
> > > ,'%(country)
> > > > > > > s'))
>
> > > > > > > 5)
>
> > > > > > > #cdrdb.auth_user.country.requires = IS_NULL_OR(IS_NOT_EMPTY())
>
> > > > > > > I am not so sure what you need here.
>
> > > > > > > Massimo
>
> > > > > > > On Jan 15, 10:38 am, Carl <[email protected]> wrote:
> > > > > > > > hi
>
> > > > > > > > I gotten down to the area that's tripping up.
>
> > > > > > > > My app will login correctly if I comment out the following
> > > > > > > > lines;
> > > > > > > > I've put those commented lines in context below...
>
> > > > > > > > FILE: models/dp.py
> > > > > > > > db.define_table('iso3166',
> > > > > > > > SQLField('country', 'string', length=128,
> > > > > > > > required=True),
> > > > > > > > SQLField('country_iso', 'integer',
> > > required=True),
> > > > > > > > SQLField('country_order', 'integer',
> > > required=True))
>
> > > > > > > > db.define_table('salutations',
> > > > > > > > SQLField('salutation', 'string', length=128,
> > > > > > > > required=True),
> > > > > > > > SQLField('salutation_order', 'integer',
> > > > > > > > required=True))
>
> > > > > > > > auth.settings.table_user = db.define_table(
> > > > > > > > auth.settings.table_user_name,
> > > > > > > > db.Field('email', 'string', length=254, unique=True,
> > > > > notnull=True,
> > > > > > > > required=True,
> > > > > > > > requires = [IS_LOWER(),
> > > > > > > > IS_EMAIL(),
> > > > > > > > IS_NOT_IN_DB
> > > > > > > > (db,'%s.email'%auth.settings.table_user_name)]),
> > > > > > > > db.Field('password', 'password', length=512, readable=False,
> > > > > > > > notnull=True, required=True, label='Password',
> > > > > > > > requires = [IS_NOT_EMPTY(),
>
> > > CRYPT(key='12angrymen12apollo57envoy')]),
> > > > > > > > db.Field('registration_key', length=128, writable=False,
> > > > > > > > readable=False, default=''),
> > > > > > > > db.Field('first_name', 'string', length=128),
> > > > > > > > db.Field('last_name', 'string', length=128),
> > > > > > > > db.Field('job_title', 'string', length=128),
> > > > > > > > db.Field('postcode', 'string', length=12),
> > > > > > > > #cdrdb.Field('country', db.iso3166, requires=IS_NULL_OR
> > > > > > > > (IS_INT_IN_RANGE(0, 1e100))),
> > > > > > > > #cdrdb.Field('agent_salutation', db.salutations,
> > > > > > > > requires=IS_NULL_OR(IS_INT_IN_RANGE(0, 1e100))),
> > > > > > > > db.Field('agent_name', 'string', length=128, label='Company
> > > > > > > > name'),
> > > > > > > > db.Field('agent_address', 'text', label='Company address'),
> > > > > > > > db.Field('agent_postcode', 'string', length=12,
> > > label='Company
> > > > > > > > postcode'),
> > > > > > > > #cdrdb.Field('agent_country', db.iso3166, label='Country',
> > > > > > > > requires=IS_NULL_OR(IS_INT_IN_RANGE(0, 1e100))),
> > > > > > > > db.Field('billing_name', 'string', length=128,
> > > > > > > > label='Billing
> > > > > > > > company name'),
> > > > > > > > db.Field('billing_address', 'text', label='Billing
> > > > > > > > address'),
> > > > > > > > db.Field('billing_postcode', 'string', length=12,
> > > label='Billing
> > > > > > > > postcode'),
> > > > > > > > #cdrdb.Field('billing_country', db.iso3166, label='Billing
> > > > > > > > country', requires=IS_NULL_OR(IS_INT_IN_RANGE(0, 1e100)))
> > > > > > > > )
>
> > > > > > > > FILE: controllers/default.py
>
> > > > > > > > def user():
> > > > > > > > auth.settings.expiration = 14 * 24 * 60 * 60 # 14 day
> > > sessions
> > > > > > > > auth.settings.register_onaccept = lambda form:
> > > > > registerAgent(form)
> > > > > > > > auth.settings.register_next = URL(r=request,f='account')
> > > > > > > > auth.settings.login_next = URL(r=request,f='account')
>
> > > > > > > > #cdrdb.auth_user.agent_salutation.requires = IS_IN_DB(db,
> > > > > > > > db.salutations.id, '%(salutation)s',
> > > > > > > > orderby=db.salutations.salutation_order)
> > > > > > > > #cdrdb.auth_user.agent_country.requires = IS_IN_DB(db,
> > > > > > > > db.iso3166.id, '%(country)s', orderby=db.iso3166.country_order)
>
> > > > > > > > #cdrdb.auth_user.billing_country.requires =
> > > > > IS_NULL_OR(IS_NOT_EMPTY
> > > > > > > > ())
> > > > > > > > #cdrdb.auth_user.country.requires =
> > > IS_NULL_OR(IS_NOT_EMPTY())
>
> > > > > > > > return dict(form=auth())
>
> > > > > > > > user.html
> > > > > > > > NOTE: I've NOT had to comment out any lines
> > > > > > > > {{extend 'layout.html'}}
> > > > > > > > <h2>{{=request.args(0).replace('_',' ').capitalize()}}</h2>
> > > > > > > > <p>Test 7</p>
> > > > > > > > {{if request.args(0)=='login':}}
> > > > > > > > {{=form}}
> > > > > > > > <a href="{{=URL(r=request,args='register')}}">register</a><br />
> > > > > > > > <a href="{{=URL(r=request,args='retrieve_password')}}">lost
> > > > > password</
> > > > > > > > a><br />
> > > > > > > > {{elif request.args(0)=='register':}}
> > > > > > > > {{=form.custom.begin}}
> > > > > > > > <table>
> > > > > > > > <tr id="auth_user_email__row"><td><label for="auth_user_email"
> > > > > > > > id="auth_user_email__label">Email:</label></td><td>
> > > > > > > > {{=form.custom.widget.email}}</td><td></td></tr>
> > > > > > > > <tr id="auth_user_password__row"><td><label
> > > for="auth_user_password"
> > > > > > > > id="auth_user_password__label">Password:</label></td><td>
> > > > > > > > {{=form.custom.widget.password}}</td><td></td></tr>
> > > > > > > > <tr class="auth_user_password_two__row" ><td><label
> > > > > for="password_two"
>
> ...
>
> read more »
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.