Hi,
This error occurs on Quickstart with SQLObject based identity also.
It would appear Quickstart is broken
Regards
Tom
[EMAIL PROTECTED] test]$ tg-admin quickstart -i
Enter project name: sobugtest
Enter package name [sobugtest]:
Selected and implied templates:
TurboGears#tgbase tg base template
TurboGears#turbogears web framework
Variables:
egg: sobugtest
elixir: False
identity: sqlobject
package: sobugtest
project: sobugtest
sqlalchemy: False
Creating template tgbase
Creating directory ./sobugtest
Recursing into +einame+.egg-info
Creating ./sobugtest/sobugtest.egg-info/
Copying PKG-INFO to ./sobugtest/sobugtest.egg-info/PKG-INFO
Copying paster_plugins.txt to ./sobugtest/sobugtest.egg-info/
paster_plugins.txt
Copying sqlobject.txt_tmpl to ./sobugtest/sobugtest.egg-info/
sqlobject.txt
Recursing into +package+
Creating ./sobugtest/sobugtest/
Copying __init__.py_tmpl to ./sobugtest/sobugtest/__init__.py
Copying release.py_tmpl to ./sobugtest/sobugtest/release.py
Recursing into static
Creating ./sobugtest/sobugtest/static/
Recursing into css
Creating ./sobugtest/sobugtest/static/css/
Copying empty to ./sobugtest/sobugtest/static/css/empty
Recursing into images
Creating ./sobugtest/sobugtest/static/images/
Copying favicon.ico to ./sobugtest/sobugtest/static/images/
favicon.ico
Copying tg_under_the_hood.png to ./sobugtest/sobugtest/static/
images/tg_under_the_hood.png
Copying under_the_hood_blue.png to ./sobugtest/sobugtest/
static/images/under_the_hood_blue.png
Recursing into javascript
Creating ./sobugtest/sobugtest/static/javascript/
Copying empty to ./sobugtest/sobugtest/static/javascript/empty
Recursing into templates
Creating ./sobugtest/sobugtest/templates/
Copying __init__.py_tmpl to ./sobugtest/sobugtest/templates/
__init__.py
Creating template turbogears
Recursing into +package+
Recursing into config
Creating ./sobugtest/sobugtest/config/
/usr/local/lib/python2.4/site-packages/Cheetah-1.0-py2.4-linux-
x86_64.egg/Cheetah/Compiler.py:1112: UserWarning: You supplied an
empty string for the source!
warnings.warn("You supplied an empty string for the source!", )
Copying __init__.py_tmpl to ./sobugtest/sobugtest/config/
__init__.py
Copying app.cfg_tmpl to ./sobugtest/sobugtest/config/app.cfg
Copying log.cfg_tmpl to ./sobugtest/sobugtest/config/log.cfg
Copying controllers.py_tmpl to ./sobugtest/sobugtest/
controllers.py
Copying json.py_tmpl to ./sobugtest/sobugtest/json.py
Cheetah was trying to execute the following code but Python found a
syntax error in it:
def respond(self,
trans=None,
VFFSL=valueFromFrameOrSearchList,
VFN=valueForName):
"""
This is the main method generated by Cheetah
"""
if not trans: trans = self.transaction # is None unless
self.awake() was called
if not trans:
trans = DummyTransaction()
dummyTrans = True
else: dummyTrans = False
write = trans.response().write
SL = self._searchList
globalSetVars = self._globalSetVars
filter = self._currentFilter
########################################
## START - generated method body
if VFFSL(SL,"identity",True) != "none":
write('from datetime import datetime\n')
if VFFSL(SL,"sqlalchemy",True) != "True":
write('from turbogears.database import PackageHub\nfrom
sqlobject import *\n')
else:
write('from sqlalchemy import *\nfrom turbogears.database
import metadata, session\n')
if VFFSL(SL,"elixir",True) != "True":
write('from sqlalchemy.ext.assignmapper import
assign_mapper\n')
else:
write('''from elixir import Unicode,
DateTime, String, Integer
from elixir import Entity, has_field, using_options
from elixir import has_many, belongs_to,
has_and_belongs_to_many
''')
if VFFSL(SL,"identity",True) != "none":
write('from turbogears import identity\n')
write('\n')
if VFFSL(SL,"sqlalchemy",True) != "True":
write("hub = PackageHub('")
__v = VFFSL(SL,"package",True)
if __v is not None: write(filter(__v, rawExpr='$
{package}')) # from line 23, col 19.
write("')\n__connection__ = hub\n")
write('\n')
if VFFSL(SL,"sqlalchemy",True)!="True":
write('# class YourDataClass(SQLObject):\n# pass\n')
write(' \n')
if VFFSL(SL,"identity",True)=="sqlobject":
write('''# identity models.
class Visit(SQLObject):
"""
A visit to your site
"""
class sqlmeta:
table = 'visit'
visit_key = StringCol(length=40, alternateID=True,
alternateMethodName='by_visit_key')
created = DateTimeCol(default=datetime.now)
expiry = DateTimeCol()
def lookup_visit(cls, visit_key):
try:
return cls.by_visit_key(visit_key)
except SQLObjectNotFound:
return None
lookup_visit = classmethod(lookup_visit)
class VisitIdentity(SQLObject):
"""
A Visit that is link to a User object
"""
visit_key = StringCol(length=40, alternateID=True,
alternateMethodName='by_visit_key')
user_id = IntCol()
class Group(SQLObject):
"""
An ultra-simple group definition.
"""
# names like "Group", "Order" and "User" are reserved words in SQL
# so we set the name to something safe for SQL
class sqlmeta:
table = 'tg_group'
group_name = UnicodeCol(length=16, alternateID=True,
alternateMethodName='by_group_name')
display_name = UnicodeCol(length=255)
created = DateTimeCol(default=datetime.now)
# collection of all users belonging to this group
users = RelatedJoin('User', intermediateTable='user_group',
joinColumn='group_id', otherColumn='user_id')
# collection of all permissions for this group
permissions = RelatedJoin('Permission', joinColumn='group_id',
intermediateTable='group_permission',
otherColumn='permission_id')
class User(SQLObject):
"""
Reasonably basic User definition.
Probably would want additional attributes.
"""
# names like "Group", "Order" and "User" are reserved words in SQL
# so we set the name to something safe for SQL
class sqlmeta:
table = 'tg_user'
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)
# 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."
password_hash = identity.encrypt_password(cleartext_password)
self._SO_set_password(password_hash)
def set_password_raw(self, password):
"Saves the password as-is to the database."
self._SO_set_password(password)
class Permission(SQLObject):
"""
A relationship that determines what each Group can do
"""
permission_name = UnicodeCol(length=16, alternateID=True,
alternateMethodName='by_permission_name')
description = UnicodeCol(length=255)
groups = RelatedJoin('Group',
intermediateTable='group_permission',
joinColumn='permission_id',
otherColumn='group_id')
''')
elif VFFSL(SL,"identity",True)=="sqlalchemy":
if VFFSL(SL,"elixir",True) != "True":
write('''# The identity schema.
visits_table = Table('visit', metadata,
Column('visit_key', String(40), primary_key=True),
Column('created', DateTime, nullable=False, default=datetime.now),
Column('expiry', DateTime)
)
visit_identity_table = Table('visit_identity', metadata,
Column('visit_key', String(40), primary_key=True),
Column('user_id', Integer, ForeignKey('tg_user.user_id'),
index=True)
)
groups_table = Table('tg_group', metadata,
Column('group_id', Integer, primary_key=True),
Column('group_name', Unicode(16), unique=True),
Column('display_name', Unicode(255)),
Column('created', DateTime, default=datetime.now)
)
users_table = Table('tg_user', metadata,
Column('user_id', Integer, primary_key=True),
Column('user_name', Unicode(16), unique=True),
Column('email_address', Unicode(255), unique=True),
Column('display_name', Unicode(255)),
Column('password', Unicode(40)),
Column('created', DateTime, default=datetime.now)
)
permissions_table = Table('permission', metadata,
Column('permission_id', Integer, primary_key=True),
Column('permission_name', Unicode(16), unique=True),
Column('description', Unicode(255))
)
user_group_table = Table('user_group', metadata,
Column('user_id', Integer, ForeignKey('tg_user.user_id',
onupdate="CASCADE", ondelete="CASCADE")),
Column('group_id', Integer, ForeignKey('tg_group.group_id',
onupdate="CASCADE", ondelete="CASCADE"))
)
group_permission_table = Table('group_permission', metadata,
Column('group_id', Integer, ForeignKey('tg_group.group_id',
onupdate="CASCADE", ondelete="CASCADE")),
Column('permission_id', Integer,
ForeignKey('permission.permission_id',
onupdate="CASCADE", ondelete="CASCADE"))
)
#
# identity model
#
class Visit(object):
"""
A visit to your site
"""
def lookup_visit(cls, visit_key):
return Visit.get(visit_key)
lookup_visit = classmethod(lookup_visit)
class VisitIdentity(object):
"""
A Visit that is link to a User object
"""
pass
class Group(object):
"""
An ultra-simple group definition.
"""
pass
class User(object):
"""
Reasonably basic User definition. Probably would want additional
attributes.
"""
def permissions(self):
perms = set()
for g in self.groups:
perms = perms | set(g.permissions)
return perms
permissions = property(permissions)
def by_email_address(klass, email):
"""
A class method that can be used to search users
based on their email addresses since it is unique.
"""
return klass.get_by(users_table.c.email_address==email)
by_email_address = classmethod(by_email_address)
def by_user_name(klass, username):
"""
A class method that permits to search users
based on their user_name attribute.
"""
return klass.get_by(users_table.c.user_name==username)
by_user_name = classmethod(by_user_name)
def _set_password(self, password):
''''
encrypts password on the fly using the encryption
algo defined in the configuration
''''
self._password = identity.encrypt_password(password)
def _get_password(self):
''''
returns password
''''
return self._password
password = property(_get_password, _set_password)
class Permission(object):
"""
A relationship that determines what each Group can do
"""
pass
def assign(*args, **kw):
"""Map tables to objects with knowledge about the session
context."""
return assign_mapper(session.context, *args, **kw)
assign(Visit, visits_table)
assign(VisitIdentity, visit_identity_table,
properties=dict(users=relation(User,
backref='visit_identity')))
assign(User, users_table,
properties=dict(_password=users_table.c.password))
assign(Group, groups_table,
properties=dict(users=relation(User,
secondary=user_group_table, backref='groups')))
assign(Permission, permissions_table,
properties=dict(groups=relation(Group,
secondary=group_permission_table,
backref='permissions')))
''')
else:
write('''#
# identity model
#
class Visit(Entity):
has_field('visit_key', String(40), primary_key=True)
has_field('created', DateTime, nullable=False,
default=datetime.now)
has_field('expiry', DateTime)
using_options(tablename='visit')
@classmethod
def lookup_visit(cls, visit_key):
return Visit.get(visit_key)
class VisitIdentity(Entity):
has_field('visit_key', String(40), primary_key=True)
belongs_to('user', of_kind='User', colname='user_id',
use_alter=True)
using_options(tablename='visit_identity')
class Group(Entity):
has_field('group_id', Integer, primary_key=True)
has_field('group_name', Unicode(16), unique=True)
has_field('display_name', Unicode(255))
has_field('created', DateTime, default=datetime.now)
has_and_belongs_to_many('users', of_kind='User', inverse='groups')
has_and_belongs_to_many('permissions', of_kind='Permission',
inverse='groups')
using_options(tablename='tg_group')
class User(Entity):
has_field('user_id', Integer, primary_key=True)
has_field('user_name', Unicode(16), unique=True)
has_field('email_address', Unicode(255), unique=True)
has_field('display_name', Unicode(255))
has_field('password', Unicode(40))
has_field('created', DateTime, default=datetime.now)
has_and_belongs_to_many('groups', of_kind='Group',
inverse='users')
using_options(tablename='tg_user')
@property
def permissions(self):
perms = set()
for g in self.groups:
perms = perms | set(g.permissions)
return perms
class Permission(Entity):
has_field('permission_id', Integer, primary_key=True)
has_field('permission_name', Unicode(16), unique=True)
has_field('description', Unicode(255))
has_and_belongs_to_many('groups', of_kind='Group',
inverse='permissions')
using_options(tablename='permission')
''')
########################################
## END - generated method body
return dummyTrans and trans.response().getvalue() or ""
Traceback (most recent call last):
File "/usr/local/bin/tg-admin", line 7, in ?
sys.exit(
File "/usr/local/lib/python2.4/site-packages/TurboGears-1.0.3.2-
py2.4.egg/turbogears/command/base.py", line 389, in main
command.run()
File "/usr/local/lib/python2.4/site-packages/TurboGears-1.0.3.2-
py2.4.egg/turbogears/command/quickstart.py", line 203, in run
command.run(cmd_args)
File "/usr/local/lib/python2.4/site-packages/PasteScript-0.9.8-
py2.4.egg/paste/script/command.py", line 210, in run
result = self.command()
File "/usr/local/lib/python2.4/site-packages/PasteScript-0.9.8-
py2.4.egg/paste/script/create_distro.py", line 124, in command
self.create_template(
File "/usr/local/lib/python2.4/site-packages/PasteScript-0.9.8-
py2.4.egg/paste/script/create_distro.py", line 157, in create_template
template.run(self, output_dir, vars)
File "/usr/local/lib/python2.4/site-packages/TurboGears-1.0.3.2-
py2.4.egg/turbogears/command/quickstart.py", line 33, in run
super(TGTemplate, self).run(command, output_dirs, vars)
File "/usr/local/lib/python2.4/site-packages/PasteScript-0.9.8-
py2.4.egg/paste/script/templates.py", line 48, in run
self.write_files(command, output_dir, vars)
File "/usr/local/lib/python2.4/site-packages/PasteScript-0.9.8-
py2.4.egg/paste/script/templates.py", line 116, in write_files
use_cheetah=self.use_cheetah)
File "/usr/local/lib/python2.4/site-packages/PasteScript-0.9.8-
py2.4.egg/paste/script/copydir.py", line 63, in copy_dir
svn_add=svn_add)
File "/usr/local/lib/python2.4/site-packages/PasteScript-0.9.8-
py2.4.egg/paste/script/copydir.py", line 70, in copy_dir
use_cheetah=use_cheetah)
File "/usr/local/lib/python2.4/site-packages/PasteScript-0.9.8-
py2.4.egg/paste/script/copydir.py", line 223, in substitute_content
searchList=[vars])
File "/usr/local/lib/python2.4/site-packages/Cheetah-1.0-py2.4-linux-
x86_64.egg/Cheetah/Template.py", line 167, in __init__
self.compile(source, file)
File "/usr/local/lib/python2.4/site-packages/Cheetah-1.0-py2.4-linux-
x86_64.egg/Cheetah/Template.py", line 235, in compile
compiler.compile()
File "/usr/local/lib/python2.4/site-packages/Cheetah-1.0-py2.4-linux-
x86_64.egg/Cheetah/Compiler.py", line 1255, in compile
self._swallowClassCompiler(self._popActiveClassCompiler())
File "/usr/local/lib/python2.4/site-packages/Cheetah-1.0-py2.4-linux-
x86_64.egg/Cheetah/Compiler.py", line 1281, in _swallowClassCompiler
classCompiler.cleanupState()
File "/usr/local/lib/python2.4/site-packages/Cheetah-1.0-py2.4-linux-
x86_64.egg/Cheetah/Compiler.py", line 780, in cleanupState
self._swallowMethodCompiler(methCompiler)
File "/usr/local/lib/python2.4/site-packages/Cheetah-1.0-py2.4-linux-
x86_64.egg/Cheetah/Compiler.py", line 874, in _swallowMethodCompiler
self._templateObj._bindCompiledMethod(methodCompiler)
File "/usr/local/lib/python2.4/site-packages/Cheetah-1.0-py2.4-linux-
x86_64.egg/Cheetah/Template.py", line 355, in _bindCompiledMethod
exec genCode # in this namespace!!
File "<string>", line 258
''''
^
SyntaxError: EOL while scanning single-quoted string
[EMAIL PROTECTED] test]$
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---