def init(name): class Barrel(Blueprint): def __init__(self, app): Blueprint.__init__(self, __name__, __name__, template_folder='templates', static_folder='static/barrel') app = Flask(name) app.register_blueprint(Barrel(app)) app.config.from_object('cfg') app.jinja_env.trim_blocks = True app.jinja_env.lstrip_blocks = True logger.enable(app) app.logger.info('App name: %s' % app.name) # if 'DEBUG' in app.config and app.config['DEBUG']: # from flask_debugtoolbar import DebugToolbarExtension # DebugToolbarExtension(app) if 'SQLALCHEMY_DATABASE_URI' in app.config: db.enable(app) return app
# # JMdictDB is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with JMdictDB; if not, write to the Free Software Foundation, # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA ####################################################################### import sys, cgi sys.path.extend(['../lib', '../../python/lib', '../python/lib']) import logger from logger import L logger.enable() import jdb, jmcgi def main(args, opts): jdb.reset_encoding(sys.stdout, 'utf-8') try: form, svc, dbg, cur, sid, sess, parms, cfg = jmcgi.parseform() except Exception as e: jmcgi.err_page([str(e)]) jmcgi.jinja_page("edhelpq.jinja", cfg=cfg, svc=svc, dbg=dbg) if __name__ == '__main__': args, opts = jmcgi.args() main(args, opts)
# by the Free Software Foundation; either version 2 of the License, # or (at your option) any later version. # # JMdictDB is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with JMdictDB; if not, write to the Free Software Foundation, # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA ####################################################################### import sys, cgi, datetime sys.path.extend (['../lib','../../python/lib','../python/lib']) import logger; from logger import L; logger.enable() import jdb, jmcgi import fmtxml, fmtjel, xslfmt import logger; from logger import L def main (args, opts): jdb.reset_encoding (sys.stdout, 'utf-8') errs = [] try: form, svc, dbg, cur, sid, sess, parms, cfg = jmcgi.parseform() except Exception as e: jmcgi.err_page ([str (e)]) entries = jmcgi.get_entrs (cur, form.getlist ('e'), form.getlist ('q'), errs) if errs: jmcgi.err_page (errs) # Add a .SEQKR attribute to each entry in 'entries' that # gives the kanji and reading of the newest (most recently