|
Revision 101
(checked in by fumanchu, 8 years ago)
|
Fix for #20 (awareness of to-one or to-many).
- Magic Unit relation methods may now return a single Unit (or None) if they are to-one. To-many methods still return a list.
- dejavu.associate is replaced by Unit.associate, one_to_many, one_to_one, and many_to_one.
- Unit.first is removed.
- One-way associations are now possible via dejavu.ToOne? and .ToMany?. Customization of relation descriptors is easier (override UnitAssociation?.related).
- Unit._associations dict has changed protocol.
- Lots of module breakouts to make reading easier.
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
class DejavuError(Exception): |
|---|
| 3 |
"""Base class for errors which occur within Dejavu.""" |
|---|
| 4 |
def __init__(self, *args): |
|---|
| 5 |
Exception.__init__(self) |
|---|
| 6 |
self.args = args |
|---|
| 7 |
|
|---|
| 8 |
def __str__(self): |
|---|
| 9 |
return u'\n'.join([unicode(eachArg) for eachArg in self.args]) |
|---|
| 10 |
|
|---|
| 11 |
class AssociationError(DejavuError): |
|---|
| 12 |
"""Exception raised when a Unit association fails.""" |
|---|
| 13 |
pass |
|---|
| 14 |
|
|---|
| 15 |
class UnrecallableError(DejavuError): |
|---|
| 16 |
"""Exception raised when a Unit was sought but not recalled.""" |
|---|
| 17 |
pass |
|---|
| 18 |
|
|---|