Hello.

May be you need add

metadata = MetaData()

to your model.meta (model/meta.py)


2011/6/28 safa said <[email protected]>

> Hi,
> I'm new in python, and I'm trying to get working with authkit and
> python 2.6, and I'm getting same problem with websetup.py
> configuration:
> this is my websetup.py:
> -------------
> from authkit.users.sqlalchemy_driver import UsersFromDatabase
> from auth_app import model
>
> import logging
>
> import pylons.test
>
> from auth_app.config.environment import load_environment
> from auth_app.model.meta import Session, Base
>
>
> log = logging.getLogger(__name__)
>
> log.info(dir(model))
> log.info("Adding the AuthKit model...")
> users = UsersFromDatabase(model)
>
>
> def setup_app(command, conf, vars):
>    """Place any commands to setup auth_app here"""
>    # Don't reload the app if it was loaded under the testing
> environment
>    if not pylons.test.pylonsapp:
>        load_environment(conf.global_conf, conf.local_conf)
>
>    # Create the tables if they don't already exist
>    Base.metadata.create_all(bind=Session.bind)
>
>
>    log.info("Adding roles and uses...")
>    users.role_create("delete")
>    users.user_create("foo", password="bar")
>    users.user_create("admin", password="opensesame")
>    users.user_add_role("admin", role="delete")
>
>    log.info("Adding tags...")
>    tag1 = model.Tag()
>    tag1.name = u'Pylons'
>    meta.Session.add(tag1)
>    tag2 = model.Tag()
>    tag2.name = u'Paste'
>    meta.Session.add(tag2)
>    tag3 = model.Tag()
>    tag3.name = u'Tutorial'
>    meta.Session.add(tag3)
>    tag4 = model.Tag()
>    tag4.name = u'Database'
>    meta.Session.add(tag4)
>    tag5 = model.Tag()
>    tag5.name = u'Recipe'
>    meta.Session.add(tag5)
>
> -------------
>
> when i try to execute " paster setup-app development.ini"
> I'm getting this error:
>
> -------------
> 11:40:55,494 INFO  [auth_app.websetup] [MainThread] Adding the AuthKit
> model...
> Traceback (most recent call last):
>  File "/mapfish/auth_test/env_authtest/bin/paster", line 8, in
> <module>
>    load_entry_point('PasteScript==1.7.3', 'console_scripts', 'paster')
> ()
>  File "/mapfish/auth_test/env_authtest/lib/python2.6/site-packages/
> PasteScript-1.7.3-py2.6.egg/paste/script/command.py", line 84, in run
>    invoke(command, command_name, options, args[1:])
>  File "/mapfish/auth_test/env_authtest/lib/python2.6/site-packages/
> PasteScript-1.7.3-py2.6.egg/paste/script/command.py", line 123, in
> invoke
>    exit_code = runner.run(args)
>  File "/mapfish/auth_test/env_authtest/lib/python2.6/site-packages/
> PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py", line 68, in
> run
>    return super(AbstractInstallCommand, self).run(new_args)
>  File "/mapfish/auth_test/env_authtest/lib/python2.6/site-packages/
> PasteScript-1.7.3-py2.6.egg/paste/script/command.py", line 218, in run
>    result = self.command()
>  File "/mapfish/auth_test/env_authtest/lib/python2.6/site-packages/
> PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py", line 456, in
> command
>    self, config_file, section,
> self.sysconfig_install_vars(installer))
>  File "/mapfish/auth_test/env_authtest/lib/python2.6/site-packages/
> PasteScript-1.7.3-py2.6.egg/paste/script/appinstall.py", line 591, in
> setup_config
>    mod = import_string.try_import_module(mod_name)
>  File "/mapfish/auth_test/env_authtest/lib/python2.6/site-packages/
> Paste-1.7.3.1-py2.6.egg/paste/util/import_string.py", line 81, in
> try_import_module
>    return import_module(module_name)
>  File "/mapfish/auth_test/env_authtest/lib/python2.6/site-packages/
> Paste-1.7.3.1-py2.6.egg/paste/util/import_string.py", line 67, in
> import_module
>    mod = __import__(s)
>  File "/mapfish/auth_test/auth_app/auth_app/websetup.py", line 24, in
> <module>
>    users = UsersFromDatabase(model)
>  File "/mapfish/auth_test/env_authtest/lib/python2.6/site-packages/
> AuthKit-0.4.5-py2.6.egg/authkit/users/sqlalchemy_driver/
> sqlalchemy_05.py", line 32, in __init__
>    self.model = self.update_model(model)
>  File "/mapfish/auth_test/env_authtest/lib/python2.6/site-packages/
> AuthKit-0.4.5-py2.6.egg/authkit/users/sqlalchemy_driver/
> sqlalchemy_05.py", line 37, in update_model
>    metadata = model.meta.metadata
> AttributeError: 'module' object has no attribute 'metadata'
>
> -------------
>
> Can anyone help me plz. Thx
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" 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/pylons-discuss?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en.

Reply via email to