Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
--HG--
branch : trunk
  • Loading branch information
bbangert committed Feb 4, 2009
2 parents e612af3 + 2d956e9 commit efa2d4c
Show file tree
Hide file tree
Showing 5 changed files with 349 additions and 380 deletions.
16 changes: 8 additions & 8 deletions pylons/docs/en/models.rst
Expand Up @@ -151,7 +151,7 @@ definitions and ORM classes, and an ``init_model()`` function which must be
called at application startup. *meta.py* is merely a container for
SQLAlchemy's housekeeping objects (``Session``, ``metadata``, and ``engine``),
which not all applications will use. If your application is small, you can put
your the table definitions in **__init__.py** for simplicity. If your
your table definitions in *__init__.py* for simplicity. If your
application has many tables or multiple databases, you may prefer to split them
up into multiple modules within the model.

Expand All @@ -164,7 +164,7 @@ the default model with the comments removed:

.. code-block:: python
import sqalqlchemy as sa
import sqlalchemy as sa
import sqlalchemy.orm as orm
from myapp.model import meta
Expand All @@ -177,7 +177,7 @@ the default model with the comments removed:
t_persons = sa.Table("persons", meta.metadata,
sa.Column("id", sa.types.Integer, primary_key=True),
sa.Column("name", sa.types.String(100), primary_key=True),
sa.Column("email", sa.types.String(100),
sa.Column("email", sa.types.String(100)),
)
class Person(object):
Expand All @@ -204,7 +204,7 @@ database.) Here's the second example with reflection:

.. code-block:: python
import sqalqlchemy as sa
import sqlalchemy as sa
import sqlalchemy.orm as orm
from myapp.model import meta
Expand All @@ -225,7 +225,7 @@ database.) Here's the second example with reflection:
Note how ``t_persons`` and the ``orm.mapper()`` call moved into ``init_model``,
while the ``Person`` class didn't have to. Also note the ``global t_persons``
statement. This tells Python that ``t_persons`` is a a global variable outside
statement. This tells Python that ``t_persons`` is a global variable outside
the function. ``global`` is required when assigning to a global variable
inside a function. It's not required if you're merely modifying a mutable
object in place, which is why ``meta`` doesn't have to be declared global.
Expand All @@ -235,7 +235,7 @@ the ORM class in one step:

.. code-block:: python
import sqalqlchemy as sa
import sqlalchemy as sa
import sqlalchemy.orm as orm
import sqlalchemy.ext.declarative as declarative
Expand Down Expand Up @@ -311,7 +311,6 @@ You now have everything necessary to use the model in a standalone script such a
>>> from myapp import model
>>> model.init_model(engine)
i
Now you can use the tables, classes, and Session as described in the SQLAlchemy
manual. For example:

Expand Down Expand Up @@ -604,7 +603,7 @@ To search on a joined object we can pass an entire object as a query:
person_q.filter(Person.my_addresses.contains(search_address)).all()
* All attributes must match in the query object.
All attributes must match in the query object.

Or we can search on a joined objects' property,

Expand Down Expand Up @@ -723,6 +722,7 @@ Normal model usage works fine in model tests, however to use the metadata you mu
def test_index(self):
# test your models
pass
.. note:: Notice that the tests inherit from TestController. This is to ensure that the application is setup so that the models will work.
Expand Down
63 changes: 37 additions & 26 deletions pylons/docs/ja/forms.rst
Expand Up @@ -96,18 +96,13 @@ Pylons では、すべてのフォーム変数は辞書のように振る舞う

.. Note::

.. `request` is actually a `WSGIRequest` object `documented here
.. <http://pythonpaste.org/class-paste.wsgiwrappers.WSGIRequest.html#params>`_
.. and `request.params` is a `MultiDict` with `documentation here
.. <http://pythonpaste.org/class-paste.util.multidict.MultiDict.html>`_.
`request` は実際には `ここで文書化される
<http://pythonpaste.org/class-paste.wsgiwrappers.WSGIRequest.html#params>`_
`WSGIRequest` オブジェクトです。また、 `request.params` は `ここに
文書のある
<http://pythonpaste.org/class-paste.util.multidict.MultiDict.html>`_
`MultiDict` です。
.. `request` and `response` are objects from the `WebOb` library.
.. Full documentation on their attributes and methods is `here
.. <http://pythonpaste.org/webob/>`_.
`request` と `response` は `WebOb` ライブラリのオブジェクトです。そ
の属性とメソッドの完全なドキュメントは `ここ
<http://pythonpaste.org/webob/>`_ にあります。


