Bug #369
Attempted recursion on autoload
Status:
Closed
Priority:
Normal
Assignee:
Elmer de Looff
Category:
-
Target version:
-
Description
from underdark.uweb import model
class Message(model.Record):
"""Abstraction class for messages stored in the database."""
>>> message = Message.FromKey(db_conn, 1)
>>> message
Message({'message': u'FRIST!', 'ID': 1L, 'author': 1})
>>> message['message']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "underdark/libs/uweb/model.py", line 141, in values
return list(self.itervalues())
File "underdark/libs/uweb/model.py", line 135, in <genexpr>
return (self[key] for key in self)
File "underdark/libs/uweb/model.py", line 111, in __getitem__
return self._LoadForeign(field, value)
File "underdark/libs/uweb/model.py", line 198, in _LoadForeign
value = self._SUBTYPES[field].FromKey(self.connection, value)
File "underdark/libs/uweb/model.py", line 264, in FromKey
cls.__name__, pkey_value))
underdark.libs.uweb.model.NotExistError: There is No 'Message' with key u'FRIST!'
The autoload system should not attempt to load foreign relations that refer to its own TableName
, unless specifically instructed by the _FOREIGN_RELATIONS
mapping.
Associated revisions
History
#1 Updated by Elmer de Looff over 13 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
This has been resolved in Underdark:r2970
Fixed infinite (and likely failing) recursion if a database record contains a fieldname that is its own table name. This resolves #369.