Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Static Private Attributes
ATContentTypes.content.base.ATCTOrderedFolder Class Reference
Inheritance diagram for ATContentTypes.content.base.ATCTOrderedFolder:
Inheritance graph
[legend]
Collaboration diagram for ATContentTypes.content.base.ATCTOrderedFolder:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def index_html
def __browser_default__
def get_size
def manage_afterMKCOL
def HEAD
def initializeArchetype
def copyLayoutFromParent
def edit
def cmf_edit
def exclude_from_nav

Static Public Attributes

tuple security = ClassSecurityInfo()
tuple index_html = ComputedAttribute(index_html, 1)
 schema = ATContentTypeSchema
string archetype_name = 'AT Content Type'
tuple assocMimetypes = ()
tuple assocFileExt = ()
tuple cmf_edit_kws = ()
 isDocTemp = False

Static Private Attributes

tuple __implements__

Detailed Description

Base class for orderable folderish AT Content Types

Definition at line 510 of file base.py.


Member Function Documentation

def ATContentTypes.content.base.ATCTFolderMixin.__browser_default__ (   self,
  request 
) [inherited]
Set default so we can return whatever we want instead
of index_html 

Definition at line 457 of file base.py.

00457 
00458     def __browser_default__(self, request):
00459         """ Set default so we can return whatever we want instead
00460         of index_html """
00461         return getToolByName(self, 'plone_utils').browserDefault(self)

Here is the call graph for this function:

def ATContentTypes.content.base.ATCTMixin.cmf_edit (   self,
  args,
  kwargs 
) [inherited]
Overwrite this method to make AT compatible with the crappy
CMF edit()

Definition at line 182 of file base.py.

00182 
00183     def cmf_edit(self, *args, **kwargs):
00184         """Overwrite this method to make AT compatible with the crappy
00185         CMF edit()
00186         """
00187         raise NotImplementedError("cmf_edit method isn't implemented")

Here is the caller graph for this function:

Copies the layout from the parent object if it's of the same type.

Definition at line 149 of file base.py.

00149 
00150     def copyLayoutFromParent(self):
00151         """Copies the layout from the parent object if it's of the same type."""
00152         parent = aq_parent(aq_inner(self))
00153         if parent is not None:
00154             # Only set the layout if we are the same type as out parent object
00155             if parent.meta_type == self.meta_type:
00156                 # If the parent is the same type as us it should implement
00157                 # BrowserDefaultMixin
00158                 parent_layout = parent.getLayout()
00159                 # Just in case we should make sure that the layout is
00160                 # available to the new object
00161                 if parent_layout in [l[0] for l in self.getAvailableLayouts()]:
00162                     self.setLayout(parent_layout)

Here is the call graph for this function:

def ATContentTypes.content.base.ATCTMixin.edit (   self,
  args,
  kwargs 
) [inherited]
Reimplementing edit() to have a compatibility method for the old
cmf edit() method

Definition at line 164 of file base.py.

00164 
00165     def edit(self, *args, **kwargs):
00166         """Reimplementing edit() to have a compatibility method for the old
00167         cmf edit() method
00168         """
00169         if len(args) != 0:
00170             # use cmf edit method
00171             return self.cmf_edit(*args, **kwargs)
00172 
00173         # if kwargs is containing a key that is also in the list of cmf edit
00174         # keywords then we have to use the cmf_edit comp. method
00175         cmf_edit_kws = getattr(aq_inner(self).aq_explicit, 'cmf_edit_kws', ())
00176         for kwname in kwargs.keys():
00177             if kwname in cmf_edit_kws:
00178                 return self.cmf_edit(**kwargs)
00179         # standard AT edit - redirect to update()
00180         return self.update(**kwargs)

Here is the caller graph for this function:

Accessor for excludeFromNav field

Definition at line 188 of file base.py.

00188 
00189     def exclude_from_nav(self):
00190         """Accessor for excludeFromNav field
00191         """
00192         field = self.getField('excludeFromNav')
00193         if field is not None:
00194             return field.get(self)
00195         else:
00196             return False

Here is the call graph for this function:

Returns 1 as folders have no size.

Reimplemented from ATContentTypes.content.base.ATCTMixin.

Definition at line 463 of file base.py.

00463 
00464     def get_size(self):
00465         """Returns 1 as folders have no size."""
00466         return 1

Here is the caller graph for this function:

def ATContentTypes.content.base.ATCTFolderMixin.HEAD (   self,
  REQUEST,
  RESPONSE 
) [inherited]
Overwrite HEAD method for HTTP HEAD requests

Returns 404 Not Found if the default view can't be acquired or 405
Method not allowed if the default view has no HEAD method.

Definition at line 489 of file base.py.

