This commit is contained in:
phear 2005-09-06 17:52:46 +00:00
commit a5eb556ebb
58 changed files with 911 additions and 0 deletions

38
helper.py Normal file
View file

@ -0,0 +1,38 @@
def header():
"""return html header"""
data = """
<html><HEAD>
</HEAD><body>
"""
return data
def footer():
"""return html footer"""
data = """
</body></html>
"""
return data
# create a unique session id
def generate_session_id():
import md5, time, base64, random, string
m = md5.new()
m.update(str(time.time()))
m.update(str(random.random()))
return string.replace(base64.encodestring(m.digest())[:-3], '/', '$')
def check_for_int(data):
"""
gets a string. if string is an integer: return integer.
else return given string.
"""
#check if value is int
num = [n for n in data if n.isdigit()]
tmp = "".join(num)
if tmp == data:
ret = int(data)
else:
ret = data
return ret