minor changes in ticket_storage

This commit is contained in:
Massimo DiPierro
2012-02-28 10:08:54 -06:00
parent ac4a2c8ea1
commit 07b44bcb17
2 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -1 +1 @@
Version 1.99.4 (2012-02-27 16:57:41) stable Version 1.99.4 (2012-02-28 10:08:51) stable
+5 -4
View File
@@ -1173,14 +1173,15 @@ def errors():
def get_ticket_storage(app): def get_ticket_storage(app):
private_folder = apath('%s/private' % app, r=request) private_folder = apath('%s/private' % app, r=request)
try: ticket_file = os.path.join(private_folder, 'ticket_storage.txt')
db_string = open(os.path.join(private_folder, 'ticket_storage.txt')).read().replace('\r','').replace('\n','').strip() if os.path.exists(ticket__file):
except IOError: db_string = open(ticket_file).read()
db_string = db_string.strip().replace('\r','').replace('\n','')
else:
raise Exception, "No ticket_storage.txt found in /private folder" raise Exception, "No ticket_storage.txt found in /private folder"
tickets_table = 'web2py_ticket' tickets_table = 'web2py_ticket'
tablename = tickets_table + '_' + app tablename = tickets_table + '_' + app
db_path = apath('%s/databases' % app, r=request) db_path = apath('%s/databases' % app, r=request)
from gluon import DAL
ticketsdb = DAL(db_string, folder=db_path, auto_import=True) ticketsdb = DAL(db_string, folder=db_path, auto_import=True)
if not ticketsdb.get(tablename): if not ticketsdb.get(tablename):
table = ticketsdb.define_table( table = ticketsdb.define_table(