From 4c66cc45d3bef216c516d115297ab979a4e29fbc Mon Sep 17 00:00:00 2001 From: Patrick Gerken Date: Fri, 17 Jun 2011 16:29:35 +0200 Subject: [PATCH] unified filename prefix --- docs/index.txt | 47 +++++++++++++++++-- .../{forms.py_tmpl => faforms.py_tmpl} | 0 .../pyramid_fa/+package+/fainit.py_tmpl | 4 +- .../+package+/{fa_readme.txt => fareadme.txt} | 0 4 files changed, 46 insertions(+), 5 deletions(-) rename pyramid_formalchemy/paster_templates/pyramid_fa/+package+/{forms.py_tmpl => faforms.py_tmpl} (100%) rename pyramid_formalchemy/paster_templates/pyramid_fa/+package+/{fa_readme.txt => fareadme.txt} (100%) diff --git a/docs/index.txt b/docs/index.txt index 6e2683a..ea15405 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -17,13 +17,54 @@ It also allow to use ``FormAlchemy`` to render forms in your application. Installation ============ -With easy_install:: +pyramid_formalchemy must be a dependency of you application, so you +must add "pyramid_formalchemy" as a dependency in your setup.py under +install_requires. You must now update your environment, in case of +buildout, by running a new buildout. + +pyramid_formalchemy also provides a paster template. It can be used to +add a skeleton to an existing project or create a new project. If you +create a new project, you must first install pyramid_formalchemy in +your python environment, either with pip:: + + $ pip -i pyramid_formalchemy + +or with easy_install $ easy_install pyramid_formalchemy -It's also highly recommended to install fa.jquery to get a nicer interface:: +Only after that, the paster templates become available. +The template was made with the idea that it can be used to exist +existing applications. It does not create an app for you. For +bootstrapping your app, you need another paster template. The provided +template works well with pyramid_alchemy, pyramid_routesalchemy and +akhet. To bootstrap an application, call paster like that: - $ easy_install fa.jquery + $ paster create -t akhet -t pyramid_fa myapp + +The application is created by akhet, akhet does not know about +pyramid_formalchemy, and pyramid_formalchemy cannot modify the app +configuration. So you have to do this by hand. First, you must add the +install dependency like explained earlier. Second, you must add the +following line in the main method +that returns the wsgi app, directly after Configurator has been +created (The example assumes that the Configurator instance is stored +under the name "config"):: + + ... + config.include(myapp.fainit) + ... + +More details are explained in fareadme.txt + +To add the minimum configuration to an existing application, you +should be able to run:: + + $ paster create -t pyramid_fa myapp + +All files that paster creates are prefixed with fa, and should not +interfere with existing code. The other customizations described for +fresh applications are also valid for existing apps. Basic usage ============ diff --git a/pyramid_formalchemy/paster_templates/pyramid_fa/+package+/forms.py_tmpl b/pyramid_formalchemy/paster_templates/pyramid_fa/+package+/faforms.py_tmpl similarity index 100% rename from pyramid_formalchemy/paster_templates/pyramid_fa/+package+/forms.py_tmpl rename to pyramid_formalchemy/paster_templates/pyramid_fa/+package+/faforms.py_tmpl diff --git a/pyramid_formalchemy/paster_templates/pyramid_fa/+package+/fainit.py_tmpl b/pyramid_formalchemy/paster_templates/pyramid_fa/+package+/fainit.py_tmpl index 594ae98..7388c96 100644 --- a/pyramid_formalchemy/paster_templates/pyramid_fa/+package+/fainit.py_tmpl +++ b/pyramid_formalchemy/paster_templates/pyramid_fa/+package+/fainit.py_tmpl @@ -1,4 +1,4 @@ -from {{package}} import models, forms +from {{package}} import models, faforms def includeme(config): config.include('pyramid_formalchemy') @@ -16,6 +16,6 @@ def includeme(config): config.formalchemy_admin("/admin", models=models, - forms=forms, + forms=faforms, session_factory=session_factory, view="fa.jquery.pyramid.ModelView") diff --git a/pyramid_formalchemy/paster_templates/pyramid_fa/+package+/fa_readme.txt b/pyramid_formalchemy/paster_templates/pyramid_fa/+package+/fareadme.txt similarity index 100% rename from pyramid_formalchemy/paster_templates/pyramid_fa/+package+/fa_readme.txt rename to pyramid_formalchemy/paster_templates/pyramid_fa/+package+/fareadme.txt