Hi,
got a perfectly working project (on MacOSX).
If I try running it on Ubuntu 6.04 with python 2.4.4 I get the following
error, right after logging in:
Page handler: <bound method Root.index of <ntime.controllers.Root object
at 0xb73e3bec>>
Traceback (most recent call last):
File
"/usr/local/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py",
line 105, in _run
self.main()
File
"/usr/local/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py",
line 254, in main
body = page_handler(*virtual_path, **self.params)
File "<string>", line 3, in index
File
"/usr/local/lib/python2.4/site-packages/TurboGears-1.0.4b2-py2.4.egg/turbogears/controllers.py",
line 342, in expose
output = database.run_with_transaction(
File "<string>", line 5, in run_with_transaction
File
"/usr/local/lib/python2.4/site-packages/TurboGears-1.0.4b2-py2.4.egg/turbogears/database.py",
line 316, in so_rwt
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File
"/usr/local/lib/python2.4/site-packages/TurboGears-1.0.4b2-py2.4.egg/turbogears/controllers.py",
line 359, in <lambda>
mapping, fragment, args, kw)))
File
"/usr/local/lib/python2.4/site-packages/TurboGears-1.0.4b2-py2.4.egg/turbogears/controllers.py",
line 386, in _execute_func
output = errorhandling.try_call(func, *args, **kw)
File
"/usr/local/lib/python2.4/site-packages/TurboGears-1.0.4b2-py2.4.egg/turbogears/errorhandling.py",
line 72, in try_call
return func(self, *args, **kw)
File "<string>", line 3, in index
File
"/usr/local/lib/python2.4/site-packages/TurboGears-1.0.4b2-py2.4.egg/turbogears/identity/conditions.py",
line 235, in require
return fn(self, *args, **kwargs)
File "/home/nr/nTime2/ntime/controllers.py", line 43, in index
File
"/usr/local/lib/python2.4/site-packages/SQLObject-0.9.2-py2.4.egg/sqlobject/dbconnection.py",
line 840, in queryAll
return self._dbConnection._queryAll(self._connection, s)
File
"/usr/local/lib/python2.4/site-packages/SQLObject-0.9.2-py2.4.egg/sqlobject/dbconnection.py",
line 348, in _queryAll
self._executeRetry(conn, c, s)
File
"/usr/local/lib/python2.4/site-packages/SQLObject-0.9.2-py2.4.egg/sqlobject/mysql/mysqlconnection.py",
line 135, in _executeRetry
raise ProgrammingError(ErrorMessage(e))
ProgrammingError: Table 'ntime.Worktime' doesn't exist
phpmyadmin shows me the "worktime" - Table (but with small 'W'), and it
works fine on MacOSX
anyone any idea?
have a nice weekend,
Nicolas
my prod.cnf:
[global]
# This is where all of your settings go for your development environment
# Settings that are the same for both development and production
# (such as template engine, encodings, etc.) all go in
# ntime/config/app.cfg
# DATABASE
# pick the form for your database
# sqlobject.dburi="postgres://[EMAIL PROTECTED]/databasename"
# sqlobject.dburi="mysql://username:[EMAIL PROTECTED]:port/databasename"
# sqlobject.dburi="sqlite:///file_name_and_path"
sqlobject.dburi="mysql://ntime:[EMAIL PROTECTED]:3306/ntime"
#sqlobject.dburi="sqlite://%(current_dir_uri)s/devdata.sqlite"
# if you are using a database or table type without transactions
# (MySQL default, for example), you should turn off transactions
# by prepending notrans_ on the uri
#
sqlobject.dburi="notrans_mysql://username:[EMAIL PROTECTED]:port/databasename"
# for Windows users, sqlite URIs look like:
# sqlobject.dburi="sqlite:///drive_letter:/path/to/file"
# SERVER
# Some server parameters that you may want to tweak
# server.socket_port=8080
# Enable the debug output at the end on pages.
# log_debug_info_filter.on = False
server.environment="production"
autoreload.package="ntime"
# Auto-Reload after code modification
# autoreload.on = True
# Set to True if you'd like to abort execution if a controller gets an
# unexpected parameter. False by default
tg.strict_parameters = True
# LOGGING
# Logging configuration generally follows the style of the standard
# Python logging module configuration. Note that when specifying
# log format messages, you need to use *() for formatting variables.
# Deployment independent log configuration is in ntime/config/log.cfg
[logging]
[[loggers]]
[[[ntime]]]
level='DEBUG'
qualname='ntime'
handlers=['debug_out']
[[[allinfo]]]
level='INFO'
handlers=['debug_out']
[[[access]]]
level='INFO'
qualname='turbogears.access'
handlers=['access_out']
propagate=0
my model.py:
from datetime import datetime
from turbogears.database import PackageHub
from sqlobject import *
from turbogears import identity
hub = PackageHub('ntime')
__connection__ = hub
# class YourDataClass(SQLObject):
# pass
class Worktime(SQLObject):
start = DateTimeCol()
end = DateTimeCol( default=None )
startdate = DateCol()
user = ForeignKey("User")
# 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)
worktimes = SQLMultipleJoin("Worktime", joinColumn = 'user_id')
# 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')
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss