I am still learning Pylons (and Python) so thought I would do
everything the long way and go from scratch.

The story:
I am trying to make a basic "home-grown" authentication form/page. You
enter your login details and the database is queried to see if there
is any matching entries. If there is then I put a whole User object
into the session name 'REMOTE_USER'

The problem:
I certainly hope it's me being complete dumb so I can kick myself but
lets say I want to update my username for instance. I change the data
for the User object in the 'REMOTE_USER' session and then commit the
object to the database. (or at least I try that)

The moment I change the User object in the session and try committing
or reading the session again it gives ->
AttributeError: 'NoneType' object has no attribute 'commit'

A short short version of the code:
##############################
# Get user object from database    #
##############################
  user = "query database for user object"
  session['REMOTE_USER'] = user
  session.save()

##############################
# At this stage I go to update page #
##############################
"Change stuff on update page"

##############################
# Then click submit                      #
##############################
  a_user = session['REMOTE_USER']
  a_user.name = "Stuff" # from form
  a_user.etc = "Stuff" # from form
  dbsession = meta.Session.add(a_user)
  dbsession.commit()
  session['REMOTE_USER'] = a_user
  session.save()

Basically what I am trying to achieve is update the user object in the
database and the active session so that the user need not log back
into the site every time something changes. And somehow I think my
session is being broken when I do something to it. (So where has my
User object gone to if it is None)

Hopefully explaining this clearly enough otherwise I will post more
precise code.

- Pydon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to