Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Renamed db populate to initialize in SQL tutorial

- Replaced populate_tutorial -> initialize_tutorial_db
- Renamed populate.py -> initializedb.py
- Updated references in the documenation
  • Loading branch information...
commit c884eea0abeac00fdff6821329c2981caa5c8db4 1 parent 58df8cb
@ppaez ppaez authored
View
28 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::
View
18 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::
View
2  docs/tutorials/wiki2/src/authorization/setup.py
@@ -40,6 +40,6 @@
[paste.app_factory]
main = tutorial:main
[console_scripts]
- populate_tutorial = tutorial.scripts.populate:main
+ initialize_tutorial_db = tutorial.scripts.initializedb:main
""",
)
View
0  ...i2/src/views/tutorial/scripts/populate.py → ...rization/tutorial/scripts/initializedb.py
File renamed without changes
View
2  docs/tutorials/wiki2/src/basiclayout/setup.py
@@ -39,7 +39,7 @@
[paste.app_factory]
main = tutorial:main
[console_scripts]
- populate_tutorial = tutorial.scripts.populate:main
+ initialize_tutorial_db = tutorial.scripts.initializedb:main
""",
)
View
0  .../basiclayout/tutorial/scripts/populate.py → ...iclayout/tutorial/scripts/initializedb.py
File renamed without changes
View
2  docs/tutorials/wiki2/src/models/setup.py
@@ -39,7 +39,7 @@
[paste.app_factory]
main = tutorial:main
[console_scripts]
- populate_tutorial = tutorial.scripts.populate:main
+ initialize_tutorial_db = tutorial.scripts.initializedb:main
""",
)
View
0  ...i2/src/tests/tutorial/scripts/populate.py → ...c/models/tutorial/scripts/initializedb.py
File renamed without changes
View
2  docs/tutorials/wiki2/src/tests/setup.py
@@ -41,6 +41,6 @@
[paste.app_factory]
main = tutorial:main
[console_scripts]
- populate_tutorial = tutorial.scripts.populate:main
+ initialize_tutorial_db = tutorial.scripts.initializedb:main
""",
)
View
0  ...2/src/models/tutorial/scripts/populate.py → ...rc/tests/tutorial/scripts/initializedb.py
File renamed without changes
View
2  docs/tutorials/wiki2/src/views/setup.py
@@ -40,7 +40,7 @@
[paste.app_factory]
main = tutorial:main
[console_scripts]
- populate_tutorial = tutorial.scripts.populate:main
+ initialize_tutorial_db = tutorial.scripts.initializedb:main
""",
)
View
0  ...uthorization/tutorial/scripts/populate.py → ...rc/views/tutorial/scripts/initializedb.py
File renamed without changes
View
5 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
=================
Please sign in to comment.
Something went wrong with that request. Please try again.