From 4b25620e8eefc6409af9cb3e354341b7f63964bb Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sun, 7 Oct 2012 04:47:44 -0400 Subject: [PATCH] Make __getattr__ of the Installation model return the value of the property not the Property instance --- apps/installation/models.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/apps/installation/models.py b/apps/installation/models.py index 3fd1e230c0..7a23c5811b 100644 --- a/apps/installation/models.py +++ b/apps/installation/models.py @@ -131,7 +131,7 @@ class Installation(Singleton): def __getattr__(self, name): self.set_properties() try: - return self._properties[name] + return self._properties[name].value except KeyError: raise AttributeError @@ -143,9 +143,7 @@ class Installation(Singleton): else: try: dictionary = {} - if self.is_lsb == True: - # Explicit True test, if self.is_lsb alone would always - # return True as it exists as a Property instance + if self.is_lsb: dictionary.update( { 'is_lsb': unicode(self.is_lsb), @@ -171,8 +169,7 @@ class Installation(Singleton): 'fabfile': unicode(self.fabfile), } ) - if self.is_git_repo == True: - # Same as above is_lsb test + if self.is_git_repo: dictionary.update( { 'repo_remotes': unicode(self.repo_remotes), @@ -183,7 +180,6 @@ class Installation(Singleton): 'headcommit_message': unicode(self.headcommit_message), } ) - requests.post(FORM_SUBMIT_URL, data={'formkey': FORM_KEY, FORM_RECEIVER_FIELD: dumps(dictionary)}, timeout=TIMEOUT) except (requests.exceptions.Timeout, requests.exceptions.ConnectionError): pass