예제 #1
0
 def testGetPageTokenSpecifiedAndWrongAndRequired(self):
     params = {"session": "agsgas", "id": "fullContacts"}
     conn = sqlite3.connect(":memory:")
     try:
         conn.cursor().execute("drop table session")
     except:
         pass
     conn.cursor().execute("create table session (id, token, expiry)")
     result = PageLoader().getPage(params, conn)
     conn.close();
     redirectLink = """
         <meta http-equiv="refresh" content="0;url=/cgi-bin/page.py?id=fullContacts">        
     """
     self.assertNotEqual(-1, result.find(redirectLink.strip()))
예제 #2
0
 def testGetPageTokenSpecifiedAndWrongAndRequired(self):
     params = {"session": "agsgas", "id": "fullContacts"}
     conn = sqlite3.connect(":memory:")
     try:
         conn.cursor().execute("drop table session")
     except:
         pass
     conn.cursor().execute("create table session (id, token, expiry)")
     result = PageLoader().getPage(params, conn)
     conn.close()
     redirectLink = """
         <meta http-equiv="refresh" content="0;url=/cgi-bin/page.py?id=fullContacts">        
     """
     self.assertNotEqual(-1, result.find(redirectLink.strip()))
예제 #3
0
 def testGetPageTokenSpecifiedAndRight(self):
     params = {"session": "abc"}
     conn = sqlite3.connect(":memory:")
     try:
         conn.cursor().execute("drop table session")
     except:
         pass
     conn.cursor().execute("create table session (id, token, expiry)")
     conn.cursor().execute("insert into session (id, token) values (1, 'abc')")
     result = PageLoader().getPage(params, conn)
     conn.close();
     redirectLink = """
         <meta http-equiv="refresh" content="0;url=/cgi-bin/page.py?id=home">        
     """
     self.assertEqual(-1, result.find(redirectLink.strip()))
예제 #4
0
 def testGetPageTokenSpecifiedAndRight(self):
     params = {"session": "abc"}
     conn = sqlite3.connect(":memory:")
     try:
         conn.cursor().execute("drop table session")
     except:
         pass
     conn.cursor().execute("create table session (id, token, expiry)")
     conn.cursor().execute(
         "insert into session (id, token) values (1, 'abc')")
     result = PageLoader().getPage(params, conn)
     conn.close()
     redirectLink = """
         <meta http-equiv="refresh" content="0;url=/cgi-bin/page.py?id=home">        
     """
     self.assertEqual(-1, result.find(redirectLink.strip()))
예제 #5
0
파일: page.py 프로젝트: hicksjduk/sehicl
#!/usr/bin/python
from cgi import FieldStorage
import sys
import os

root = os.environ("HOME")
sys.path.insert(0, root + "/python")

from pages.settings import Settings
Settings.setRootDirectory(root)

from pages.pageloader import PageLoader

import cgitb
cgitb.enable()

print("Content-Type: text/html\n")

parms = FieldStorage()
paramDict = {}
for k in parms.keys():
    paramDict[k] = parms.getvalue(k)

print(PageLoader().getPage(paramDict))