Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revise ActiveResource to handle STI types better. It will now create
subclass objects when parsing XML. Added element_containers to support this in a clean manner. git-svn-id: http://pyactiveresource.googlecode.com/svn/trunk@77 8807a2d2-0055-0410-b418-2ff1661b7dac
- Loading branch information
Daniel Van Derveer
committed
Oct 12, 2010
1 parent
5357b75
commit 73440f6
Showing
6 changed files
with
98 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/python2.4 | ||
# | ||
# Copyright 2010 Google Inc. All Rights Reserved. | ||
|
||
__author__ = 'danv@google.com (Daniel Van Derveer)' | ||
|
||
class ElementList(list): | ||
"""A list object with an element_type attribute.""" | ||
|
||
def __init__(self, element_type, *args): | ||
"""Constructor for ElementList.""" | ||
self.element_type = element_type | ||
super(ElementList, self).__init__(*args) | ||
|
||
|
||
class ElementDict(dict): | ||
"""A dictionary object with an element_type attribute.""" | ||
|
||
def __init__(self, element_type, *args): | ||
"""Constructor for ElementDict.""" | ||
self.element_type = element_type | ||
super(ElementDict, self).__init__(*args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters