diff options
| author | Patricio Paez <pp@pp.com.mx> | 2012-03-14 14:58:05 -0700 |
|---|---|---|
| committer | Patricio Paez <pp@pp.com.mx> | 2012-03-14 14:58:05 -0700 |
| commit | c884eea0abeac00fdff6821329c2981caa5c8db4 (patch) | |
| tree | b98db16b4ed1643f853364d87b608e4638111cff | |
| parent | 58df8cb0697a00f88da347db8c09f7c0148f99c0 (diff) | |
| download | pyramid-c884eea0abeac00fdff6821329c2981caa5c8db4.tar.gz pyramid-c884eea0abeac00fdff6821329c2981caa5c8db4.tar.bz2 pyramid-c884eea0abeac00fdff6821329c2981caa5c8db4.zip | |
Renamed db populate to initialize in SQL tutorial
- Replaced populate_tutorial -> initialize_tutorial_db
- Renamed populate.py -> initializedb.py
- Updated references in the documenation
13 files changed, 30 insertions, 31 deletions
diff --git a/docs/tutorials/wiki2/definingmodels.rst b/docs/tutorials/wiki2/definingmodels.rst index 0810ad1c5..81fd81156 100644 --- a/docs/tutorials/wiki2/definingmodels.rst +++ b/docs/tutorials/wiki2/definingmodels.rst @@ -54,48 +54,48 @@ in the table. The ``name`` attribute will be a text attribute, each value of which needs to be unique within the column. The ``data`` attribute is a text attribute that will hold the body of each page. -Changing ``scripts/populate.py`` --------------------------------- +Changing ``scripts/initializedb.py`` +------------------------------------ We haven't looked at the guts of this file yet, but within the ``scripts`` -directory of your ``tutorial`` package is a file named ``populate.py``. Code -in this file is executed whenever we run the ``populate_tutorial`` command +directory of your ``tutorial`` package is a file named ``initializedb.py``. Code +in this file is executed whenever we run the ``initialize_tutorial_db`` command (as we did in the installation step of this tutorial). -Since we've changed our model, we need to make changes to our ``populate.py`` +Since we've changed our model, we need to make changes to our ``initializedb.py`` script. In particular, we'll replace our import of ``MyModel`` with one of ``Page`` and we'll change the very end of the script to create a ``Page`` rather than a ``MyModel`` and add it to our ``DBSession``. -Open ``tutorial/tutorial/scripts/populate.py`` and edit it to look like the +Open ``tutorial/tutorial/scripts/initializedb.py`` and edit it to look like the following: -.. literalinclude:: src/models/tutorial/scripts/populate.py +.. literalinclude:: src/models/tutorial/scripts/initializedb.py :linenos: :language: python :emphasize-lines: 14,34 (Only the highlighted lines need to be changed.) -Repopulating the Database -------------------------- +Reinitializing the Database +--------------------------- -Because our model has changed, in order to repopulate the database, we need -to rerun the ``populate_tutorial`` command to pick up the changes you've made -to both the models.py file and to the populate.py file. From the root of the +Because our model has changed, in order to reinitialize the database, we need +to rerun the ``initialize_tutorial_db`` command to pick up the changes you've made +to both the models.py file and to the initializedb.py file. From the root of the ``tutorial`` project, directory execute the following commands. On UNIX: .. code-block:: text - $ ../bin/populate_tutorial development.ini + $ ../bin/initialize_tutorial_db development.ini On Windows: .. code-block:: text - c:\pyramidtut\tutorial> ..\Scripts\populate_tutorial development.ini + c:\pyramidtut\tutorial> ..\Scripts\initialize_tutorial_db development.ini Success will look something like this:: diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst index e5d2a0b5b..ae1396c87 100644 --- a/docs/tutorials/wiki2/installation.rst +++ b/docs/tutorials/wiki2/installation.rst @@ -96,9 +96,9 @@ On Windows: Success executing this command will end with a line to the console something like:: - Please run the "populate_tutorial" script to set up the SQL + Please run the "initialize_tutorial_db" script to set up the SQL database before starting the application (e.g. - "$myvirtualenv/bin/populate_tutorial development.ini".) + "$myvirtualenv/bin/initialize_tutorial_db development.ini".) Installing the Project in "Development Mode" ============================================ @@ -242,8 +242,8 @@ If successful, you will see something like this on your console:: This means the server is ready to accept requests. -Populating the Database -======================= +Initializing the Database +========================= In a web browser, visit ``http://localhost:6543/``. @@ -255,9 +255,9 @@ You will see an error page with a title something like this:: Oh no! Something isn't working! -This happens because we haven't populated the SQL database with any table -information yet. We need to use the ``populate_tutorial`` :term:`console -script` to populate our database before we can see the page render correctly. +This happens because we haven't initialized the SQL database with any table +information yet. We need to use the ``initialize_tutorial_db`` :term:`console +script` to initialize our database before we can see the page render correctly. Stop the running Pyramid application by pressing ``ctrl-C`` in the console. Make sure you're still in the ``tutorial`` directory (the directory with a @@ -267,13 +267,13 @@ On UNIX: .. code-block:: text - $ ../bin/populate_tutorial development.ini + $ ../bin/initialize_tutorial_db development.ini On Windows: .. code-block:: text - c:\pyramidtut\tutorial> ..\Scripts\populate_tutorial development.ini + c:\pyramidtut\tutorial> ..\Scripts\initialize_tutorial_db development.ini The output to your console should be something like this:: diff --git a/docs/tutorials/wiki2/src/authorization/setup.py b/docs/tutorials/wiki2/src/authorization/setup.py index 964e39010..2fd051927 100644 --- a/docs/tutorials/wiki2/src/authorization/setup.py +++ b/docs/tutorials/wiki2/src/authorization/setup.py @@ -40,6 +40,6 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main [console_scripts] - populate_tutorial = tutorial.scripts.populate:main + initialize_tutorial_db = tutorial.scripts.initializedb:main """, ) diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/scripts/populate.py b/docs/tutorials/wiki2/src/authorization/tutorial/scripts/initializedb.py index 03188e8ad..03188e8ad 100644 --- a/docs/tutorials/wiki2/src/authorization/tutorial/scripts/populate.py +++ b/docs/tutorials/wiki2/src/authorization/tutorial/scripts/initializedb.py diff --git a/docs/tutorials/wiki2/src/basiclayout/setup.py b/docs/tutorials/wiki2/src/basiclayout/setup.py index fae1c25a8..050de7299 100644 --- a/docs/tutorials/wiki2/src/basiclayout/setup.py +++ b/docs/tutorials/wiki2/src/basiclayout/setup.py @@ -39,7 +39,7 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main [console_scripts] - populate_tutorial = tutorial.scripts.populate:main + initialize_tutorial_db = tutorial.scripts.initializedb:main """, ) diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/scripts/populate.py b/docs/tutorials/wiki2/src/basiclayout/tutorial/scripts/initializedb.py index 0e828465f..0e828465f 100644 --- a/docs/tutorials/wiki2/src/basiclayout/tutorial/scripts/populate.py +++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/scripts/initializedb.py diff --git a/docs/tutorials/wiki2/src/models/setup.py b/docs/tutorials/wiki2/src/models/setup.py index fae1c25a8..050de7299 100644 --- a/docs/tutorials/wiki2/src/models/setup.py +++ b/docs/tutorials/wiki2/src/models/setup.py @@ -39,7 +39,7 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main [console_scripts] - populate_tutorial = tutorial.scripts.populate:main + initialize_tutorial_db = tutorial.scripts.initializedb:main """, ) diff --git a/docs/tutorials/wiki2/src/models/tutorial/scripts/populate.py b/docs/tutorials/wiki2/src/models/tutorial/scripts/initializedb.py index 03188e8ad..03188e8ad 100644 --- a/docs/tutorials/wiki2/src/models/tutorial/scripts/populate.py +++ b/docs/tutorials/wiki2/src/models/tutorial/scripts/initializedb.py diff --git a/docs/tutorials/wiki2/src/tests/setup.py b/docs/tutorials/wiki2/src/tests/setup.py index d05495fbd..0f58d8a18 100644 --- a/docs/tutorials/wiki2/src/tests/setup.py +++ b/docs/tutorials/wiki2/src/tests/setup.py @@ -41,6 +41,6 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main [console_scripts] - populate_tutorial = tutorial.scripts.populate:main + initialize_tutorial_db = tutorial.scripts.initializedb:main """, ) diff --git a/docs/tutorials/wiki2/src/tests/tutorial/scripts/populate.py b/docs/tutorials/wiki2/src/tests/tutorial/scripts/initializedb.py index 03188e8ad..03188e8ad 100644 --- a/docs/tutorials/wiki2/src/tests/tutorial/scripts/populate.py +++ b/docs/tutorials/wiki2/src/tests/tutorial/scripts/initializedb.py diff --git a/docs/tutorials/wiki2/src/views/setup.py b/docs/tutorials/wiki2/src/views/setup.py index 834280118..34b578e21 100644 --- a/docs/tutorials/wiki2/src/views/setup.py +++ b/docs/tutorials/wiki2/src/views/setup.py @@ -40,7 +40,7 @@ setup(name='tutorial', [paste.app_factory] main = tutorial:main [console_scripts] - populate_tutorial = tutorial.scripts.populate:main + initialize_tutorial_db = tutorial.scripts.initializedb:main """, ) diff --git a/docs/tutorials/wiki2/src/views/tutorial/scripts/populate.py b/docs/tutorials/wiki2/src/views/tutorial/scripts/initializedb.py index 03188e8ad..03188e8ad 100644 --- a/docs/tutorials/wiki2/src/views/tutorial/scripts/populate.py +++ b/docs/tutorials/wiki2/src/views/tutorial/scripts/initializedb.py diff --git a/docs/tutorials/wiki2/tests.rst b/docs/tutorials/wiki2/tests.rst index 92544404c..86880fb18 100644 --- a/docs/tutorials/wiki2/tests.rst +++ b/docs/tutorials/wiki2/tests.rst @@ -13,9 +13,8 @@ We write a test class for the model class ``Page`` and another test class for the ``initialize_sql`` function. To do so, we'll retain the ``tutorial.tests.ViewTests`` class provided as a -result of the ``alchemy`` scaffold. We'll add two test classes: one for the -``Page`` model named ``PageModelTests``, and one for the ``populate`` script -named ``Test_populate``. +result of the ``alchemy`` scaffold. We'll add a test class named +``PageModelTests`` for the ``Page`` model. Testing the Views ================= |
