forked from github/server
new sqlite schema has faction-no as string
This commit is contained in:
parent
373942d2c2
commit
01fda5d3d7
1 changed files with 1 additions and 26 deletions
|
@ -3,34 +3,9 @@
|
||||||
from string import split
|
from string import split
|
||||||
from string import strip
|
from string import strip
|
||||||
from string import lower
|
from string import lower
|
||||||
import subprocess
|
|
||||||
import bcrypt
|
import bcrypt
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
def baseconvert(n, base):
|
|
||||||
"""convert positive decimal integer n to equivalent in another base (2-36)"""
|
|
||||||
|
|
||||||
digits = "0123456789abcdefghijkLmnopqrstuvwxyz"
|
|
||||||
|
|
||||||
try:
|
|
||||||
n = int(n)
|
|
||||||
base = int(base)
|
|
||||||
except:
|
|
||||||
return ""
|
|
||||||
|
|
||||||
if n < 0 or base < 2 or base > 36:
|
|
||||||
return ""
|
|
||||||
|
|
||||||
s = ""
|
|
||||||
while True:
|
|
||||||
r = n % base
|
|
||||||
s = digits[r] + s
|
|
||||||
n = n / base
|
|
||||||
if n == 0:
|
|
||||||
break
|
|
||||||
|
|
||||||
return s
|
|
||||||
|
|
||||||
class EPasswd:
|
class EPasswd:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.data = {}
|
self.data = {}
|
||||||
|
@ -47,7 +22,7 @@ class EPasswd:
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
for row in c.execute('SELECT `no`, `email`, `password` FROM `faction`'):
|
for row in c.execute('SELECT `no`, `email`, `password` FROM `faction`'):
|
||||||
(no, email, passwd) = row
|
(no, email, passwd) = row
|
||||||
self.set_data(baseconvert(no, 36), email, passwd)
|
self.set_data(no, email, passwd)
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
def load_file(self, file):
|
def load_file(self, file):
|
||||||
|
|
Loading…
Reference in a new issue