Back to index

plone3  3.1.7
interfaces.py
Go to the documentation of this file.
00001 from zope.interface import Interface, Attribute
00002 
00003 class IRedirectionPolicy(Interface):
00004     """An adapters that provides some policy about how redirects are performed
00005     """
00006 
00007     ignore_ids = Attribute("A list of ids to ignore when examining a URL "
00008                             "for a potential redirection")
00009 
00010 class IFourOhFourView(Interface):
00011     """A view that supports a useful 404 page
00012     """
00013 
00014     def attempt_redirect(self):
00015         """Attempt to find a single appropriate redirection target by
00016         investigating the request.
00017 
00018         If a redirection target is found, perform the redirect and return
00019         True. Else, do nothing and return False.
00020         """
00021 
00022     def find_first_parent(self):
00023         """Look at the URL given, and attempt to translate it into a partial
00024         path. Find the first "parent" of the attempted path that is an actual
00025         object and return it.
00026 
00027         Returns None if no object could be found.
00028         """
00029 
00030     def search_for_similar(self):
00031         """Look at the URL given, and attempt to translate it into a partial
00032         path. Take the id of the requested object (as it would be), and look
00033         for other objects in the catalog with a SearchableText containing
00034         this. If found, return the top five matches. If not, look at the
00035         "parent" as per the attempted path, and so on. If the portal root
00036         is reached, return an empty list.
00037         """
00038 
00039 class IRedirectionStorage(Interface):
00040     """A storage for items where the old and the new location are known.
00041 
00042     Will be registered as a local utility.
00043     """
00044 
00045     def add(old_path, new_path):
00046         """Remember that the object at old_path is now at new_path.
00047 
00048         Any redirects that already pointed at old_path will now point to
00049         new_path as well.
00050         """
00051 
00052     def remove(old_path):
00053         """Forget all redirects from old_path to any new path
00054         """
00055 
00056     def destroy(new_path):
00057         """Forget all redirects to new_path.
00058 
00059         Normally called if the object at new_path is removed
00060         """
00061 
00062     def has_path(old_path):
00063         """Determine if there are any redirects from old_path in effect.
00064         """
00065 
00066     def get(old_path, default=None):
00067         """Get the new path to the object that used to be at old_path.
00068 
00069         Will return the default value (None, unless set otherwise) if old_path
00070         is not found.
00071         """
00072 
00073     def redirects(new_path):
00074         """Get a list of paths that redirect to new_path.
00075 
00076         Will return an empty list if nothing redirects to new_path.
00077         """
00078 
00079     def __iter__():
00080         """Iterate over all existing paths."""