00489 
00490     def HEAD(self, REQUEST, RESPONSE):
00491         """Overwrite HEAD method for HTTP HEAD requests
00492 
00493         Returns 404 Not Found if the default view can't be acquired or 405
00494         Method not allowed if the default view has no HEAD method.
00495         """
00496         view_id = self.getDefaultPage() or self.getLayout()
00497         view_method = getattr(self, view_id, None)
00498         if view_method is None:
00499             # view method couldn't be acquired
00500             raise NotFound, "View method %s for requested resource is not " \
00501                              "available." % view_id
00502         if getattr(aq_base(view_method), 'HEAD', None) is not None:
00503             # view method has a HEAD method
00504             return view_method.__of__(self).HEAD(REQUEST, RESPONSE)
00505         else:
00506             raise MethodNotAllowed, 'Method not supported for this resource.'
00507 
00508 InitializeClass(ATCTFolderMixin)
00509 

Here is the call graph for this function:

def ATContentTypes.content.base.ATCTOrderedFolder.index_html (   self,
  REQUEST = None,
  RESPONSE = None 
)
Special case index_html

Definition at line 519 of file base.py.

00519 
00520     def index_html(self, REQUEST=None, RESPONSE=None):
00521         """Special case index_html"""
00522         request = REQUEST
00523         if request is None:
00524             request = getattr(self, 'REQUEST', None)
00525         if request and request.has_key('REQUEST_METHOD'):
00526             if request.maybe_webdav_client:
00527                 method = request['REQUEST_METHOD']
00528                 if method in ('PUT',):
00529                     # Very likely a WebDAV client trying to create something
00530                     return ReplaceableWrapper(NullResource(self, 'index_html'))
00531                 elif method in ('GET', 'HEAD', 'POST'):
00532                     # Do nothing, let it go and acquire.
00533                     pass
00534                 else:
00535                     raise AttributeError, 'index_html'
00536         # Acquire from parent
00537         _target = aq_parent(aq_inner(self)).aq_acquire('index_html')
00538         return ReplaceableWrapper(aq_base(_target).__of__(self))

Here is the caller graph for this function:

def ATContentTypes.content.base.ATCTMixin.initializeArchetype (   self,
  kwargs 
) [inherited]
called by the generated add* factory in types tool

Overwritten to call edit() instead of update() to have the cmf
compatibility method.

Definition at line 125 of file base.py.

00125 
00126     def initializeArchetype(self, **kwargs):
00127         """called by the generated add* factory in types tool
00128 
00129         Overwritten to call edit() instead of update() to have the cmf
00130         compatibility method.
00131         """
00132         try:
00133             self.initializeLayers()
00134             self.markCreationFlag()
00135             self.setDefaults()
00136             if kwargs:
00137                 self.edit(**kwargs)
00138             self._signature = self.Schema().signature()
00139             if self.isPrincipiaFolderish:
00140                 self.copyLayoutFromParent()
00141         except ConflictError:
00142             raise
00143         except Exception, msg:
00144             LOG.warn('Exception in initializeArchetype', exc_info=True)
00145             if DEBUG and str(msg) not in ('SESSION',):
00146                 # debug code
00147                 raise

Here is the call graph for this function:

def ATContentTypes.content.base.ATCTFolderMixin.manage_afterMKCOL (   self,
  id,
  result,
  REQUEST = None,
  RESPONSE = None 
) [inherited]
After MKCOL handler

Set title according to the id

Definition at line 468 of file base.py.

00468 
00469     def manage_afterMKCOL(self, id, result, REQUEST=None, RESPONSE=None):
00470         """After MKCOL handler
00471 
00472         Set title according to the id
00473         """
00474         # manage_afterMKCOL is called in the context of the parent
00475         # folder, *not* in the context of the new folder!
00476         new = getattr(self, id)
00477         title = new.Title()
00478         if not title.strip():
00479             # Use the last-segment from the url as the id, as the
00480             # object might have been renamed somehow (eg: by id
00481             # mangling).
00482             request = REQUEST or getattr(self, 'REQUEST', None)
00483             if request is not None:
00484                 path_info = request.get('PATH_INFO')
00485                 if path_info:
00486                     id = posixpath.basename(path_info)
00487             new.update(title=id)


Member Data Documentation

Initial value:
(ATCTFolderMixin.__implements__,
                      OrderedBaseFolder.__implements__)

Reimplemented from ATContentTypes.content.base.ATCTFolderMixin.

Definition at line 513 of file base.py.

string ATContentTypes.content.base.ATCTMixin.archetype_name = 'AT Content Type' [static, inherited]

Definition at line 109 of file base.py.

Definition at line 112 of file base.py.

Definition at line 111 of file base.py.

Definition at line 113 of file base.py.

Definition at line 539 of file base.py.

Definition at line 116 of file base.py.

ATContentTypes.content.base.ATCTMixin.schema = ATContentTypeSchema [static, inherited]

Definition at line 107 of file base.py.

tuple ATContentTypes.content.base.ATCTOrderedFolder.security = ClassSecurityInfo() [static]

Reimplemented from ATContentTypes.content.base.ATCTFolderMixin.

Definition at line 516 of file base.py.


The documentation for this class was generated from the following file: