summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorStephan Richter <stephan.richter@gmail.com>2014-02-05 09:02:50 -0500
committerStephan Richter <stephan.richter@gmail.com>2014-02-05 09:02:50 -0500
commita1235f577f50a5704355c6ad86cecea47195947c (patch)
tree137e6a30dc941e3eda2ff1c841af441d10430d16 /docs
parent1e2fb2ca4d5406ca674a5e49de9d745265046897 (diff)
downloadzope-interface-a1235f577f50a5704355c6ad86cecea47195947c.tar.gz
Added an API doc entry for the new "@named()" function.
Diffstat (limited to 'docs')
-rw-r--r--docs/api.rst30
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/api.rst b/docs/api.rst
index 1d6d06d..a853dc7 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -1029,3 +1029,33 @@ For example:
Get an ObjectSpecification bound to either an instance or a class,
depending on how we were accessed.
+
+:class:`zope.interface.declarations.named`
+---------------------------------------------
+
+API
++++
+
+.. autoclass:: zope.interface.declarations.named
+ :members:
+ :member-order: bysource
+
+Usage
++++++
+
+For example:
+
+.. doctest::
+
+ >>> from zope.interface.declarations import named
+
+ >>> @named('foo')
+ ... class Foo(object):
+ ... pass
+
+ >>> Foo.__component_name__
+ 'foo'
+
+When registering an adapter or utility component, the registry looks for the
+`__component_name__` attribute and uses it, if no name was explicitely
+provided.