Example #1
0
 def setup(cls):
     #load all static files
     #you can control which file to be seen here
     sw_log("building resource ...")
     cls.root = os.path.join(os.getcwd(),"resource")
     for root,dirs,cls.res_list in os.walk(cls.root): pass
     if len(cls.res_list) == 0: sw_err_print("no resources found")
Example #2
0
 def get_res_path(cls,path):
     path = path[1:] if path[0] == '/' else path
     if path in cls.res_list:
         return open(os.path.join(cls.root,path)).read()
     sw_err_print("%s not found" % path)
     return cls.get_res_path("error404.html")