Package: python-turbogears Version: 1.0.1-1 Severity: normal Hello,
I do tg-admin quickstart, tell it to use 'identity' and get a model with these classes: $ grep ^class model.py class Visit(SQLObject): class VisitIdentity(SQLObject): class Group(SQLObject): class User(SQLObject): class Permission(SQLObject): so far so good, but after customizing them a bit[1], I noticed weird behaviours in the toolbox. It turns out that the toolbox has a different, very personal idea of those tables: $ grep ^class turbogears/identity/soprovider.py class TG_VisitIdentity(SQLObject): class TG_Group(InheritableSQLObject): class TG_User(InheritableSQLObject): class TG_Permission(InheritableSQLObject): This causes all sorts of funny misbehaviours when using the toolbox and the application: tables created by the toolbox won't work with the application (they'd miss the extra custom fields), but the toolbox won't be able to edit the user tables created by the application (trying to add a user gives me "An error occurred: global name 'identity' is not defined"). Plus, there's no obvious way to recreate the database tables as "tg-admin sql create" will create broken user tables. Here's a work-around script for that: #!/usr/bin/python from os.path import * import sys, inspect import pkg_resources pkg_resources.require("TurboGears") import turbogears # first look on the command line for a desired config file, # if it's not on the command line, then # look for setup.py in this directory. If it's not there, this script is # probably installed if len(sys.argv) > 1: turbogears.update_config(configfile=sys.argv[1], modulename="pec.config") elif exists(join(dirname(__file__), "setup.py")): turbogears.update_config(configfile="dev.cfg", modulename="pec.config") else: turbogears.update_config(configfile="prod.cfg", modulename="pec.config") import MYNAMESPACE.model as pm import sqlobject from sqlobject.inheritance import InheritableSQLObject for item in pm.__dict__.values(): if inspect.isclass(item) and issubclass(item, sqlobject.SQLObject) \ and item != sqlobject.SQLObject and item != InheritableSQLObject: print "Recreating", item item.createTable(ifNotExists=True) Ciao, Enrico [1] I'm supposed to be able to do it. It even says it in the User class comment: class User(SQLObject): """ Reasonably basic User definition. Probably would want additional attributes. """ -- System Information: Debian Release: 4.0 APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.20.1enrico Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8) Versions of packages python-turbogears depends on: ii python 2.4.4-2 An interactive high-level object-o ii python-celementtree 1.0.5-8 Light-weight toolkit for XML proce ii python-cheetah 2.0~rc7-1 text-based template engine and Pyt ii python-cherrypy 2.2.1-3 Python web development framework ii python-configobj 4.3.2-2 a simple but powerful config file ii python-dispatch 0.5adev-5 Rule-based Dispatching and Generic ii python-elementtree 1.2.6-10 Light-weight toolkit for XML proce ii python-formencode 0.7-1 validation and form generation pyt ii python-kid 0.9.5-1 simple Pythonic template language ii python-nose 0.9.0-2 test discovery and running for Pyt ii python-paste 1.0.1-1 Tools for using a Web Server Gatew ii python-pastedeploy 1.0-1 Load, configure, and compose WSGI ii python-pastescript 1.0-1 serving web applications, creating ii python-setuptools 0.6c5-2 Python Distutils Enhancements ii python-simplejson 1.7-1 Simple, fast, extensible JSON enco ii python-sqlalchemy 0.3.1-2 SQL toolkit and Object Relational ii python-sqlobject 0.8.1-1 python module for SQLObject ii python-support 0.5.6 automated rebuilding support for p ii python-turbojson 0.9.5-1 TurboGears template plugin that su ii python-turbokid 0.9.9-1 TurboGears template plugin that su Versions of packages python-turbogears recommends: ii python-pysqlite2 2.3.2-2 python interface to SQLite 3 -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]