Skip to content

Commit

Permalink
Get rid of all of them and just use the built in
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanReiter committed May 23, 2011
1 parent 551a85f commit 64f2cbb
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions flexibledatefield/flexibledate.py
Expand Up @@ -113,30 +113,11 @@ def __sub__(self, other):
diff_months = self.month - other_month
return flexibledatedelta(diff_years, diff_months, diff_days)


def __eq__(self, other):
return self.__cmp(other) == 0

def __ne__(self, other):
return self.__cmp(other) != 0

def __le__(self, other):
return self.__cmp(other) <= 0

def __lt__(self, other):
return self.__cmp(other) < 0

def __ge__(self, other):
return self.__cmp(other) >= 0

def __gt__(self, other):
return self.__cmp(other) > 0

def __cmp(self, other):
def __cmp__(self, other):
if isinstance(other, flexibledate):
return cmp(self.value, other.value)
elif isinstance(other, datetime.datetime) or isinstance(other, datetime.date):
return cmp(self.value, flexibledate(other))
return cmp(self.value, flexibledate(other).value)
else:
_cmperror(self, other)

Expand Down

0 comments on commit 64f2cbb

Please sign in to comment.