Ñò
,
°Ic @ sÏ d Z d d k l Z d d d d d d d g Z d e f d
„ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d
„ ƒ YZ d e f d „ ƒ YZ
d e f d „ ƒ YZ d e f d „ ƒ YZ d S( sv
Base adapters for the supported source types.
This is, the foundations for the source adapters defined in plugins.
In a ``group source adapter``, ``a section is a group`` in the source and
``its items are the users that belong to that group``. Example: If Bob and Mary
belong to the "developers" group, then you can also say that items Bob and Mary
belong to the "developers" section.
In a ``permission source adapter``, ``a section is a permission`` in the source
and ``its items are the groups that are granted that permission``. Example: If
"developers" and "designers" are granted the right to update the web site
("update-site"), then you can also say that items "developers" and "designers"
belong to the "update-site" section.
@todo: Add support for "universal sections" (those containing item "_").
@todo: Add support for "anonymous sections" (those containing item "-").
iÿÿÿÿ( t Interfacet BaseSourceAdaptert AdapterErrort SourceErrort ExistingSectionErrort NonExistingSectionErrort ItemPresentErrort ItemNotPresentErrorc B s e Z d Z e d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z
d „ Z d „ Z d
„ Z
d „ Z d „ Z d
„ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( s±
Base class for :term:`source adapters `.
Please note that these abstract methods may only raise one exception:
:class:`SourceError`, which is raised if there was a problem while dealing
with the source. They may not raise other exceptions because they should not
validate anything but the source (not even the parameters they get).
.. attribute:: is_writable = True
:type: bool
Whether the adapter can write to the source.
If the source type handled by your adapter doesn't support write
access, or if your adapter itself doesn't support writting to the
source (yet), then you should set this value to ``False`` in the class
itself; it will get overriden if the ``writable`` parameter in
:meth:`the contructor ` is set, unless you
explicitly disable that parameter::
# ...
class MyFakeAdapter(BaseSourceAdapter):
def __init__():
super(MyFakeAdapter, self).__init__(writable=False)
# ...
.. note::
If it's ``False``, then you don't have to define the methods that
modify the source because they won't be used:
* :meth:`_include_items`
* :meth:`_exclude_items`
* :meth:`_create_section`
* :meth:`_edit_section`
* :meth:`_delete_section`
.. warning::
Do not ever cache the results -- that is :class:`BaseSourceAdapter`'s
job. It requests a given datum once, not multiple times, thanks to
its internal cache.
c C s h | _ t | _ | | _ d S( sŸ
Run common setup for source adapters.
:param writable: Whether the source is writable.
:type writable: bool
N( t loaded_sectionst Falset all_sections_loadedt is_writable( t selft writable( ( sA /usr/lib/python2.6/site-packages/repoze/what/adapters/__init__.pyt __init__] s c C s- | i p | i ƒ | _ t | _ n | i S( sà
Return all the sections found in the source.
:return: All the sections found in the source.
:rtype: dict
:raise SourceError: If there was a problem with the source.
( R
t _get_all_sectionsR t True( R ( ( sA /usr/lib/python2.6/site-packages/repoze/what/adapters/__init__.pyt get_all_sectionsl s
c C sB | | i j o' | i | ƒ | i | ƒ | i |