Skip to content

Commit

Permalink
Don't use actions to compute creation_date, use id of the card that c…
Browse files Browse the repository at this point in the history
…ontains the creation_date
  • Loading branch information
diegojromerolopez committed Apr 21, 2016
1 parent b82cbe3 commit 108f7ae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
requests
requests-oauthlib
python-dateutil
pytz
8 changes: 5 additions & 3 deletions trello/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from trello.label import Label

import datetime
import pytz


class Card(object):
Expand Down Expand Up @@ -408,9 +409,10 @@ def create_date(self):
it fails. attriExp('convertToCardFromCheckItem') allows to
test for the condition.
"""
self.fetch_actions()
date_str = self.actions[0]['date']
return dateparser.parse(date_str)
if not hasattr(self, "creation_date"):
localtz = pytz.timezone(Organization.TIMEZONE)
self.creation_date = localtz.localize(datetime.datetime.fromtimestamp(int(self.id[0: 8], 16)))
return self.creation_date

@property
def due_date(self):
Expand Down
3 changes: 3 additions & 0 deletions trello/organization.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function, absolute_import
from trello.board import Board
from trello.member import Member


class Organization(object):

TIMEZONE = None

"""
Class representing an organization
"""
Expand Down

0 comments on commit 108f7ae

Please sign in to comment.