|
1 |
| -================= |
2 |
| -Django Exceptions |
3 |
| -================= |
| 1 | +.. ================= |
| 2 | + Django Exceptions |
| 3 | + ================= |
| 4 | + |
| 5 | +============= |
| 6 | +Django の例外 |
| 7 | +============= |
| 8 | + |
| 9 | +:revision-up-to: 17812 (1.4) |
4 | 10 |
|
5 |
| -:revision-up-to: 17812 (1.4) unfinished |
| 11 | +.. Django raises some Django specific exceptions as well as many standard |
| 12 | + Python exceptions. |
6 | 13 |
|
7 |
| -Django raises some Django specific exceptions as well as many standard |
8 |
| -Python exceptions. |
| 14 | +Django は多くの Python 標準の例外に加え、いくつかの Django |
| 15 | +固有の例外を送出します。 |
9 | 16 |
|
10 |
| -Django-specific Exceptions |
11 |
| -========================== |
| 17 | +.. Django-specific Exceptions |
| 18 | + ========================== |
| 19 | + |
| 20 | +Django 固有の例外 |
| 21 | +================= |
12 | 22 |
|
13 | 23 | .. module:: django.core.exceptions
|
14 | 24 | :synopsis: Django specific exceptions
|
15 | 25 |
|
16 |
| -ObjectDoesNotExist and DoesNotExist |
17 |
| ------------------------------------ |
| 26 | +.. ObjectDoesNotExist and DoesNotExist |
| 27 | + ----------------------------------- |
| 28 | + |
| 29 | +ObjectDoesNotExist と DoesNotExist |
| 30 | +---------------------------------- |
18 | 31 | .. exception:: DoesNotExist
|
19 | 32 | .. exception:: ObjectDoesNotExist
|
20 | 33 |
|
21 |
| - The :exc:`DoesNotExist` exception is raised when an object is not found |
22 |
| - for the given parameters of a query. |
| 34 | + .. The :exc:`DoesNotExist` exception is raised when an object is not found |
| 35 | + for the given parameters of a query. |
23 | 36 |
|
24 |
| - :exc:`ObjectDoesNotExist` is defined in :mod:`django.core.exceptions`. |
25 |
| - :exc:`DoesNotExist` is a subclass of the base :exc:`ObjectDoesNotExist` |
26 |
| - exception that is provided on every model class as a way of |
27 |
| - identifying the specific type of object that could not be found. |
| 37 | + :exc:`DoesNotExist` 例外は指定されたクエリーパラメータでオブジェクトが |
| 38 | + 見つからなかったときに送出されます。 |
28 | 39 |
|
29 |
| - See :meth:`~django.db.models.query.QuerySet.get()` for further information |
30 |
| - on :exc:`ObjectDoesNotExist` and :exc:`DoesNotExist`. |
| 40 | + .. :exc:`ObjectDoesNotExist` is defined in :mod:`django.core.exceptions`. |
| 41 | + :exc:`DoesNotExist` is a subclass of the base :exc:`ObjectDoesNotExist` |
| 42 | + exception that is provided on every model class as a way of |
| 43 | + identifying the specific type of object that could not be found. |
| 44 | + |
| 45 | + :exc:`ObjectDoesNotExist` は :mod:`django.core.exceptions` |
| 46 | + の中で定義されています。:exc:`DoesNotExist` は、:exc:`ObjectDoesNotExist` |
| 47 | + 例外をベースにしたサブクラスです。これは、どのタイプのオブジェクトを |
| 48 | + 見つけられなかったのかを特定する手段として全モデルクラスで提供されています |
| 49 | + (訳注: モデルクラス ``Foo`` と ``Bar`` がある場合、 ``Foo.DoesNotExist`` |
| 50 | + および ``Bar.DoesNotExist`` という ``ObjectDoesNotExist`` |
| 51 | + を継承したクラスが定義されます)。 |
| 52 | + |
| 53 | + .. See :meth:`~django.db.models.query.QuerySet.get()` for further information |
| 54 | + on :exc:`ObjectDoesNotExist` and :exc:`DoesNotExist`. |
| 55 | + |
| 56 | + :exc:`ObjectDoesNotExist` と :exc:`DoesNotExist` のさらなる情報について、 |
| 57 | + :meth:`~django.db.models.query.QuerySet.get()` を参照してください。 |
31 | 58 |
|
32 | 59 | MultipleObjectsReturned
|
33 | 60 | -----------------------
|
34 | 61 | .. exception:: MultipleObjectsReturned
|
35 | 62 |
|
36 |
| - The :exc:`MultipleObjectsReturned` exception is raised by a query if only |
37 |
| - one object is expected, but multiple objects are returned. A base version |
38 |
| - of this exception is provided in :mod:`django.core.exceptions`; each model |
39 |
| - class contains a subclassed version that can be used to identify the |
40 |
| - specific object type that has returned multiple objects. |
| 63 | + .. The :exc:`MultipleObjectsReturned` exception is raised by a query if only |
| 64 | + one object is expected, but multiple objects are returned. A base version |
| 65 | + of this exception is provided in :mod:`django.core.exceptions`; each model |
| 66 | + class contains a subclassed version that can be used to identify the |
| 67 | + specific object type that has returned multiple objects. |
| 68 | + |
| 69 | + :exc:`MultipleObjectsReturned` 例外は、一つのオブジェクトが期待されるにも |
| 70 | + 関わらず複数のオブジェクトが得られた場合に、クエリーによって送出されます。 |
| 71 | + この例外のベースとなるバージョンは :mod:`django.core.exceptions` の中で |
| 72 | + 定義されています。そして各モデルクラスはそれをサブクラス化した例外を |
| 73 | + 含んでおり、どのタイプのオブジェクトが複数のオブジェクトを |
| 74 | + 返したのかを特定するために使えます |
| 75 | + (訳注: モデルクラス ``Foo`` と ``Bar`` がある場合、送出された例外が |
| 76 | + ``Foo.MultipleObjectsReturned`` であれば複数の ``Foo`` のオブジェクトが |
| 77 | + 返されたと判断できます)。 |
41 | 78 |
|
42 |
| - See :meth:`~django.db.models.query.QuerySet.get()` for further information. |
| 79 | + .. See :meth:`~django.db.models.query.QuerySet.get()` for further information. |
| 80 | + |
| 81 | + さらなる情報について :meth:`~django.db.models.query.QuerySet.get()` |
| 82 | + を参照してください。 |
43 | 83 |
|
44 | 84 | SuspiciousOperation
|
45 | 85 | -------------------
|
46 | 86 | .. exception:: SuspiciousOperation
|
47 | 87 |
|
48 |
| - The :exc:`SuspiciousOperation` exception is raised when a user has performed |
49 |
| - an operation that should be considered suspicious from a security perspective, |
50 |
| - such as tampering with a session cookie. |
| 88 | + .. The :exc:`SuspiciousOperation` exception is raised when a user has performed |
| 89 | + an operation that should be considered suspicious from a security perspective, |
| 90 | + such as tampering with a session cookie. |
| 91 | + |
| 92 | + :exc:`SuspiciousOperation` 例外は、セキュリティ観点上、不審と考えられる |
| 93 | + 操作をユーザが行った場合に送出されます。たとえば、セッションクッキーが |
| 94 | + 改変された場合などです。 |
51 | 95 |
|
52 | 96 | PermissionDenied
|
53 | 97 | ----------------
|
54 | 98 | .. exception:: PermissionDenied
|
55 | 99 |
|
56 |
| - The :exc:`PermissionDenied` exception is raised when a user does not have |
57 |
| - permission to perform the action requested. |
| 100 | + .. The :exc:`PermissionDenied` exception is raised when a user does not have |
| 101 | + permission to perform the action requested. |
| 102 | + |
| 103 | + :exc:`PermissionDenied` 例外は、要求したアクションを実行する権限をユーザが |
| 104 | + 持っていない場合に送出されます。 |
58 | 105 |
|
59 | 106 | ViewDoesNotExist
|
60 | 107 | ----------------
|
61 | 108 | .. exception:: ViewDoesNotExist
|
62 | 109 |
|
63 |
| - The :exc:`ViewDoesNotExist` exception is raised by |
64 |
| - :mod:`django.core.urlresolvers` when a requested view does not exist. |
| 110 | + .. The :exc:`ViewDoesNotExist` exception is raised by |
| 111 | + :mod:`django.core.urlresolvers` when a requested view does not exist. |
| 112 | + |
| 113 | + :exc:`ViewDoesNotExist` 例外は、要求されたビューが存在しない場合に |
| 114 | + :mod:`django.core.urlresolvers` によって送出されます。 |
65 | 115 |
|
66 | 116 | MiddlewareNotUsed
|
67 | 117 | -----------------
|
68 | 118 | .. exception:: MiddlewareNotUsed
|
69 | 119 |
|
70 |
| - The :exc:`MiddlewareNotUsed` exception is raised when a middleware is not |
71 |
| - used in the server configuration. |
| 120 | + .. The :exc:`MiddlewareNotUsed` exception is raised when a middleware is not |
| 121 | + used in the server configuration. |
| 122 | + |
| 123 | + :exc:`MiddlewareNotUsed` 例外は、サーバ設定にあるミドルウェアの中に |
| 124 | + 使われていないものがある場合に送出されます。 |
72 | 125 |
|
73 | 126 | ImproperlyConfigured
|
74 | 127 | --------------------
|
75 | 128 | .. exception:: ImproperlyConfigured
|
76 | 129 |
|
77 |
| - The :exc:`ImproperlyConfigured` exception is raised when Django is |
78 |
| - somehow improperly configured -- for example, if a value in ``settings.py`` |
79 |
| - is incorrect or unparseable. |
| 130 | + .. The :exc:`ImproperlyConfigured` exception is raised when Django is |
| 131 | + somehow improperly configured -- for example, if a value in ``settings.py`` |
| 132 | + is incorrect or unparseable. |
| 133 | + |
| 134 | + :exc:`ImproperlyConfigured` 例外は、 Django の設定の何かが正しくない場合に |
| 135 | + 送出されます -- たとえば ``settings.py`` の値が不正であったり、 |
| 136 | + 書式不正である場合が挙げられます。 |
80 | 137 |
|
81 | 138 | FieldError
|
82 | 139 | ----------
|
83 | 140 | .. exception:: FieldError
|
84 | 141 |
|
85 |
| - The :exc:`FieldError` exception is raised when there is a problem with a |
86 |
| - model field. This can happen for several reasons: |
87 |
| - |
88 |
| - - A field in a model clashes with a field of the same name from an |
89 |
| - abstract base class |
90 |
| - - An infinite loop is caused by ordering |
91 |
| - - A keyword cannot be parsed from the filter parameters |
92 |
| - - A field cannot be determined from a keyword in the query |
93 |
| - parameters |
94 |
| - - A join is not permitted on the specified field |
95 |
| - - A field name is invalid |
96 |
| - - A query contains invalid order_by arguments |
| 142 | + .. The :exc:`FieldError` exception is raised when there is a problem with a |
| 143 | + model field. This can happen for several reasons: |
| 144 | + |
| 145 | + :exc:`FieldError` 例外は、モデルのフィールドに関係した問題がある場合に |
| 146 | + 送出されます。いくつかの理由が考えられるます: |
| 147 | + |
| 148 | + .. - A field in a model clashes with a field of the same name from an |
| 149 | + abstract base class |
| 150 | + - An infinite loop is caused by ordering |
| 151 | + - A keyword cannot be parsed from the filter parameters |
| 152 | + - A field cannot be determined from a keyword in the query |
| 153 | + parameters |
| 154 | + - A join is not permitted on the specified field |
| 155 | + - A field name is invalid |
| 156 | + - A query contains invalid order_by arguments |
| 157 | + |
| 158 | + - モデルのフィールドが抽象ベースクラスの同名のフィールドと衝突している |
| 159 | + - 並べ替え処理により無限ループが発生した |
| 160 | + - フィルターパラメータ中のキーワードが解釈できない |
| 161 | + - クエリーパラメータ中のキーワードからフィールドを特定できない |
| 162 | + - 指定されたフィールドでの結合 (join) は許可されていない |
| 163 | + - フィールド名が不正 |
| 164 | + - クエリーが不正な order_by 引数を含んでいる |
97 | 165 |
|
98 | 166 | ValidationError
|
99 | 167 | ---------------
|
100 | 168 | .. exception:: ValidationError
|
101 | 169 |
|
102 |
| - The :exc:`ValidationError` exception is raised when data fails form or |
103 |
| - model field validation. For more information about validation, see |
104 |
| - :doc:`Form and Field Validation </ref/forms/validation>`, |
105 |
| - :ref:`Model Field Validation <validating-objects>` and the |
106 |
| - :doc:`Validator Reference </ref/validators>`. |
| 170 | + .. The :exc:`ValidationError` exception is raised when data fails form or |
| 171 | + model field validation. For more information about validation, see |
| 172 | + :doc:`Form and Field Validation </ref/forms/validation>`, |
| 173 | + :ref:`Model Field Validation <validating-objects>` and the |
| 174 | + :doc:`Validator Reference </ref/validators>`. |
| 175 | + |
| 176 | + :exc:`ValidationError` 例外は、フォームやモデルフィールドの検証 (validation) |
| 177 | + に失敗した場合に送出されます。検証についての詳細は |
| 178 | + :doc:`フォームやフィールドの検証 </ref/forms/validation>` 、 |
| 179 | + :ref:`モデルフィールドの検証 <validating-objects>` 、そして |
| 180 | + :doc:`バリデータのリファレンス </ref/validators>` を参照してください。 |
107 | 181 |
|
108 | 182 | .. currentmodule:: django.core.urlresolvers
|
109 | 183 |
|
110 | 184 | NoReverseMatch
|
111 | 185 | --------------
|
112 | 186 | .. exception:: NoReverseMatch
|
113 | 187 |
|
114 |
| - The :exc:`NoReverseMatch` exception is raised by |
115 |
| - :mod:`django.core.urlresolvers` when a matching URL in your URLconf |
116 |
| - cannot be identified based on the parameters supplied. |
| 188 | + .. The :exc:`NoReverseMatch` exception is raised by |
| 189 | + :mod:`django.core.urlresolvers` when a matching URL in your URLconf |
| 190 | + cannot be identified based on the parameters supplied. |
| 191 | + |
| 192 | + :exc:`NoReverseMatch` 例外は、指定パラメータに適合する URL を URLconf |
| 193 | + から特定できなかった場合に :mod:`django.core.urlresolvers` |
| 194 | + によって送出されます。 |
117 | 195 |
|
118 | 196 | .. currentmodule:: django.db
|
119 | 197 |
|
120 |
| -Database Exceptions |
121 |
| -=================== |
| 198 | +.. Database Exceptions |
| 199 | + =================== |
| 200 | + |
| 201 | +データベースの例外 |
| 202 | +================== |
122 | 203 |
|
123 |
| -Django wraps the standard database exceptions :exc:`DatabaseError` and |
124 |
| -:exc:`IntegrityError` so that your Django code has a guaranteed common |
125 |
| -implementation of these classes. These database exceptions are |
126 |
| -provided in :mod:`django.db`. |
| 204 | +.. Django wraps the standard database exceptions :exc:`DatabaseError` and |
| 205 | + :exc:`IntegrityError` so that your Django code has a guaranteed common |
| 206 | + implementation of these classes. These database exceptions are |
| 207 | + provided in :mod:`django.db`. |
| 208 | + |
| 209 | +Django は標準 (訳注: :pep:`249`) のデータベース例外である :exc:`DatabaseError` と |
| 210 | +:exc:`IntegrityError` をラッピングするため、ユーザは Django 用のコードにて |
| 211 | +これらのクラスの共通の実装を利用できます。これらのデータベース例外は |
| 212 | +:mod:`django.db` の中で定義されています。 |
| 213 | +(訳注: Django は標準 PEP 249 に従って例外クラスを定義しており、どのデータベース |
| 214 | +バックエンドを利用する場合でもこれらを使用します。なおこれらの例外は、 |
| 215 | +送出のきっかけになった「データベースバックエンドが送出した例外オブジェクト」を |
| 216 | +ラッピングする、つまり属性を引き継ぎます。) |
127 | 217 |
|
128 | 218 | .. exception:: DatabaseError
|
129 | 219 | .. exception:: IntegrityError
|
130 | 220 |
|
131 |
| -The Django wrappers for database exceptions behave exactly the same as |
132 |
| -the underlying database exceptions. See :pep:`249`, the Python Database API |
133 |
| -Specification v2.0, for further information. |
| 221 | +.. The Django wrappers for database exceptions behave exactly the same as |
| 222 | + the underlying database exceptions. See :pep:`249`, the Python Database API |
| 223 | + Specification v2.0, for further information. |
| 224 | + |
| 225 | +Django のデータベース例外用のラッパーは、元になったデータベース例外と完全に |
| 226 | +同じ振る舞いをします。さらなる情報については Python データベース API 仕様 v2.0 |
| 227 | +(:pep:`249`) を参照してください。 |
134 | 228 |
|
135 | 229 | .. currentmodule:: django.db.transaction
|
136 | 230 |
|
137 |
| -Transaction Exceptions |
138 |
| -====================== |
| 231 | +.. Transaction Exceptions |
| 232 | + ====================== |
| 233 | + |
| 234 | +トランザクション例外 |
| 235 | +==================== |
139 | 236 |
|
140 | 237 | .. exception:: TransactionManagementError
|
141 | 238 |
|
142 |
| - The :exc:`TransactionManagementError` is raised for any and all problems |
143 |
| - related to database transactions. It is available from |
144 |
| - :mod:`django.db.transaction`. |
| 239 | + .. The :exc:`TransactionManagementError` is raised for any and all problems |
| 240 | + related to database transactions. It is available from |
| 241 | + :mod:`django.db.transaction`. |
145 | 242 |
|
146 |
| -Python Exceptions |
147 |
| -================= |
| 243 | + :exc:`TransactionManagementError` は、データベーストランザクションに関係した |
| 244 | + あらゆる問題に対して送出されます。このクラスは |
| 245 | + :mod:`django.db.transaction` の中で定義されています。 |
| 246 | + |
| 247 | +.. Python Exceptions |
| 248 | + ================= |
| 249 | + |
| 250 | +Python の例外 |
| 251 | +============= |
| 252 | + |
| 253 | +.. Django raises built-in Python exceptions when appropriate as well. See the |
| 254 | + Python documentation for further information on the |
| 255 | + built-in :mod:`exceptions`. |
148 | 256 |
|
149 |
| -Django raises built-in Python exceptions when appropriate as well. See the |
150 |
| -Python documentation for further information on the |
151 |
| -built-in :mod:`exceptions`. |
| 257 | +Django は、 Python 標準の例外を送出した方が適切な場面においては、そうします。 |
| 258 | +さらなる情報については Python のドキュメントで標準 :mod:`exceptions` |
| 259 | +を参照してください。 |
0 commit comments