.. If you have two fields with the same name in the form then using
Expand Down Expand Up @@ -228,33 +223,49 @@ http://localhost:5000/hello/email です。データは URL の代わりにリ
helpers を使う
=================

.. Creating forms can also be done using Pylons' `built in helpers
.. <http://pylonshq.com/WebHelpers/module-index.html>`_. Here is the
.. same form created in the previous section but this time using the
.. helpers:
.. Creating forms can also be done using WebHelpers, which comes with
.. Pylons. Here is the same form created in the previous section but
.. this time using the helpers:
また、 Pylons の `組み込みの helpers
<http://pylonshq.com/WebHelpers/module-index.html>`_ を使用してフォーム
を作成することができます。これは前のセクションで作成したのと同じフォー
また、フォームを作成するのに WebHelpers を使用することができます。それ
は Pylons に付属しています。これは前のセクションで作成したのと同じフォー
ムですが、今回は helpers を使用しています:


.. code-block:: html+mako

${h.form(h.url(action='email'), method='get')}
Email Address: ${h.text_field('email')}
Email Address: ${h.text('email')}
${h.submit('Submit')}
${h.end_form()}


.. You can also make use of the built-in script.aculo.us functionality
.. or override the default behavior of any of the helpers by defining
.. a new function of the same name at the bottom of your project's
.. `lib/helpers.py` file.
.. Before doing this you'll have to import the helpers you want to use
.. into your project's `lib/helpers.py` file; then they'll be
.. available under Pylons' ``h`` global. Most projects will want to
.. import at least these:
これをする前に、使用したい helper をプロジェクトの `lib/helpers.py` ファ
イルの中にインポートする必要があるでしょう。そうすれば、それらは
Pylons の ``h`` グローバル変数の下で利用可能になります。 ほとんどのプロ
ジェクトでは少なくともこれらをインポートするとよいでしょう:


.. code-block:: python
from webhelpers.html import escape, HTML, literal, url_escape
from webhelpers.html.tags import *
.. There are many other helpers for text formatting, container
.. objects, statistics, and for dividing large query results into
.. pages. See the :mod:`WebHelpers documentation <webhelpers>`
.. documentation to choose the helpers you'll need.
組み込みの script.aculo.us の機能を利用したり、プロジェクトの
`lib/helpers.py` ファイルの最後で同じ名前の新しい関数を定義することによっ
て helpers のデフォルトの振舞いをオーバーライドすることもできます。
他にもテキスト整形やコンテナーオブジェクト、統計、および巨大なクエリ結
果をページに分割するための多くの helper があります。 :mod:`WebHelpers
のドキュメント <webhelpers>` を見て、あなたが必要とする helper を選んで
ください。


.. _file_uploads:
Expand Down
4 changes: 2 additions & 2 deletions pylons/docs/ja/gettingstarted.rst
Expand Up @@ -422,13 +422,13 @@ World" という短いテキスト文字列があるはずです。(必要なら
.. The :term:`request` variable in templates is used to get
.. information about the current request. `template globals
.. <modules/templating.html#template-globals>`_ lists all the
.. <../modules/templating/#template-globals>`_ lists all the
.. variables Pylons makes available for use in templates.
テンプレートの中の :term:`request` 変数は、現在のリクエストの情報を得る
ために使用されます。 Pylons においてテンプレートの中で使えるすべての変
数は、 `template グローバル変数
<modules/templating.html#template-globals>`_ にリストされています。
<../modules/templating/#template-globals>`_ にリストされています。


.. Next, update the :file:`controllers/hello.py` module so that the
Expand Down

0 comments on commit efa2d4c

Please sign in to comment.