did you run (tg-admin update) #make a backup first :)
whats the output of tg-admin sql status and tg-admin sql list
also what you have in \sqlobject-history
you may have some stuff left from the old mode.
On 5/17/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I am moving a (formerly!) working project from .9a4 to .9a5 . I also
see now that .9a6 is out... Anyway, I thought I had made all the
changes neccesary to accommodate the new Identity behavior, but it
seems that I am wrong. I have:
-dropped the old database
-created a new one based on my new model
-Used catwalk to create a new user (Incidentally, catwalk still shows
the TG_* tables, but I can't do anything with them. Is this indicative
of a problem, or does Catwalk still have problems with relationships?)
-When I attempt to login using the new user, it silently fails and
bounces me back to the login page.
Here are all the relevant parts of my project that I could think of.
Also note that the "Group" and "Visit Identity" portions of model.py
were lifted directly out of another quickstarted project. :
model.py:
class User(SQLObject):
"""
Reasonably basic User definition. Probably would want additional
attributes.
"""
user_name = UnicodeCol( length=16, alternateID=True,
alternateMethodName="by_user_name" )
email_address = UnicodeCol( length=255, alternateID=True,
alternateMethodName="by_email_address" )
display_name = UnicodeCol( length=255 )
password = UnicodeCol( length=40 )
created = DateTimeCol( default=datetime.now )
phone = StringCol(alternateID=True,length=100)
title = ForeignKey("UserTitles")
assessments = MultipleJoin("Assessment")
resources = MultipleJoin("Resource")
units = MultipleJoin("Unit")
courses = MultipleJoin("Course")
# groups this user belongs to
groups = RelatedJoin( "Group", intermediateTable="user_group",
joinColumn="user_id", otherColumn="group_id" )
def _get_permissions( self ):
perms = set()
for g in self.groups:
perms = perms | set(g.permissions)
return perms
def _set_password( self, cleartext_password ):
"Runs cleartext_password through the hash algorithm before
saving."
hash = identity.encrypt_password(cleartext_password)
self._SO_set_password(hash)
def set_password_raw( self, password ):
"Saves the password as-is to the database."
self._SO_set_password(password)
class UserTitles(SQLObject):
title = StringCol()
users = MultipleJoin("User")
controllers.py:
@expose(template=".templates.login")
def login(self, forward_url=None, previous_url=None, *args, **kw):
if not identity.current.anonymous and
identity.was_login_attempted():
raise redirect(forward_url)
title="CMAP Login"
forward_url=None
previous_url= cherrypy.request.path
if identity.was_login_attempted():
msg=_("The credentials you supplied were not correct or "
"did not grant access to this resource.")
elif identity.get_identity_errors():
msg=_("You must provide your credentials before accessing "
"this resource.")
else:
msg=_("Please log in.")
forward_url= cherrypy.request.headers.get("Referer", "/")
cherrypy.response.status=403
return dict(message=msg, previous_url=previous_url,
logging_in=True,
original_parameters= cherrypy.request.params,
forward_url=forward_url,title=title,
now=time.strftime("%a %b %d, %I:%M %p"))
@expose()
def logout(self):
identity.current.logout()
raise redirect("/")
login.kid:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://purl.org/kid/ns#" py:extends="' master.kid'">
<head>
</head>
<body > <div id="loginBox">
<h1>${title}</h1>
<p>${message}</p>
<form name="login" action="" method="POST">
<table>
<tr>
<td class="label">
<label for="" Name:</label>
</td>
<td class="field">
<input type="text" id="user_name"
name="user_name"/>
</td>
</tr>
<tr>
<td class="label">
<label for=""
</td>
<td class="field">
<input type="password" id="password"
name="password"/>
</td>
</tr>
<tr>
<td colspan="2" class="buttons">
<input type="submit" value="Login"/>
</td>
</tr>
</table>
<input py:if="forward_url" type="hidden" name="forward_url"
value="${forward_url}"/>
<input py:for="" in original_parameters.items()"
type="hidden" name="${name}" value="${value}"/>
</form>
</div>
</body>
</html>
Any suggestions would be greatly appreciated.
-Best Regards-
-Quentin Hartman-
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

