Greetings,

Below are the model.py, the archivemodel.py, the __init__.py and the dev.cfg

Here are the versions:

>>> import sqlalchemy
>>> sqlalchemy.__version__
'0.7.2'
>>> import elixir
>>> elixir.__version__
'0.7.1'


--- dev.cfg --

[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
# dreduce/config/app.cfg

# DATABASE

# driver://username:password@host:port/database

# pick the form for your database
# sqlalchemy.dburi="mysql://username:password@hostname:port/databasename"
# sqlalchemy.dburi="sqlite://%(current_dir_uri)s/devdata.sqlite"

# If you have sqlite, here's a simple default to get you started
# in development
sqlalchemy.dburi="sqlite:///Users/holden/tg1p1env/devdata.sqlite"
archive.dburi="postgresql://holden:password@localhost/datareduc"

-- __init.pu__ --

from dreduce.model.model import *
from dreduce.model.archivemodel import *
from elixir import options_defaults, using_options, setup_all

setup_all()

-- model.py --

from datetime import datetime, date, time
import pkg_resources
pkg_resources.require("SQLAlchemy>=0.3.10")
pkg_resources.require("Elixir>=0.4.0")
# import the basic Elixir classes and functions for declaring the data model
# (see http://elixir.ematia.de/trac/wiki/TutorialDivingIn)
from elixir import Entity, Field, OneToMany, ManyToOne, ManyToMany
from elixir import options_defaults, using_options, setup_all
# import some datatypes for table columns from Elixir
# (see http://www.sqlalchemy.org/docs/04/types.html for more)
from elixir import String, Unicode, Integer, DateTime, Numeric, Float
from elixir import *
from turbogears import identity
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.schema import ThreadLocalMetaData

mod_engine =
create_engine("sqlite:////Users/holden/tg1p1env/tg1dreduce/devdata.sqlite",
echo=True)
mod_session = scoped_session(sessionmaker(autoflush=True))
mod_metadata = ThreadLocalMetaData()
__metadata__ = mod_metadata
__session__ = mod_session

options_defaults['autosetup'] = False

# the identity model followed up by my stuff
# my stuff relies on the identity classes




class Visit(Entity):
    """
    A visit to your site
    """
    using_options(tablename='visit')

    visit_key = Field(String(40), primary_key=True)
    created = Field(DateTime, nullable=False, default=datetime.now)
    expiry = Field(DateTime)

    def lookup_visit(cls, visit_key):
        return Visit.get(visit_key)
    lookup_visit = classmethod(lookup_visit)


class VisitIdentity(Entity):
    """
    A Visit that is link to a User object
    """
    using_options(tablename='visit_identity')

    visit_key = Field(String(40), primary_key=True)
    user = ManyToOne('User', colname='user_id', use_alter=True)


class Group(Entity):
    """
    An ultra-simple group definition.
    """
    using_options(tablename='tggroup')

    group_id = Field(Integer, primary_key=True)
    group_name = Field(Unicode(16), unique=True)
    display_name = Field(Unicode(255))
    created = Field(DateTime, default=datetime.now)
    users = ManyToMany('User', tablename='user_group')
    permissions = ManyToMany('Permission', tablename='group_permission')
    def __repr__(self):
        return ' %s ' % (self.display_name)


class User(Entity):
    """
    Reasonably basic User definition.
    Probably would want additional attributes.
    """
    using_options(tablename='tguser')

    user_id = Field(Integer, primary_key=True)
    user_name = Field(Unicode(16), unique=True)
    email_address = Field(Unicode(255))
    display_name = Field(Unicode(255))
    created = Field(DateTime, default=datetime.now)
    groups = ManyToMany('Group', tablename='user_group')

    def __repr__(self):
        return '%s' % (self.display_name)


    def permissions(self):
        p = set()
        for g in self.groups:
            p |= set(g.permissions)
        return p
    permissions = property(permissions)


    def update(self):
        session.flush()
        return(self)


class Permission(Entity):
    """
    A relationship that determines what each Group can do
    """
    using_options(tablename='permission')

    permission_id = Field(Integer, primary_key=True)
    permission_name = Field(Unicode(16), unique=True)
    description = Field(Unicode(255))
    groups = ManyToMany('Group', tablename='group_permission')


-- archivemodel.py --

from datetime import datetime, date, time
import pkg_resources
pkg_resources.require("SQLAlchemy>=0.3.10")
pkg_resources.require("Elixir>=0.4.0")
# import the basic Elixir classes and functions for declaring the data model
# (see http://elixir.ematia.de/trac/wiki/TutorialDivingIn)
from elixir import Entity, Field, OneToMany, ManyToOne, ManyToMany
from elixir import options_defaults, using_options, setup_all
# import some datatypes for table columns from Elixir
# (see http://www.sqlalchemy.org/docs/04/types.html for more)
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.schema import ThreadLocalMetaData
from elixir import *
from turbogears import identity

options_defaults['autosetup'] = False

arch_engine = create_engine("postgresql://holden:password@localhost/datareduc",
echo=True)

arch_session = scoped_session(sessionmaker(autoflush=True))
arch_metadata = ThreadLocalMetaData()
__metadata__ = arch_metadata
__session__ = arch_session


class archiveUser(Entity):
    """
    Reasonably basic User definition.
    Probably would want additional attributes.
    """
    using_options(tablename='archuser')

    user_id = Field(Integer, primary_key=True)
    user_name = Field(Unicode(16), unique=True)
   email_address = Field(Unicode(255))
    display_name = Field(Unicode(255))
    password = Field(Unicode(40))
    created = Field(DateTime, default=datetime.now)

    def __repr__(self):
        return '%s' % (self.display_name)


    def permissions(self):
        p = set()
        for g in self.groups:
            p |= set(g.permissions)
        return p
    permissions = property(permissions)


    def update(self):
        session.flush()
        return(self)






On Thu, Nov 17, 2011 at 2:10 AM, Christoph Zwerschke <[email protected]> wrote:

> Am 16.11.2011 22:04, schrieb Brad Holden:
>
>  If anyone could point me to other resources to look for information on
>> what I am missing (and I suspect that it is something dumb), I would
>> really appreciate it.
>>
>
> Hard to say what you're missing without seeing anything of your code. It
> would help to know your sqlalchemy + elixir versions and if you paste the
> model files and the config of the dburis.
>
> -- Christoph
>
> --
> 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 turbogears+unsubscribe@**
> googlegroups.com <turbogears%[email protected]>.
> For more options, visit this group at http://groups.google.com/**
> group/turbogears?hl=en <http://groups.google.com/group/turbogears?hl=en>.
>
>

-- 
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.

Reply via email to