def update_langs(task): with FileLock('langs.lock'): con = task.create_connection() try: cursor = con.cursor() try: cursor.execute( 'ALTER TABLE SYS_PARAMS ADD COLUMN F_LANG_VERSION TEXT') except: pass cursor.execute('SELECT F_LANG_VERSION, F_LANGUAGE FROM SYS_PARAMS') res = cursor.fetchall() version = res[0][0] language = res[0][1] langs_path = os.path.join(task.work_dir, 'langs.sqlite') if version != jam.version() or not os.path.exists(langs_path): copyfile( os.path.join(os.path.dirname(jam.__file__), 'langs.sqlite'), langs_path) os.chmod(os.path.join(task.work_dir, 'langs.sqlite'), 0o666) cursor.execute('SELECT ID, F_NAME FROM SYS_LANGS') langs = cursor.fetchall() langs_list = [] langs_dict = {} for l in langs: langs_list.append(l[1]) langs_dict[l[1]] = l[0] res = select( task, 'SELECT %s FROM JAM_LANGS ORDER BY ID' % ', '.join(FIELDS)) for r in res: if langs_dict.get(r[1]): del langs_dict[r[1]] if not r[1] in langs_list: fields = ['DELETED'] values = ['?'] field_values = [0] for i, value in enumerate(r): if i > 0: fields.append(FIELDS[i]) values.append('?') field_values.append(value) sql = "INSERT INTO SYS_LANGS (%s) VALUES (%s)" % ( ','.join(fields), ','.join(values)) cursor.execute(sql, (field_values)) del_langs = list(langs_dict.values()) if len(del_langs): if language in del_langs: language = 1 sql = "DELETE FROM SYS_LANGS WHERE ID IN (%s)" % ','.join( [str(d) for d in del_langs]) cursor.execute(sql) if language is None: language = 'NULL' cursor.execute( "UPDATE SYS_PARAMS SET F_LANG_VERSION='%s', F_LANGUAGE=%s" % (jam.version(), language)) con.commit() finally: con.close()
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') ])
def __init__(self, work_dir): self.work_dir = work_dir self._loading = False self._load_lock = Lock() self.admin = None self.task = None 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.jam_dir = os.path.dirname(jam.__file__) self.jam_version = jam.version() self.application_files = { '/': self.work_dir, '/jam/': self.jam_dir } 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') ])
def __init__(self, work_dir): mimetypes.add_type('text/cache-manifest', '.appcache') self.started = datetime.datetime.now() self.work_dir = work_dir self._loading = False self._load_lock = Lock() self.admin = None self.task = None self.privileges = None self._busy = 0 self.pid = os.getpid() self.task_server_modified = False self.task_client_modified = True self.under_maintenance = False self.jam_dir = os.path.dirname(jam.__file__) self.jam_version = jam.version() self.application_files = { '/': self.work_dir, '/jam/': self.jam_dir } self.fileserver = SharedDataMiddleware(None, self.application_files, cache_timeout=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/css/themes/<file_name>', endpoint='file'), Rule('/jam/img/<file_name>', endpoint='file'), Rule('/api', endpoint='api'), Rule('/upload', endpoint='upload') ]) self.admin = self.create_admin()
def __init__(self, work_dir): self.work_dir = work_dir self._loading = False self._load_lock = Lock() self.admin = None self.task = None 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.jam_dir = os.path.dirname(jam.__file__) self.jam_version = jam.version() self.application_files = {"/": self.work_dir, "/jam/": self.jam_dir} 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"), ] )
def __init__(self, work_dir, load_task): mimetypes.add_type('text/cache-manifest', '.appcache') self.started = datetime.datetime.now() self.work_dir = work_dir self.state = common.PROJECT_NONE self._load_lock = Lock() self.admin = None self.task = None self.privileges = None self._busy = 0 self.pid = os.getpid() self.jam_dir = os.path.realpath(os.path.dirname(jam.__file__)) self.jam_version = jam.version() self.__is_locked = 0 self.application_files = { '/': self.work_dir, '/jam/': self.jam_dir } self.fileserver = SharedDataMiddleware(None, self.application_files, cache_timeout=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/css/themes/<file_name>', endpoint='file'), Rule('/jam/img/<file_name>', endpoint='file'), Rule('/api', endpoint='api'), Rule('/upload', endpoint='upload') ]) self.admin = self.create_admin() with self.admin.lock('$creating_task'): self.admin.read_settings() self.max_content_length = self.admin.max_content_length self.build_id_prefix = '$buildID' self.save_build_id(); if load_task: self.get_task() self.check_migration()
def __init__(self, work_dir): mimetypes.add_type('text/cache-manifest', '.appcache') self.started = datetime.datetime.now() self.work_dir = work_dir self.state = common.PROJECT_NONE self._load_lock = Lock() self._updating_task = False self.admin = None self.task = None self.privileges = None self._busy = 0 self.pid = os.getpid() self.task_server_modified = False self.task_client_modified = True self.under_maintenance = False self.jam_dir = os.path.realpath(os.path.dirname(jam.__file__)) self.jam_version = jam.version() self.__task_locked = False self.application_files = { '/': self.work_dir, '/jam/': self.jam_dir } self.fileserver = SharedDataMiddleware(None, self.application_files, cache_timeout=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/css/themes/<file_name>', endpoint='file'), Rule('/jam/img/<file_name>', endpoint='file'), Rule('/api', endpoint='api'), Rule('/upload', endpoint='upload') ]) self.admin = self.create_admin() self.max_content_length = self.admin.max_content_length
import os from setuptools import setup import jam setup( name='jam.py', version=jam.version(), url='http://jam-py.com/', author='Andrew Yushev', author_email='*****@*****.**', description= ('Jam.py Application Builder is an event-driven framework for the development of web database applications.' ), license='BSD', packages=[ 'jam', 'jam.db', 'jam.admin', 'jam.third_party', 'jam.third_party.werkzeug', 'jam.third_party.werkzeug.middleware', 'jam.third_party.werkzeug.debug', 'jam.third_party.werkzeug.wrappers', 'jam.third_party.werkzeug.secure_cookie', 'jam.third_party.esprima', 'jam.third_party.jsmin', 'jam.third_party.sqlalchemy', 'jam.third_party.sqlalchemy.dialects', 'jam.third_party.sqlalchemy.engine', 'jam.third_party.sqlalchemy.event', 'jam.third_party.sqlalchemy.pool', 'jam.third_party.sqlalchemy.sql', 'jam.third_party.sqlalchemy.util', 'jam.third_party.sqlalchemy.future' ], package_data={ 'jam': [ 'builder.html', 'langs.sqlite', 'js/*.js', 'js/ace/*.js', 'img/*.*', 'css/*.*', 'project/*.*', 'project/css/*.*', 'admin/builder_structure.info',
import os from setuptools import setup from jam import version setup( name='jam.py', version=version(), url='http://jam-py.com/', author='Andrew Yushev', author_email='*****@*****.**', description= ('Jam.py is an event-driven framework for the development of web database applications.' ), license='BSD', packages=[ 'jam', 'jam.db', 'jam.third_party', 'jam.third_party.werkzeug', 'jam.third_party.werkzeug.contrib', 'jam.third_party.werkzeug.debug', 'jam.third_party.pyjsparser' ], package_data={ 'jam': [ 'builder.html', 'langs.sqlite', 'js/*.js', 'js/ace/*.js', 'img/*.*', 'css/*.*', 'project/*.*', 'project/css/*.*', 'third_party/werkzeug/debug/shared/*.*' ] }, scripts=['jam/bin/jam-project.py'], classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License',
import os from setuptools import setup from jam import version cur_dir = os.getcwd() setup( name='jam.py', version=version(), url='http://jam-py.com/', author='Andrew Yushev', author_email='*****@*****.**', description=('Jam.py "all in the browser" framework is the fastest way to create a web database application.'), license='BSD', packages=['jam', 'jam.lang', 'jam.db', 'jam.third_party', 'jam.third_party.web', 'jam.third_party.web.contrib', 'jam.third_party.web.wsgiserver', 'jam.third_party.slimit', 'jam.third_party.slimit.ply', 'jam.third_party.slimit.visitors'], package_data={'jam': ['admin.html', 'js/*.js', 'js/ace/*.js', 'img/*.*', 'css/*.*', 'project/*.*', 'project/css/*.*', 'project/js/*.*', 'project/img/*.*']}, scripts=['jam/bin/jam-project.py'], classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7',