Merge branch 'master' of ssh://dev.dredd.it/dreddit-auth

This commit is contained in:
Siebren Bakker
2010-08-10 09:26:35 -05:00
13 changed files with 15 additions and 53 deletions

View File

@@ -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)

View File

@@ -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']:

View File

@@ -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,
}

View File

@@ -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():
@@ -90,18 +85,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)

4
fabfile.py vendored
View File

@@ -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"

View File

@@ -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]

View File

@@ -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)):

View File

@@ -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)

View File

@@ -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:

View File

@@ -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 """

View File

@@ -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)

View File

@@ -12,8 +12,8 @@
<ul>
<li>Race: {{ character.race_description }}</li>
<li>Gender: {{ character.gender_description }}</li>
<li>Race: {{ character.get_race_display }}</li>
<li>Gender: {{ character.get_gender_display }}</li>
<li>Corporation: {{ character.corporation.name }}</li>
<li>Alliance: {{ character.corporation.alliance.name }}</li>
<li>Total SP: {{ character.total_sp|intcomma }}</li>

View File

@@ -70,7 +70,7 @@ setup.</p>
<tr><td>{{ acc.api_user_id }}</td>
<td>{{ acc.api_key }}</td>
<td>{{ acc.description }}</td>
<td>{{ acc.api_status_description }}</td>
<td>{{ acc.get_api_status_display }}</td>
<td>{{ acc.api_last_updated|naturaltimediff }}</td>
<td><a href="{% url sso.views.eveapi_refresh acc.api_user_id %}">Refresh</a>,&nbsp;
<a href="{% url sso.views.eveapi_log acc.api_user_id %}">Logs</a>,&nbsp;