Commits

Marcin Kuzminski committed 36506d6 Merge
  • Participants
  • Parent commits 3459395, c8eda08

Comments (0)

Files changed (10)

 c0c74051c20137c280c6664fe9ad24588f557b97 pyramid_sqla-dev
 46a7645f42ee92f050c68b8ff81a712e58b594d8 ../SQLAHelper
 c6a6249d813e2385f1c95c56ec23467355ccb7a5 v1.0b1
-6d588d0da8253dc295fbb79ced125a59158a6aea v
-6d588d0da8253dc295fbb79ced125a59158a6aea 1.0b2
+6d588d0da8253dc295fbb79ced125a59158a6aea v1.0b2
+d992801476f924ef5ce4779e8c0730b2b03b1ab6 v1.0.1
+1a13f0c9a754a071de548c6c8edec43a794f6cae v1.0.2
-1.0.1 (unreleased)
-----------------
-- Bug in ``URLGenerator.app``: returns wrong value.
+1.0.1 (2011-07-18)
+------------------
+- Fix bug in ``URLGenerator.app``: it was returning the wrong value and was
+  documented wrong.
 
 1.0 (2011-04-04)
 ----------------

File akhet/paster_templates/akhet/+package+/scripts/create_db.py_tmpl

 from pyramid.paster import get_app
 import transaction
 
+import sqlalchemy
 import {{package}}.models as models
 
 def main():
     logging.config.fileConfig(ini_file)
     log = logging.getLogger(__name__)
     app = get_app(ini_file, "myapp")
-    #settings = app.registry.settings
+    settings = app.registry.settings
+    
+    # create all engines and connections, if you're using more than one engine
+    # also define it here and add into sqlahelper
+    
+    engine = sqlalchemy.engine_from_config(settings,
+                                           prefix="sqlalchemy.url.")
 
-    # Abort if any tables exist to prevent accidental overwriting
+    sqlahelper.add_engine(engine)
+    
+    tables = list()
+    
+    # Check for any existing tables, and add only tables that are not present
+    # in current database skipping those already created
     for table in models.Base.metadata.sorted_tables:
         log.debug("checking if table '%s' exists", table.name)
-        if table.exists():
-            raise RuntimeError("database table '%s' exists" % table.name)
+        if not table.exists():
+            tables.append(table)
 
     # Create the tables
-    models.Base.metadata.create_all()
+    models.Base.metadata.create_all(tables=tables)
     sess = models.Session()
 
     # Record 1

File akhet/paster_templates/akhet/+package+/templates/site.html

     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
     <meta name="keywords" content="python web application" />
     <meta name="description" content="pyramid web application" />
-    <link rel="shortcut icon" href="${url.app}favicon.ico" />
-    <link rel="stylesheet" href="${url.app}stylesheets/default.css" type="text/css" media="screen" charset="utf-8" />
+    <link rel="shortcut icon" href="${url.app}/favicon.ico" />
+    <link rel="stylesheet" href="${url.app}/stylesheets/default.css" type="text/css" media="screen" charset="utf-8" />
 ${self.head_extra()}
   </head>
   <body>
     <div id="header">
-    <img src="${url.app}images/pyramid-negative.png" alt="" />
+    <img src="${url.app}/images/pyramid-negative.png" alt="" />
     </div>
 
 <div id="content">

File akhet/tests/make_test_app.sh

 
 paster create -t akhet $APPNAME $*
 cd $APPNAME
+pip install -r requirements.txt
+python setup.py egg_info
 paster serve development.ini

File akhet/tests/test_urlgenerator.py

         request = testing.DummyRequest()
         inst = self._makeOne(context, request, False)
         result = inst.app
-        self.assertEqual(result, '/')
+        self.assertEqual(result, '')
 
     def test_route_qualified(self):
         self.config.add_route('home', '/')

File docs/conf.py

 # built documents.
 #
 # The short X.Y version.
-version = '1.0.1'
+version = '1.0.2'
 # The full version, including alpha/beta/rc tags.
-release = '1.0.1'
+release = '1.0.2'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.

File docs/index.rst

 Akhet
 =====
