Created
August 11, 2011 04:27
-
-
Save eightysteele/1138901 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Cell(model.Model): | |
| """Models a CouchDB cell document. | |
| key_name - The cell key (e.g., 1-2). | |
| """ | |
| rev = model.StringProperty('r') | |
| coords = model.StringProperty('c') | |
| varvals = model.TextProperty('v') | |
| def __eq__(self, other): | |
| if isinstance(other, Cell): | |
| return self.key() == other.key() | |
| return NotImplemented | |
| def __ne__(self, other): | |
| result = self.__eq__(other) | |
| if result is NotImplemented: | |
| return result | |
| return not result | |
| def __hash__(self): | |
| return hash(self.key().name()) | |
| def __cmp__(self, other): | |
| return self.key().__cmp__(other.key()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment