From 72fc1c9635dbc9699670fc681a4bb842694ebf93 Mon Sep 17 00:00:00 2001
From: Andrew Williams
Date: Fri, 6 Aug 2010 16:38:24 +0100
Subject: [PATCH 1/6] Updated production env in the fab file
---
fabfile.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fabfile.py b/fabfile.py
index 0cbcbfd..478880c 100644
--- a/fabfile.py
+++ b/fabfile.py
@@ -5,8 +5,8 @@ env.repo = 'git://dev.dredd.it/dreddit-auth.git'
def production():
"Use the production enviroment on Web1"
- env.hosts = ['matalok@web1.dredd.it']
- env.path = '/home/matalok'
+ env.hosts = ['dreddit@syndicate.tensixtyone.com']
+ env.path = '/home/dreddit/apps'
def test():
"Use the test enviroment on Web2"
From 97188000021fdba8398a14d20e6b01c1e6a5547c Mon Sep 17 00:00:00 2001
From: Andrew Williams
Date: Sat, 7 Aug 2010 12:32:58 +0100
Subject: [PATCH 2/6] Small bits of documentation for the Reddit app
---
reddit/forms.py | 2 ++
reddit/models.py | 2 ++
2 files changed, 4 insertions(+)
diff --git a/reddit/forms.py b/reddit/forms.py
index f9567f3..7ede80b 100644
--- a/reddit/forms.py
+++ b/reddit/forms.py
@@ -4,6 +4,8 @@ from django.contrib.auth.models import User
from reddit.models import RedditAccount
class RedditAccountForm(forms.ModelForm):
+ """ Basic Reddit account input form """
+
user = forms.ModelChoiceField(queryset=User.objects.order_by('username'))
username = forms.CharField(label = u'Reddit Username', max_length=64)
diff --git a/reddit/models.py b/reddit/models.py
index 26af106..90b9134 100644
--- a/reddit/models.py
+++ b/reddit/models.py
@@ -48,6 +48,8 @@ class RedditAccount(models.Model):
self.last_update = datetime.now()
def recent_posts(self):
+ """ Returns the first page of posts visible on the user's profile page """
+
try:
jsondoc = json.load(urllib.urlopen("http://reddit.com/user/%s.json" % self.username))
except:
From 94b8736622de9d9879e508fc7e085adb69210b48 Mon Sep 17 00:00:00 2001
From: Andrew Williams
Date: Sat, 7 Aug 2010 12:36:14 +0100
Subject: [PATCH 3/6] Removed a few debug print statements that are no longer
needed
---
api/handlers.py | 1 -
hr/views.py | 1 -
reddit/cron.py | 1 -
sso/forms.py | 2 --
sso/models.py | 4 +---
5 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/api/handlers.py b/api/handlers.py
index 71eb04b..999d5e7 100755
--- a/api/handlers.py
+++ b/api/handlers.py
@@ -111,7 +111,6 @@ class EveAPIProxyHandler(BaseHandler):
obj = get_object_or_404(EVEAccount, pk=params['userid'])
params['apikey'] = obj.api_key
- print params
cached_doc = CachedDocument.objects.api_query(url_path, params, exceptions=False)
return HttpResponse(cached_doc.body)
diff --git a/hr/views.py b/hr/views.py
index 698f8cb..ba468d0 100644
--- a/hr/views.py
+++ b/hr/views.py
@@ -157,7 +157,6 @@ def admin_applications(request):
limit = request.get['l']
else:
limit = 10
- print query, limit
apps = Application.objects.filter(character__name__icontains=query)[:limit]
else:
view_status = [APPLICATION_STATUS_AWAITINGREVIEW, APPLICATION_STATUS_ACCEPTED, APPLICATION_STATUS_QUERY]
diff --git a/reddit/cron.py b/reddit/cron.py
index a8c42c2..ec888f1 100644
--- a/reddit/cron.py
+++ b/reddit/cron.py
@@ -21,7 +21,6 @@ class UpdateAPIs():
def job(self):
delta = datetime.timedelta(seconds=self.last_update_delay)
- print delta
self._logger.debug("Updating accounts older than %s" % (datetime.datetime.now() - delta))
for acc in RedditAccount.objects.filter(last_update__lt=(datetime.datetime.now() - delta)):
diff --git a/sso/forms.py b/sso/forms.py
index b784b08..b1b597a 100644
--- a/sso/forms.py
+++ b/sso/forms.py
@@ -36,8 +36,6 @@ def UserServiceAccountForm(user):
services = Service.objects.filter(groups__in=user.groups.all(),active=1).exclude(id__in=ServiceAccount.objects.filter(user=user).values('service')).distinct()
chars = EVEPlayerCharacter.objects.filter(eveaccount__user=user)
- print len(services)
-
class ServiceAccountForm(forms.Form):
""" Service Account Form """
diff --git a/sso/models.py b/sso/models.py
index b738ea9..13f2704 100644
--- a/sso/models.py
+++ b/sso/models.py
@@ -68,9 +68,7 @@ class SSOUser(models.Model):
# Generate the list of groups to add/remove
delgroups = set(set(self.user.groups.all()) & set(corpgroups)) - set(chargroups)
addgroups = set(chargroups) - set(set(self.user.groups.all()) & set(corpgroups))
-
- print "Add: ", addgroups, "Del:", delgroups, "Current:", self.user.groups.all()
-
+
for g in delgroups:
self.user.groups.remove(g)
From c49f227e66f06af13fc76a39e9b74511a8e70e11 Mon Sep 17 00:00:00 2001
From: Andrew Williams
Date: Sat, 7 Aug 2010 13:02:08 +0100
Subject: [PATCH 4/6] Remove unneeded lookup functions, use the builtin ones
---
eve_api/app_defines.py | 22 ----------------------
eve_api/models/api_player.py | 12 ------------
templates/sso/character.html | 4 ++--
3 files changed, 2 insertions(+), 36 deletions(-)
diff --git a/eve_api/app_defines.py b/eve_api/app_defines.py
index 48e5905..a8fd30f 100644
--- a/eve_api/app_defines.py
+++ b/eve_api/app_defines.py
@@ -43,25 +43,3 @@ API_BLOODLINES_CHOICES = (
(12, 'Ni-Kunni'),
(13, 'Caldari'),
)
-
-API_RACES = {
- 'Caldari': 1,
- 'Minmatar': 2,
- 'Gallente': 3,
- 'Amarr': 4,
-}
-
-API_BLOODLINES = {
- 'Sebiestor': 1,
- 'Vherokior': 2,
- 'Brutor': 3,
- 'Intaki': 4,
- 'Gallente': 5,
- 'Jin-Mei': 6,
- 'Civire': 7,
- 'Deteis': 8,
- 'Achura': 9,
- 'Amarr': 10,
- 'Khanid': 11,
- 'Ni-Kunni': 12,
-}
diff --git a/eve_api/models/api_player.py b/eve_api/models/api_player.py
index 8a0b7d1..9c27899 100644
--- a/eve_api/models/api_player.py
+++ b/eve_api/models/api_player.py
@@ -90,18 +90,6 @@ class EVEPlayerCharacter(EVEAPIModel):
objects = EVEPlayerCharacterManager()
- @property
- def gender_description(self):
- for choice in API_GENDER_CHOICES:
- if choice[0] == self.gender:
- return choice[1]
-
- @property
- def race_description(self):
- for choice in API_RACES_CHOICES:
- if choice[0] == self.race:
- return choice[1]
-
def __unicode__(self):
if self.name:
return "%s (%d)" % (self.name, self.id)
diff --git a/templates/sso/character.html b/templates/sso/character.html
index 305a8f0..2bd4d20 100644
--- a/templates/sso/character.html
+++ b/templates/sso/character.html
@@ -12,8 +12,8 @@
-- Race: {{ character.race_description }}
-- Gender: {{ character.gender_description }}
+- Race: {{ character.get_race_display }}
+- Gender: {{ character.get_gender_display }}
- Corporation: {{ character.corporation.name }}
- Alliance: {{ character.corporation.alliance.name }}
- Total SP: {{ character.total_sp|intcomma }}
From 2b2cf5e7b1ed9cd5afe4984a228950dd66cc0bea Mon Sep 17 00:00:00 2001
From: Andrew Williams
Date: Sat, 7 Aug 2010 13:03:23 +0100
Subject: [PATCH 5/6] Remove another unneeded lookup function
---
eve_api/models/api_player.py | 5 -----
templates/sso/profile.html | 2 +-
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/eve_api/models/api_player.py b/eve_api/models/api_player.py
index 9c27899..4a37232 100644
--- a/eve_api/models/api_player.py
+++ b/eve_api/models/api_player.py
@@ -39,11 +39,6 @@ class EVEAccount(EVEAPIModel):
verbose_name="API Status",
help_text="End result of the last attempt at updating this object from the API.")
- @property
- def api_status_description(self):
- for choice in API_STATUS_CHOICES:
- if choice[0] == self.api_status:
- return choice[1]
def in_corp(self, corpid):
for char in self.characters.all():
diff --git a/templates/sso/profile.html b/templates/sso/profile.html
index 8112f06..ab12a6e 100644
--- a/templates/sso/profile.html
+++ b/templates/sso/profile.html
@@ -70,7 +70,7 @@ setup.
| {{ acc.api_user_id }} |
{{ acc.api_key }} |
{{ acc.description }} |
- {{ acc.api_status_description }} |
+ {{ acc.get_api_status_display }} |
{{ acc.api_last_updated|naturaltimediff }} |
Refresh,
Logs,
From 7308598c8ef9dbf95c0fb8cc9e1612d0643ab0df Mon Sep 17 00:00:00 2001
From: Andrew Williams
Date: Sat, 7 Aug 2010 13:47:35 +0100
Subject: [PATCH 6/6] Change the race lookup method now that the dict is gone
---
eve_api/api_puller/accounts.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/eve_api/api_puller/accounts.py b/eve_api/api_puller/accounts.py
index ff338e3..7dc265e 100755
--- a/eve_api/api_puller/accounts.py
+++ b/eve_api/api_puller/accounts.py
@@ -157,7 +157,11 @@ def import_eve_character(api_key, user_id, character_id):
else:
pchar.gender = 2
- pchar.race = API_RACES[values['race']]
+ for v in API_RACES_CHOICES:
+ val, race = v
+ if race == values['race']:
+ pchar.race = val
+ break
total = 0
for skill in values['skills']:
|