コード例 #1
0
 def write_stored_session(self, session_id, data):
     import binascii
     import time
     timed_data = "%s--%s" % (binascii.hexlify(data).decode("ascii"),
                              int(time.time()))
     session_file = os.path.join(self.path, self.__get_filename(session_id))
     _file.write(session_file, timed_data)
コード例 #2
0
ファイル: tasks.py プロジェクト: asad-abbasi/firenado
 def run(self, namespace):
     from tornado import template
     if len(sys.argv) > 2:
         module = namespace.module
         component = module.replace(".", " ").title().replace(" ", "")
         project_name = module.replace(".", "_").lower()
         project_directory = _file.create_module(module, os.getcwd())
         #TODO: Check if project exists
         #TODO: If doesn't exists create project
         #TODO: If exists throw an error
         loader = template.Loader(os.path.join(firenado.conf.ROOT,
                                               "management", "templates",
                                               "project"))
         project_init_content = loader.load("app.py.txt").generate(
             project_name=project_name, module=module, component=component)
         # Generating application firenado component and handlers
         _file.write(os.path.join(project_directory, "__init__.py"), "")
         _file.write(os.path.join(project_directory, "app.py"),
                     project_init_content.decode(sys.stdout.encoding))
         handlers_file_name = os.path.join(project_directory, "handlers.py")
         _file.touch(handlers_file_name)
         project_handlers_content = loader.load("handlers.py.txt").generate(
             handlers=["Index"])
         _file.write(handlers_file_name,
                     project_handlers_content.decode(sys.stdout.encoding))
         # Generating configuration
         project_conf_directory = os.path.join(project_directory, "conf")
         os.mkdir(project_conf_directory)
         project_conf_file = os.path.join(project_conf_directory,
                                          "firenado.yml")
         _file.touch(project_conf_file)
         project_init_content = loader.load("firenado.yml.txt").generate(
             app_name=project_name, module=module, component=component)
         _file.write(project_conf_file,
                     project_init_content.decode(sys.stdout.encoding))
     else:
         #TODO: This thing has to go. The parameter validation should be
         #TODO: executed by the argument parser.
         loader = template.Loader(os.path.join(
             firenado.conf.ROOT, "management", "templates", "help"))
         help_message = loader.load("init_command_help.txt").generate()
コード例 #3
0
ファイル: __init__.py プロジェクト: TRTDEV/firenado
 def run(self, namespace):
     from tornado import template
     print namespace
     if len(sys.argv) > 2:
         module = namespace.module
         component = module.replace('.', ' ').title().replace(' ', '')
         project_name = module.replace('.', '_').lower()
         project_directory = _file.create_module(module, os.getcwd())
         #TODO: Check if project exists
         #TODO: If doesn't exists create project
         #TODO: If exists throw an error
         loader = template.Loader(os.path.join(firenado.conf.ROOT,
                                               'core', 'management',
                                               'templates', 'project'))
         project_init_content = loader.load("__init__.py.txt").generate(
             project_name=project_name, module=module, component=component)
         # Generating application firenado component and handlers
         _file.write(os.path.join(project_directory, '__init__.py'),
                     project_init_content)
         handlers_file_name = os.path.join(project_directory, 'handlers.py')
         _file.touch(handlers_file_name)
         project_handlers_content = loader.load("handlers.py.txt").generate(
             handlers=['Index'])
         _file.write(handlers_file_name, project_handlers_content)
         # Generating configuration
         project_conf_directory = os.path.join(project_directory, 'conf')
         os.mkdir(project_conf_directory)
         project_conf_file = os.path.join(project_conf_directory,
                                          'firenado.yaml')
         _file.touch(project_conf_file)
         project_init_content = loader.load("firenado.yaml.txt").generate(
             app_name=project_name, module=module, component=component)
         _file.write(project_conf_file, project_init_content)
     else:
         #TODO: This thing has to go. The parameter validation should be
         #TODO: executed by the argument parser.
         loader = template.Loader(os.path.join(
             firenado.conf.ROOT, 'core', 'management', 'templates', 'help'))
         help_message = loader.load("init_command_help.txt").generate()
コード例 #4
0
ファイル: session.py プロジェクト: altamiro/firenado
 def write_stored_session(self, session_id, data):
     session_file = os.path.join(self.path, self.__get_filename(session_id))
     file.write(session_file, data)
コード例 #5
0
ファイル: session.py プロジェクト: altamiro/firenado
 def create_session(self, session_id, data):
     # TODO: What could possibly go wrong here? Let's handle it!
     session_file = os.path.join(self.path, self.__get_filename(session_id))
     if os.path.exists(firenado.conf.session['file']['path']):
         file.touch(session_file)
         file.write(session_file, data)
コード例 #6
0
 def write_stored_session(self, session_id, data):
     session_file = os.path.join(self.path, self.__get_filename(session_id))
     file.write(session_file, data)
コード例 #7
0
 def create_session(self, session_id, data):
     # TODO: What could possibly go wrong here? Let's handle it!
     session_file = os.path.join(self.path, self.__get_filename(session_id))
     if os.path.exists(firenado.conf.session['file']['path']):
         file.touch(session_file)
         file.write(session_file, data)