From e3b8af15e3a22e2ce0837061679881524a35e106 Mon Sep 17 00:00:00 2001 From: Gael Pasgrimaud Date: Thu, 20 Oct 2011 00:29:41 +0200 Subject: [PATCH] try to add fa.bootstrap --- .gitmodules | 3 +++ buildout.cfg | 4 +++- development.ini | 17 +++++++++++++++-- fa.bootstrap | 1 + fa.jquery | 2 +- formalchemy | 2 +- formalchemy_project/__init__.py | 1 + formalchemy_project/fa_bootstrap.py | 25 +++++++++++++++++++++++++ formalchemy_project/models.py | 2 +- pyramid_formalchemy | 2 +- setup.py | 1 + 11 files changed, 53 insertions(+), 7 deletions(-) create mode 160000 fa.bootstrap create mode 100644 formalchemy_project/fa_bootstrap.py diff --git a/.gitmodules b/.gitmodules index 87af7bd..ba60e78 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "fa.extjs"] path = fa.extjs url = git@github.com:FormAlchemy/fa.extjs.git +[submodule "fa.bootstrap"] + path = fa.bootstrap + url = git@github.com:FormAlchemy/fa.bootstrap.git diff --git a/buildout.cfg b/buildout.cfg index fa75eba..160fcd1 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -1,7 +1,7 @@ [buildout] newest = false parts = eggs supervisor -develop = . formalchemy fa.jquery fa.extjs pyramid_formalchemy pyramid_formalchemy/pyramidapp +develop = . formalchemy fa.jquery fa.extjs fa.bootstrap pyramid_formalchemy pyramid_formalchemy/pyramidapp [eggs] recipe = z3c.recipe.scripts @@ -10,9 +10,11 @@ eggs = Pygments formalchemy fa.jquery + fa.bootstrap fa.extjs Pylons pyramid_formalchemy + pyramid_tm fanstatictemplate pyramidapp ipython diff --git a/development.ini b/development.ini index 24abdfc..efbf39c 100644 --- a/development.ini +++ b/development.ini @@ -17,6 +17,7 @@ use = egg:Paste#urlmap /fa.jquery = fa.jquery /jquery = egg:fa.jquery /demo = demo +/fa.bootstrap = bootstrap / = docs [app:pyramid_formalchemy] @@ -53,13 +54,25 @@ default_locale_name = fr available_languages = fr en pt_BR available_themes = * - [pipeline:demo] pipeline = egg:WebError#evalerror - egg:repoze.tm2#tm pyramid +[app:bootstrap] +use = egg:formalchemy_project#bootstrap +reload_templates = true +debug_authorization = false +debug_notfound = false +debug_routematch = false +debug_templates = true +default_locale_name = en +sqlalchemy.url = sqlite:///%(here)s/demo.db +default_locale_name = fr +available_languages = fr en pt_BR +available_themes = * + + [server:main] use = egg:Paste#http host = 0.0.0.0 diff --git a/fa.bootstrap b/fa.bootstrap new file mode 160000 index 0000000..1919fd0 --- /dev/null +++ b/fa.bootstrap @@ -0,0 +1 @@ +Subproject commit 1919fd086326c594edf566189a0b949a5fc834ab diff --git a/fa.jquery b/fa.jquery index dd464a7..f418a92 160000 --- a/fa.jquery +++ b/fa.jquery @@ -1 +1 @@ -Subproject commit dd464a7c442bf0b58e9f049d6e8f8653ead4e233 +Subproject commit f418a923e13a612bed34f53a68252ffd8b622a3f diff --git a/formalchemy b/formalchemy index 15c85b3..f18a7e6 160000 --- a/formalchemy +++ b/formalchemy @@ -1 +1 @@ -Subproject commit 15c85b32b406ad74bf2c45ee273947ccefef6697 +Subproject commit f18a7e627932e883b7e61099f815ebfa694af69f diff --git a/formalchemy_project/__init__.py b/formalchemy_project/__init__.py index a63b97d..fc5e5ea 100644 --- a/formalchemy_project/__init__.py +++ b/formalchemy_project/__init__.py @@ -9,6 +9,7 @@ def main(global_config, **settings): engine = engine_from_config(settings, 'sqlalchemy.') models.initialize_sql(engine) config = Configurator(settings=settings) + config.include('pyramid_tm') config.add_translation_dirs('formalchemy_project:locale/') # pyramid_formalchemy's configuration diff --git a/formalchemy_project/fa_bootstrap.py b/formalchemy_project/fa_bootstrap.py new file mode 100644 index 0000000..7ab8924 --- /dev/null +++ b/formalchemy_project/fa_bootstrap.py @@ -0,0 +1,25 @@ +from pyramid.config import Configurator +from sqlalchemy import engine_from_config + +from formalchemy_project import models + +def main(global_config, **settings): + """ This function returns a Pyramid WSGI application. + """ + engine = engine_from_config(settings, 'sqlalchemy.') + models.initialize_sql(engine) + config = Configurator(settings=settings) + config.include('pyramid_tm') + config.add_translation_dirs('formalchemy_project:locale/') + + # pyramid_formalchemy's configuration + config.include('pyramid_formalchemy') + config.include('fa.bootstrap') + config.include('fa.extjs') + + # Admin UI (Used for the demo. Not really useful here...) + config.formalchemy_admin('/admin', package='formalchemy_project', view='fa.bootstrap.views.ModelView') + + return config.make_wsgi_app() + + diff --git a/formalchemy_project/models.py b/formalchemy_project/models.py index 437aa5f..1120088 100644 --- a/formalchemy_project/models.py +++ b/formalchemy_project/models.py @@ -190,5 +190,5 @@ def initialize_sql(engine): Base.metadata.create_all(engine) try: populate() - except IntegrityError, e: + except: DBSession.rollback() diff --git a/pyramid_formalchemy b/pyramid_formalchemy index 31811a3..c7fee04 160000 --- a/pyramid_formalchemy +++ b/pyramid_formalchemy @@ -1 +1 @@ -Subproject commit 31811a38a7bd2577cdbc56f52189ba138bf04e1e +Subproject commit c7fee04ee2483034e4320b9b23b0dbc24fa06f0b diff --git a/setup.py b/setup.py index 1283833..a3b77d5 100644 --- a/setup.py +++ b/setup.py @@ -45,6 +45,7 @@ entry_points = """\ [paste.app_factory] main = formalchemy_project:main + bootstrap = formalchemy_project.fa_bootstrap:main """, paster_plugins=['pyramid'], )