On Oct 26, 2011, at 6:50 PM, Michael Bayer wrote:

> 
> OK you're getting confused here
If I had a nickel =P

> 
> So this is something occurring on usage, not on the mapping, which is not 
> shown here.    Somewhere a string value is being passed where an object 
> should be, such as if you were to say User().parent = "some string".   I know 
> that's not explicitly what you're doing here but we can't know the issue 
> without full code and a stack trace.
> 
Basically what I'm doing is adding an authed user to the framework. 

Traceback (most recent call last):
  File "/usr/sbin/admin-web", line 25, in service
    Application.service(self)
  File "/usr/lib/python2.5/site-packages/smisk/mvc/__init__.py", line 879, in 
service
    rsp = self._call_leaf_and_handle_model_session(req_args, req_params)
  File "/usr/lib/python2.5/site-packages/smisk/mvc/__init__.py", line 706, in 
_call_leaf_and_handle_model_session
    rsp = self._call_leaf(req_args, req_params)
  File "/usr/lib/python2.5/site-packages/smisk/mvc/__init__.py", line 695, in 
_call_leaf
    return self._leaf_filter(*args, **params)
  File "/usr/lib/python2.5/site-packages/smisk/mvc/decorators.py", line 72, in f
    return filter(leaf, *va, **kw)
  File "/var/mysite/lib/mysite/admin_web/__init__.py", line 50, in 
add_authorized_user_to_rsp
    return leaf(*va, **kw)
  File "/usr/lib/python2.5/site-packages/smisk/mvc/__init__.py", line 298, in 
<lambda>
    self._leaf_filter = lambda *va, **kw: filter(self.destination)(*va, **kw)
  File "/usr/lib/python2.5/site-packages/smisk/mvc/decorators.py", line 72, in f
    return filter(leaf, *va, **kw)
  File "/var/mysite/lib/mysite/admin_web/__init__.py", line 50, in 
add_authorized_user_to_rsp
    return leaf(*va, **kw)
  File "/usr/lib/python2.5/site-packages/smisk/mvc/routing.py", line 65, in 
__call__
    return self._call_leaf(*args, **params)
  File "/usr/lib/python2.5/site-packages/smisk/mvc/routing.py", line 59, in 
_call_leaf
    return self.leaf(*args, **params)
  File "/var/mysite/lib/smisk117compat.py", line 15, in f
    return filter(leaf, *va, **kw)
  File "/var/mysite/lib/smisk117compat.py", line 150, in filter
    self.parameter: q.all(),
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line 878, 
in all
    return list(self)
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line 938, 
in __iter__
    return self._execute_and_instances(context)
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/query.py", line 941, 
in _execute_and_instances
    result = self.session.execute(querycontext.statement, params=self._params, 
mapper=self.mapper, instance=self._refresh_instance)
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/session.py", line 628, 
in execute
    return self.__connection(engine, close_with_result=True).execute(clause, 
params or {})
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py", line 844, 
in execute
    return Connection.executors[c](self, object, multiparams, params)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py", line 895, 
in execute_clauseelement
    return self._execute_compiled(elem.compile(dialect=self.dialect, 
column_keys=keys, inline=len(params) > 1), distilled_params=params)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py", line 904, 
in _execute_compiled
    context = self.__create_execution_context(compiled=compiled, 
parameters=distilled_params)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py", line 948, 
in __create_execution_context
    return self.engine.dialect.create_execution_context(connection=self, 
**kwargs)
  File "/var/lib/python-support/python2.5/sqlalchemy/databases/mysql.py", line 
1474, in create_execution_context
    return MySQLExecutionContext(self, connection, **kwargs)
  File "/var/lib/python-support/python2.5/sqlalchemy/engine/default.py", line 
179, in __init__
    self.compiled_parameters = [compiled.construct_params(m) for m in 
parameters]
  File "/var/lib/python-support/python2.5/sqlalchemy/sql/compiler.py", line 
217, in construct_params
    pd[self.bind_names[bindparam]] = bindparam.value()
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/strategies.py", line 
288, in <lambda>
    bindparam.value = lambda: mapper._get_committed_attr_by_column(instance, 
bind_to_col[bindparam.key])
  File "/var/lib/python-support/python2.5/sqlalchemy/orm/mapper.py", line 974, 
in _get_committed_attr_by_column
    return self._get_col_to_prop(column).getcommitted(obj._state, column)
AttributeError: 'str' object has no attribute '_state'

Guess I'll have to check the source and see if it somewhere replaces the parent 
object with a string. Because I checked that it was an object right before 
adding the user. Know this stack trace doesn't say much but thought that maybe 
you can see something that I can't. 

Time for some detective work...



-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to