From 108f7aefe063b095e9fdae238f6ca0cbd06f05e5 Mon Sep 17 00:00:00 2001 From: diegojromerolopez Date: Thu, 21 Apr 2016 22:56:43 +0200 Subject: [PATCH] Don't use actions to compute creation_date, use id of the card that contains the creation_date --- requirements.txt | 1 + trello/card.py | 8 +++++--- trello/organization.py | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index bf6f0429..9ded02e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ requests requests-oauthlib python-dateutil +pytz diff --git a/trello/card.py b/trello/card.py index c9a30d37..7fb88714 100644 --- a/trello/card.py +++ b/trello/card.py @@ -5,6 +5,7 @@ from trello.label import Label import datetime +import pytz class Card(object): @@ -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): diff --git a/trello/organization.py b/trello/organization.py index 279424f5..74e9bab9 100644 --- a/trello/organization.py +++ b/trello/organization.py @@ -1,4 +1,5 @@ # -*- 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 @@ -6,6 +7,8 @@ class Organization(object): + TIMEZONE = None + """ Class representing an organization """