Reformatted code for easy reading.

This commit is contained in:
Raynaldo Rivera
2014-10-26 16:47:21 -07:00
parent 6e99823252
commit 19e19d89e4
97 changed files with 22820 additions and 10377 deletions

View File

@@ -4,7 +4,6 @@ import evelink.eve
class EveApiManager():
def __init__(self):
pass
@@ -34,6 +33,32 @@ class EveApiManager():
return ticker
@staticmethod
def get_alliance_information(alliance_id):
results = {}
try:
api = evelink.api.API()
eve = evelink.eve.EVE(api=api)
alliance = eve.alliances()
results = alliance[0][int(alliance_id)]
except evelink.api.APIError as error:
print error
return results
@staticmethod
def get_corporation_information(corp_id):
results = {}
try:
api = evelink.api.API()
corp = evelink.corp.Corp(api=api)
corpinfo = corp.corporation_sheet(corp_id=int(corp_id))
results = corpinfo[0]
except evelink.api.APIError as error:
print error
return results
@staticmethod
def check_api_is_type_account(api_id, api_key):
try:

View File

@@ -1,12 +1,12 @@
import os
import calendar
from datetime import datetime
from passlib.apps import phpbb3_context
from django.db import connections
class ForumManager:
SQL_ADD_USER = r"INSERT INTO phpbb_users (username, username_clean, " \
r"user_password, user_email, group_id, user_regdate, user_permissions, " \
r"user_sig, user_occ, user_interests) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
@@ -89,7 +89,7 @@ class ForumManager:
@staticmethod
def __create_group(groupname):
cursor = connections['phpbb3'].cursor()
cursor.execute(ForumManager.SQL_ADD_GROUP, [groupname,groupname])
cursor.execute(ForumManager.SQL_ADD_GROUP, [groupname, groupname])
return ForumManager.__get_group_id(groupname)
@staticmethod
@@ -185,7 +185,7 @@ class ForumManager:
cursor.execute(ForumManager.SQL_USER_ID_FROM_USERNAME, [ForumManager.__santatize_username(username)])
row = cursor.fetchone()
if row:
return True
return True
return False
@staticmethod

View File

@@ -1,18 +1,17 @@
import os
import time
from urlparse import urlparse
import xmpp
from django.contrib.auth.models import User
from django.contrib.auth.models import Group
from django.conf import settings
from openfire import exception
from openfire import UserService
from urlparse import urlparse
from authentication.managers import AuthServicesInfoManager
from eveonline.managers import EveManager
class JabberManager:
def __init__(self):
pass
@@ -83,7 +82,7 @@ class JabberManager:
@staticmethod
def delete_user_groups(username, groups):
api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
api.delete_group(username,groups)
api.delete_group(username, groups)
@staticmethod
def send_broadcast_message(group_name, broadcast_message):
@@ -98,7 +97,7 @@ class JabberManager:
auth_info = AuthServicesInfoManager.get_auth_service_info(user)
if auth_info:
if auth_info.jabber_username != "":
to_address = auth_info.jabber_username+'@'+settings.JABBER_URL
to_address = auth_info.jabber_username + '@' + settings.JABBER_URL
message = xmpp.Message(to_address, broadcast_message)
message.setAttr('type', 'chat')
client.send(message)
@@ -108,11 +107,10 @@ class JabberManager:
auth_info = AuthServicesInfoManager.get_auth_service_info(user)
if auth_info:
if auth_info.jabber_username != "":
to_address = auth_info.jabber_username+'@'+settings.JABBER_URL
to_address = auth_info.jabber_username + '@' + settings.JABBER_URL
message = xmpp.Message(to_address, broadcast_message)
message.setAttr('type', 'chat')
client.send(message)
client.Process(1)
client.disconnect()

View File

@@ -1,11 +1,11 @@
import os
import hashlib
from django.db import connections
from django.conf import settings
class MumbleManager:
SQL_SELECT_USER_MAX_ID = r"SELECT max(user_id)+1 as next_id from murmur_users"
SQL_SELECT_GROUP_MAX_ID = r"SELECT MAX(group_id)+1 FROM murmur_groups"
@@ -54,7 +54,7 @@ class MumbleManager:
@staticmethod
def __generate_username(username, corp_ticker):
return "["+corp_ticker+"]"+username
return "[" + corp_ticker + "]" + username
@staticmethod
def _gen_pwhash(password):