Project

General

Profile

Bug #369

Attempted recursion on autoload

Added by Elmer de Looff over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Elmer de Looff
Category:
-
Target version:
-
Start date:
2011-09-21
Due date:
% Done:

100%

Estimated time:
Spent time:

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

Revision 97:9cd83bcaaccf (diff)
Added by Elmer de Looff over 13 years ago

Fixed infinite (and likely failing) recursion if a database record contains a fieldname that is its own table name. This resolves #369.

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

Also available in: Atom PDF