summaryrefslogtreecommitdiff
path: root/docs/tutorials
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2013-09-07 01:37:43 -0400
committerChris McDonough <chrism@plope.com>2013-09-07 01:37:43 -0400
commite5374481eee64974d083ea74a293e999bf8c4205 (patch)
tree2bfbe7e944decfc889e043e520bc98ecd0e590b9 /docs/tutorials
parent90b9686a20e6465b9a97ce02e4d10080c0cf271e (diff)
parent60945d27ec06ca5c1855e7d8341d010f51153e60 (diff)
downloadpyramid-e5374481eee64974d083ea74a293e999bf8c4205.tar.gz
pyramid-e5374481eee64974d083ea74a293e999bf8c4205.tar.bz2
pyramid-e5374481eee64974d083ea74a293e999bf8c4205.zip
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/tutorials')
-rw-r--r--docs/tutorials/wiki2/authorization.rst4
-rw-r--r--docs/tutorials/wiki2/basiclayout.rst15
-rw-r--r--docs/tutorials/wiki2/definingmodels.rst2
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/models.py3
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/models.py4
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/models.py4
-rw-r--r--docs/tutorials/wiki2/src/tests/tutorial/models.py3
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/models.py4
8 files changed, 14 insertions, 25 deletions
diff --git a/docs/tutorials/wiki2/authorization.rst b/docs/tutorials/wiki2/authorization.rst
index 01c301e74..2af56868c 100644
--- a/docs/tutorials/wiki2/authorization.rst
+++ b/docs/tutorials/wiki2/authorization.rst
@@ -83,7 +83,7 @@ statement at the head:
Add the following class definition:
.. literalinclude:: src/authorization/tutorial/models.py
- :lines: 36-40
+ :lines: 33-37
:linenos:
:language: python
@@ -339,7 +339,7 @@ when we're done:
.. literalinclude:: src/authorization/tutorial/models.py
:linenos:
- :emphasize-lines: 1-4,36-40
+ :emphasize-lines: 1-4,33-37
:language: python
(Only the highlighted lines need to be added.)
diff --git a/docs/tutorials/wiki2/basiclayout.rst b/docs/tutorials/wiki2/basiclayout.rst
index 0193afab4..1f3d630c7 100644
--- a/docs/tutorials/wiki2/basiclayout.rst
+++ b/docs/tutorials/wiki2/basiclayout.rst
@@ -225,10 +225,17 @@ To give a simple example of a model class, we define one named ``MyModel``:
:linenos:
:language: py
-Our example model has an ``__init__`` method that takes two arguments
-(``name``, and ``value``). It stores these values as ``self.name`` and
-``self.value`` on the instance created by the ``__init__`` function itself.
-The ``MyModel`` class also has a ``__tablename__`` attribute. This informs
+Our example model does not require an ``__init__`` method because SQLAlchemy
+supplies for us a default constructor if one is not already present,
+which accepts keyword arguments of the same name as that of the mapped attributes.
+
+.. note:: Example usage of MyModel:
+
+ .. code-block:: python
+
+ johnny = MyModel(name="John Doe", value=10)
+
+The ``MyModel`` class has a ``__tablename__`` attribute. This informs
SQLAlchemy which table to use to store the data representing instances of this
class.
diff --git a/docs/tutorials/wiki2/definingmodels.rst b/docs/tutorials/wiki2/definingmodels.rst
index 60427a911..e30af12b2 100644
--- a/docs/tutorials/wiki2/definingmodels.rst
+++ b/docs/tutorials/wiki2/definingmodels.rst
@@ -24,7 +24,7 @@ following:
.. literalinclude:: src/models/tutorial/models.py
:linenos:
:language: py
- :emphasize-lines: 20-22,25,27,29
+ :emphasize-lines: 20-22,25
(The highlighted lines are the ones that need to be changed.)
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/models.py b/docs/tutorials/wiki2/src/authorization/tutorial/models.py
index 91e5a0019..4f7e1e024 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/models.py
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/models.py
@@ -29,9 +29,6 @@ class Page(Base):
name = Column(Text, unique=True)
data = Column(Text)
- def __init__(self, name, data):
- self.name = name
- self.data = data
class RootFactory(object):
__acl__ = [ (Allow, Everyone, 'view'),
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/models.py b/docs/tutorials/wiki2/src/basiclayout/tutorial/models.py
index aeeb9df64..0cdd4bbc3 100644
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/models.py
+++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/models.py
@@ -22,7 +22,3 @@ class MyModel(Base):
id = Column(Integer, primary_key=True)
name = Column(Text, unique=True)
value = Column(Integer)
-
- def __init__(self, name, value):
- self.name = name
- self.value = value
diff --git a/docs/tutorials/wiki2/src/models/tutorial/models.py b/docs/tutorials/wiki2/src/models/tutorial/models.py
index 9a078d757..f028c917a 100644
--- a/docs/tutorials/wiki2/src/models/tutorial/models.py
+++ b/docs/tutorials/wiki2/src/models/tutorial/models.py
@@ -23,7 +23,3 @@ class Page(Base):
id = Column(Integer, primary_key=True)
name = Column(Text, unique=True)
data = Column(Text)
-
- def __init__(self, name, data):
- self.name = name
- self.data = data
diff --git a/docs/tutorials/wiki2/src/tests/tutorial/models.py b/docs/tutorials/wiki2/src/tests/tutorial/models.py
index 91e5a0019..4f7e1e024 100644
--- a/docs/tutorials/wiki2/src/tests/tutorial/models.py
+++ b/docs/tutorials/wiki2/src/tests/tutorial/models.py
@@ -29,9 +29,6 @@ class Page(Base):
name = Column(Text, unique=True)
data = Column(Text)
- def __init__(self, name, data):
- self.name = name
- self.data = data
class RootFactory(object):
__acl__ = [ (Allow, Everyone, 'view'),
diff --git a/docs/tutorials/wiki2/src/views/tutorial/models.py b/docs/tutorials/wiki2/src/views/tutorial/models.py
index 9a078d757..f028c917a 100644
--- a/docs/tutorials/wiki2/src/views/tutorial/models.py
+++ b/docs/tutorials/wiki2/src/views/tutorial/models.py
@@ -23,7 +23,3 @@ class Page(Base):
id = Column(Integer, primary_key=True)
name = Column(Text, unique=True)
data = Column(Text)
-
- def __init__(self, name, data):
- self.name = name
- self.data = data