Ejemplo n.º 1
0
 def __init__(self, work_dir):
     self.work_dir = work_dir
     self.admin = adm_server.create_admin(self)
     self.task = None
     self.task_lock = Lock()
     self.users = {}
     self.roles = None
     self._busy = 0
     self.pid = os.getpid()
     self.task_server_modified = False
     self.task_client_modified = True
     self.under_maintenance = False
     self.work_dir = self.admin.work_dir
     self.jam_dir = os.path.dirname(jam.__file__)
     self.jam_version = jam.version()
     self.application_files = {
         '/': self.work_dir,
         '/jam/': self.jam_dir,
         '/static/': os.path.join(self.jam_dir, 'static'            )
     }
     self.fileserver = SharedDataMiddleware(None, self.application_files, cache_timeout=0.1)
     self.url_map = Map([
         Rule('/', endpoint='root_file'),
         Rule('/<file_name>', endpoint='root_file'),
         Rule('/js/<file_name>', endpoint='file'),
         Rule('/css/<file_name>', endpoint='file'),
         Rule('/jam/js/<file_name>', endpoint='file'),
         Rule('/jam/js/ace/<file_name>', endpoint='file'),
         Rule('/jam/css/<file_name>', endpoint='file'),
         Rule('/jam/img/<file_name>', endpoint='file'),
         Rule('/api', endpoint='api'),
         Rule('/upload', endpoint='upload')
     ])
Ejemplo n.º 2
0
 def __init__(self, work_dir):
     self.work_dir = work_dir
     self.admin = adm_server.create_admin(self)
     self.task = None
     self.task_lock = Lock()
     self.users = {}
     self.roles = None
     self._busy = 0
     self.pid = os.getpid()
     self.task_server_modified = False
     self.task_client_modified = True
     self.under_maintenance = False
     self.work_dir = self.admin.work_dir
     self.jam_dir = os.path.dirname(jam.__file__)
     self.jam_version = jam.version()
     self.application_files = {
         '/': self.work_dir,
         '/jam/': self.jam_dir,
         '/static/': os.path.join(self.jam_dir, 'static')
     }
     self.fileserver = SharedDataMiddleware(None,
                                            self.application_files,
                                            cache_timeout=0.1)
     self.url_map = Map([
         Rule('/', endpoint='root_file'),
         Rule('/<file_name>', endpoint='root_file'),
         Rule('/js/<file_name>', endpoint='file'),
         Rule('/css/<file_name>', endpoint='file'),
         Rule('/jam/js/<file_name>', endpoint='file'),
         Rule('/jam/js/ace/<file_name>', endpoint='file'),
         Rule('/jam/css/<file_name>', endpoint='file'),
         Rule('/jam/img/<file_name>', endpoint='file'),
         Rule('/api', endpoint='api'),
         Rule('/upload', endpoint='upload')
     ])
Ejemplo n.º 3
0
 def check_admin(self):
     if self.admin:
         return True
     else:
         result = False
         if not self._loading:
             self._loading = True;
             try:
                 with self._load_lock:
                     import adm_server
                     self.admin = adm_server.create_admin(self)
             finally:
                 self._loading = False;
             result = True
         return result
Ejemplo n.º 4
0
    def check_admin(self):
        if self.admin:
            return True
        else:
            result = False
            if not self._loading:
                self._loading = True
                try:
                    with self._load_lock:
                        import adm_server

                        self.admin = adm_server.create_admin(self)
                finally:
                    self._loading = False
                result = True
            return result
Ejemplo n.º 5
0
 def check_task(self):
     if self.task:
         return True
     else:
         result = False
         if not self._loading:
             self._loading = True
             try:
                 with self._load_lock:
                     if self.admin is None:
                         import adm_server
                         self.admin = adm_server.create_admin(self)
                     self.task = self.admin.create_task()
             finally:
                 self._loading = False
             result = True
         return result
Ejemplo n.º 6
0
 def create_admin(self):
     from adm_server import create_admin
     return create_admin(self)