-:Version: 1.0, released 2011-04-04
+:Version: 1.0.2, released 2011-07-20
 :PyPI: http://pypi.python.org/pypi/Akhet
 :Docs: http://docs.pylonsproject.org/projects/akhet/dev/
 :Source: https://bitbucket.org/sluggo/akhet (Mercurial)
 introduction to the Pyramid manual, which some people find overwhelming at
 first. This manual assumes you're familiar with Python web development.
 
-Coming soon: tutorials for new web developers, and a higher-level skeleton with
-more batteries. These are being written by third parties.
+Version 1.0.2 fixes a bug in ``URLGenerator.app`` (aka ``url.app`` in
+templates).
+
+**Existing Akhet applications:** Akhet 1.1 will be released soon, and will
+depend on Pyramid 1.1. If you don't want to upgrade, set your dependencies in your
+application's *setup.py*: "Akhet>= 1.0, <= 1.0.99" and "pyramid>=1.0a10, <=
+1.0.99".
 
 .. _Pyramid: http://docs.pylonshq.com/pyramid/dev/
 .. _pylons-discuss: http://groups.google.com/group/pylons-discuss

File docs/usage.rst

     reading manifest file 'Zzz.egg-info/SOURCES.txt'
     writing manifest file 'Zzz.egg-info/SOURCES.txt'
 
-.. tip::
-
-    Whenever you run the application, re-run this command first *if* you've
-    added/deleted any files or modified *setup.py*. You do not have to re-run
-    it if you've merely modified the files.
-
 The application should now run out of the box:
 
 .. code-block:: sh
 If you're porting an existing Pylons application to Pyramid, the Architecture
 and Migration chapters should get you started.
 
+**Important**: Whenever you add or delete files in the application, remember to
+re-execute the "python setup.py egg_info" step before running the application
+again. This updates the package's metadata to reflect the new files. Otherwise
+Python may not be able to find them.
+
+Installing the application
+==========================
+
+So far we haven't installed the application, so Python is looking in the
+current directory for the ``zzz`` package and ``Zzz.egg-info`` metadata. This
+is convenient during early development because we can create and delete scrath
+applications quickly without installing them into the virtualenv and
+uninstalling them. However, for production and beta testing you should formally
+install the application; that way you can run it from any directory (by
+specifying the path to the INI file). 
+
+You can install a link to the application's source directory by running "pip
+install -e .". This installs an "egg link" file pointing to the source
+directory, so that Python will immediately see any changes in the source. This
+is useful in development, and some production deployments also use this system.
+
+The other option is to install a snapshot of the application's current state.
+This copies the package's files to the virtualenv's *site-packages* directory,
+so that Python will not see any subsequent changes in the source until you
+reinstall the application. The command for this is "pip install .". This is the
+same thing that happens when you install a third-party package (e.g., "pip
+install Akhet").
+
+If you're using easy_install rather than pip, the command to install an egg
+link is "python setup.py develop". The command to install a snapshot is
+"easy_install ." or "python setup.py install".
+
+Uninstalling the application
+============================
+
+To uninstall an application that was installed as a pip snapshot, cd to a
+distant directory (not the application source or its parent) and run "pip
+uninstall Zzz". This should supposedly work with a pip egg link too but it
+hasn't always worked for me. It also works with external packages that were
+installed with pip; e.g., "pip uninstall Akhet".
+
+Easy_install does not have an uninstall command, so you'll have to uninstall it
+manually in that case.
+
+To uninstall the application (or any Python package) manually, cd to the
+virtualenv's *site-packages* directory. Delete any subdirectories and files
+corresponding to the Python package, its metadata, or its egg link. For our
+sample application these would be *zzz* (Python package), *Zzz.egg-info*
+(pip egg_info), *Zzz.egg* (easy_install directory or ZIP file), and
+*Zzz.egg-link* (egg link file). Also look in *easy-install.pth* and delete
+the application's line if present.
+
+
 .. _Pyramid documentation: http://docs.pylonsproject.org/
 .. _Pyramid tutorials: http://docs.pylonsproject.org/projects/pyramid_tutorials/dev/
 .. _virtualenv: http://pypi.python.org/pypi/virtualenv
 """
 
 setup(name="Akhet",
-      version="1.0.1",
+      version="1.0.2",
       description="Pyramid application templates inspired by Pylons 1.",
       long_description=README,
       #long_description=README + "\n\n" +  CHANGES,