| 115 | |
| 116 | === ITicketChangeListener === |
| 117 | Ver0.10以降。 |
| 118 | チケットの変更時に呼び出されるインタフェース。作成時、変更時、削除(削除ってあったっけ?)時にそれぞれ |
| 119 | 呼び出されるメソッドを定義する。 |
| 120 | {{{ |
| 121 | #!python |
| 122 | class ITicketChangeListener(Interface): |
| 123 | """Extension point interface for components that require notification when |
| 124 | tickets are created, modified, or deleted.""" |
| 125 | |
| 126 | def ticket_created(ticket): |
| 127 | """Called when a ticket is created.""" |
| 128 | |
| 129 | def ticket_changed(ticket, comment, old_values): |
| 130 | """Called when a ticket is modified. |
| 131 | |
| 132 | `old_values` is a dictionary containing the previous values of the |
| 133 | fields that have changed. |
| 134 | """ |
| 135 | |
| 136 | def ticket_deleted(ticket): |
| 137 | """Called when a ticket is deleted.""" |
| 138 | }}} |
| 139 | === ITicketManipulator === |
| 140 | Ver0.10以降。 |
| 141 | チケットの登録時に呼び出されるインタフェース。値のチェックを行うのに使う。 |
| 142 | {{{ |
| 143 | #!python |
| 144 | class ITicketManipulator(Interface): |
| 145 | """Miscellaneous manipulation of ticket workflow features.""" |
| 146 | |
| 147 | def prepare_ticket(req, ticket, fields, actions): |
| 148 | """Not currently called, but should be provided for future |
| 149 | compatibility.""" |
| 150 | |
| 151 | def validate_ticket(req, ticket): |
| 152 | """Validate a ticket after it's been populated from user input. |
| 153 | |
| 154 | Must return a list of `(field, message)` tuples, one for each problem |
| 155 | detected. `field` can be `None` to indicate an overall problem with the |
| 156 | ticket. Therefore, a return value of `[]` means everything is OK.""" |
| 157 | }}} |
| 158 | === IRepositoryConnector === |
| 159 | Ver0.10以降。 |
| 160 | SVN以外のバージョン管理システムを使うためのインタフェース。 |
| 161 | {{{ |
| 162 | #!python |
| 163 | class IRepositoryConnector(Interface): |
| 164 | """Extension point interface for components that provide support for a |
| 165 | specific version control system.""" |
| 166 | |
| 167 | def get_supported_types(): |
| 168 | """Return the types of version control systems that are supported by |
| 169 | this connector, and their relative priorities. |
| 170 | |
| 171 | Highest number is highest priority. |
| 172 | """ |
| 173 | |
| 174 | def get_repository(repos_type, repos_dir, authname): |
| 175 | """Return the Repository object for the given repository type and |
| 176 | directory. |
| 177 | """ |
| 178 | }}} |
| 179 | === IAuthenticator === |
| 180 | |
| 181 | {{{ |
| 182 | #!python |
| 183 | class IAuthenticator(Interface): |
| 184 | """Extension point interface for components that can provide the name |
| 185 | of the remote user.""" |
| 186 | |
| 187 | def authenticate(req): |
| 188 | """Return the name of the remote user, or `None` if the identity of the |
| 189 | user is unknown.""" |
| 190 | }}} |
| 191 | === IRequestHandler === |
| 192 | リクエストハンドラ。リクエストを処理する場合に使う。っていうかメニューにアイテムを作ったら |
| 193 | まず間違いなく使う。いろんなモジュールが使っているので参照すればだいたい分かる。 |
| 194 | {{{ |
| 195 | #!python |
| 196 | class IRequestHandler(Interface): |
| 197 | """Extension point interface for request handlers.""" |
| 198 | |
| 199 | # implementing classes should set this property to `True` if they |
| 200 | # don't need session and authentication related information |
| 201 | anonymous_request = False |
| 202 | |
| 203 | # implementing classes should set this property to `False` if they |
| 204 | # don't need the HDF data and don't produce content using a template |
| 205 | use_template = True |
| 206 | |
| 207 | def match_request(req): |
| 208 | """Return whether the handler wants to process the given request.""" |
| 209 | |
| 210 | def process_request(req): |
| 211 | """Process the request. Should return a (template_name, content_type) |
| 212 | tuple, where `template` is the ClearSilver template to use (either |
| 213 | a `neo_cs.CS` object, or the file name of the template), and |
| 214 | `content_type` is the MIME type of the content. If `content_type` is |
| 215 | `None`, "text/html" is assumed. |
| 216 | |
| 217 | Note that if template processing should not occur, this method can |
| 218 | simply send the response itself and not return anything. |
| 219 | """ |
| 220 | }}} |
| 221 | === INavigationContributor === |
| 222 | メニューバーにアイテムを出すときに使う。これも多くのコンポーネントで使われている。 |
| 223 | {{{ |
| 224 | #!python |
| 225 | class INavigationContributor(Interface): |
| 226 | """Extension point interface for components that contribute items to the |
| 227 | navigation. |
| 228 | """ |
| 229 | |
| 230 | def get_active_navigation_item(req): |
| 231 | """This method is only called for the `IRequestHandler` processing the |
| 232 | request. |
| 233 | |
| 234 | It should return the name of the navigation item that should be |
| 235 | highlighted as active/current. |
| 236 | """ |
| 237 | |
| 238 | def get_navigation_items(req): |
| 239 | """Should return an iterable object over the list of navigation items to |
| 240 | add, each being a tuple in the form (category, name, text). |
| 241 | """ |
| 242 | }}} |
| 243 | === ITemplateProvider === |
| 244 | ClearSilverテンプレートから、静的なコンテンツ(画像とか)を呼びたい場合に使う。 |
| 245 | {{{ |
| 246 | #!python |
| 247 | class ITemplateProvider(Interface): |
| 248 | """Extension point interface for components that provide their own |
| 249 | ClearSilver templates and accompanying static resources. |
| 250 | """ |
| 251 | |
| 252 | def get_htdocs_dirs(): |
| 253 | """Return a list of directories with static resources (such as style |
| 254 | sheets, images, etc.) |
| 255 | |
| 256 | Each item in the list must be a `(prefix, abspath)` tuple. The |
| 257 | `prefix` part defines the path in the URL that requests to these |
| 258 | resources are prefixed with. |
| 259 | |
| 260 | The `abspath` is the absolute path to the directory containing the |
| 261 | resources on the local file system. |
| 262 | """ |
| 263 | }}} |