Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Attributes
CMFDefault.DublinCore.DefaultDublinCoreImpl Class Reference
Inheritance diagram for CMFDefault.DublinCore.DefaultDublinCoreImpl:
Inheritance graph
[legend]
Collaboration diagram for CMFDefault.DublinCore.DefaultDublinCoreImpl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def notifyModified
def addCreator
def setModificationDate
def Title
def listCreators
def Creator
def Subject
def Description
def Publisher
def listContributors
def Contributors
def Date
def CreationDate
def EffectiveDate
def ExpirationDate
def ModificationDate
def Type
def Format
def Identifier
def Language
def Rights
def content_type
def isEffective
def created
def effective
def expires
def modified
def getMetadataHeaders
def setTitle
def setCreators
def setSubject
def setDescription
def setContributors
def setEffectiveDate
def setExpirationDate
def setFormat
def setLanguage
def setRights
def manage_editMetadata
def editMetadata

Public Attributes

 creation_date
 creators
 title
 subject
 description
 contributors
 effective_date
 expiration_date
 format
 language
 rights

Static Public Attributes

tuple security = ClassSecurityInfo()
 modification_date = None
tuple manage_metadata = DTMLFile( 'zmi_metadata', _dtmldir )

Private Member Functions

def _datify
def _editMetadata

Static Private Attributes

tuple __implements__
tuple __FLOOR_DATE = DateTime( 1970, 0 )
tuple __CEILING_DATE = DateTime( 2500, 0 )

Detailed Description

Mix-in class which provides Dublin Core methods.

Definition at line 50 of file DublinCore.py.


Constructor & Destructor Documentation

def CMFDefault.DublinCore.DefaultDublinCoreImpl.__init__ (   self,
  title = '',
  subject = (),
  description = '',
  contributors = (),
  effective_date = None,
  expiration_date = None,
  format = 'text/html',
  language = '',
  rights = '' 
)

Definition at line 71 of file DublinCore.py.

00071 
00072                 ):
00073         now = DateTime()
00074         self.creation_date = now
00075         self.modification_date = now
00076         self.creators = ()
00077         self._editMetadata( title
00078                           , subject
00079                           , description
00080                           , contributors
00081                           , effective_date
00082                           , expiration_date
00083                           , format
00084                           , language
00085                           , rights
00086                           )


Member Function Documentation

def CMFDefault.DublinCore.DefaultDublinCoreImpl._datify (   self,
  attrib 
) [private]

Definition at line 357 of file DublinCore.py.

00357 
00358     def _datify( self, attrib ):
00359         if attrib == 'None':
00360             attrib = None
00361         elif not isinstance( attrib, DateTime ):
00362             if attrib is not None:
00363                 attrib = DateTime( attrib )
00364         return attrib

Here is the caller graph for this function:

def CMFDefault.DublinCore.DefaultDublinCoreImpl._editMetadata (   self,
  title = _marker,
  subject = _marker,
  description = _marker,
  contributors = _marker,
  effective_date = _marker,
  expiration_date = _marker,
  format = _marker,
  language = _marker,
  rights = _marker 
) [private]
Update the editable metadata for this resource.

Definition at line 441 of file DublinCore.py.

00441 
00442                      ):
00443         """ Update the editable metadata for this resource.
00444         """
00445         if title is not _marker:
00446             self.setTitle( title )
00447         if subject is not _marker:
00448             self.setSubject( subject )
00449         if description is not _marker:
00450             self.setDescription( description )
00451         if contributors is not _marker:
00452             self.setContributors( contributors )
00453         if effective_date is not _marker:
00454             self.setEffectiveDate( effective_date )
00455         if expiration_date is not _marker:
00456             self.setExpirationDate( expiration_date )
00457         if format is not _marker:
00458             self.setFormat( format )
00459         if language is not _marker:
00460             self.setLanguage( language )
00461         if rights is not _marker:
00462             self.setRights( rights )

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFDefault.DublinCore.DefaultDublinCoreImpl.addCreator (   self,
  creator = None 
)
Add creator to Dublin Core creators.

Definition at line 105 of file DublinCore.py.

00105 
00106     def addCreator(self, creator=None):
00107         """ Add creator to Dublin Core creators.
00108         """
00109         if creator is None:
00110             mtool = getToolByName(self, 'portal_membership', None)
00111             creator = mtool and mtool.getAuthenticatedMember().getId()
00112 
00113         # call self.listCreators() to make sure self.creators exists
00114         if creator and not creator in self.listCreators():
00115             self.creators = self.creators + (creator, )

Here is the call graph for this function:

Here is the caller graph for this function:

WebDAV needs this to do the Right Thing (TM).

Definition at line 277 of file DublinCore.py.

00277 
00278     def content_type( self ):
00279         """ WebDAV needs this to do the Right Thing (TM).
00280         """
00281         return self.Format()

Here is the call graph for this function:

Here is the caller graph for this function:

Deprecated alias of listContributors.

Definition at line 186 of file DublinCore.py.

00186 
00187     def Contributors(self):
00188         """ Deprecated alias of listContributors.
00189         """
00190         return self.listContributors()

Here is the call graph for this function:

Here is the caller graph for this function:

Dublin Core Date element - date resource created.

Definition at line 298 of file DublinCore.py.

00298 
00299     def created( self ):
00300         """ Dublin Core Date element - date resource created.
00301         """
00302         # allow for non-existent creation_date, existed always
00303         date = getattr( self, 'creation_date', None )
00304         return date is None and self.__FLOOR_DATE or date

Here is the caller graph for this function:

Dublin Core Date element - date resource created.

Definition at line 204 of file DublinCore.py.

00204 
00205     def CreationDate( self, zone=None ):
00206         """ Dublin Core Date element - date resource created.
00207         """
00208         if zone is None:
00209             zone = _zone
00210         # return unknown if never set properly
00211         if self.creation_date:
00212             return self.creation_date.toZone(zone).ISO()
00213         else:
00214             return 'Unknown'

Here is the caller graph for this function:

Dublin Core Creator element - resource author.

Definition at line 150 of file DublinCore.py.

00150 
00151     def Creator(self):
00152         """ Dublin Core Creator element - resource author.
00153         """
00154         creators = self.listCreators()
00155         return creators and creators[0] or ''

Here is the call graph for this function:

def CMFDefault.DublinCore.DefaultDublinCoreImpl.Date (   self,
  zone = None 
)
Dublin Core Date element - default date.

Definition at line 192 of file DublinCore.py.

00192 
00193     def Date( self, zone=None ):
00194         """ Dublin Core Date element - default date.
00195         """
00196         if zone is None:
00197             zone = _zone
00198         # Return effective_date if set, modification date otherwise
00199         date = getattr(self, 'effective_date', None )
00200         if date is None:
00201             date = self.modified()
00202         return date.toZone(zone).ISO()

Here is the call graph for this function:

Dublin Core Description element - resource summary.

Definition at line 163 of file DublinCore.py.

00163 
00164     def Description( self ):
00165         """ Dublin Core Description element - resource summary.
00166         """
00167         return self.description

Here is the caller graph for this function:

def CMFDefault.DublinCore.DefaultDublinCoreImpl.editMetadata (   self,
  title = '',
  subject = (),
  description = '',
  contributors = (),
  effective_date = None,
  expiration_date = None,
  format = 'text/html',
  language = 'en-US',
  rights = '' 
)
Need to add check for webDAV locked resource for TTW methods.

Definition at line 500 of file DublinCore.py.

00500 
00501                     ):
00502         """
00503         Need to add check for webDAV locked resource for TTW methods.
00504         """
00505         # as per bug #69, we cant assume they use the webdav
00506         # locking interface, and fail gracefully if they dont
00507         if hasattr(self, 'failIfLocked'):
00508             self.failIfLocked()
00509 
00510         self._editMetadata(title=title
00511                      , subject=subject
00512                      , description=description
00513                      , contributors=contributors
00514                      , effective_date=effective_date
00515                      , expiration_date=expiration_date
00516                      , format=format
00517                      , language=language
00518                      , rights=rights
00519                      )
00520         self.reindexObject()
00521 
00522 InitializeClass(DefaultDublinCoreImpl)

Here is the call graph for this function:

Here is the caller graph for this function:

Dublin Core Date element - date resource becomes effective.

Definition at line 306 of file DublinCore.py.

00306 
00307     def effective( self ):
00308         """ Dublin Core Date element - date resource becomes effective.
00309         """
00310         marker = []
00311         date = getattr( self, 'effective_date', marker )
00312         if date is marker:
00313             date = getattr( self, 'creation_date', None )
00314         return date is None and self.__FLOOR_DATE or date

Dublin Core Date element - date resource becomes effective.

Definition at line 216 of file DublinCore.py.

00216 
00217     def EffectiveDate( self, zone=None ):
00218         """ Dublin Core Date element - date resource becomes effective.
00219         """
00220         if zone is None:
00221             zone = _zone
00222         ed = getattr( self, 'effective_date', None )
00223         return ed and ed.toZone(zone).ISO() or 'None'

Here is the caller graph for this function:

Dublin Core Date element - date resource expires.

Definition at line 225 of file DublinCore.py.

00225 
00226     def ExpirationDate( self, zone=None ):
00227         """ Dublin Core Date element - date resource expires.
00228         """
00229         if zone is None:
00230             zone = _zone
00231         ed = getattr( self, 'expiration_date', None )
00232         return ed and ed.toZone(zone).ISO() or 'None'

Here is the caller graph for this function:

Dublin Core Date element - date resource expires.

Definition at line 318 of file DublinCore.py.

00318 
00319     def expires( self ):
00320         """ Dublin Core Date element - date resource expires.
00321         """
00322         date = getattr( self, 'expiration_date', None )
00323         return date is None and self.__CEILING_DATE or date

Dublin Core Format element - resource format.

Definition at line 249 of file DublinCore.py.

00249 
00250     def Format( self ):
00251         """ Dublin Core Format element - resource format.
00252         """
00253         return self.format

Here is the caller graph for this function:

Return RFC-822-style headers.

Definition at line 336 of file DublinCore.py.

00336 
00337     def getMetadataHeaders( self ):
00338         """ Return RFC-822-style headers.
00339         """
00340         hdrlist = []
00341         hdrlist.append( ( 'Title', self.Title() ) )
00342         hdrlist.append( ( 'Subject', ', '.join( self.Subject() ) ) )
00343         hdrlist.append( ( 'Publisher', self.Publisher() ) )
00344         hdrlist.append( ( 'Description', self.Description() ) )
00345         hdrlist.append( ( 'Contributors', '; '.join( self.Contributors() ) ) )
00346         hdrlist.append( ( 'Effective_date', self.EffectiveDate() ) )
00347         hdrlist.append( ( 'Expiration_date', self.ExpirationDate() ) )
00348         hdrlist.append( ( 'Type', self.Type() ) )
00349         hdrlist.append( ( 'Format', self.Format() ) )
00350         hdrlist.append( ( 'Language', self.Language() ) )
00351         hdrlist.append( ( 'Rights', self.Rights() ) )
00352         return hdrlist

Here is the caller graph for this function:

Dublin Core Identifier element - resource ID.

Definition at line 255 of file DublinCore.py.

00255 
00256     def Identifier( self ):
00257         """ Dublin Core Identifier element - resource ID.
00258         """
00259         # XXX: fixme using 'portal_metadata' (we need to prepend the
00260         #      right prefix to self.getPhysicalPath().
00261         return self.absolute_url()

Here is the call graph for this function:

Is the date within the resource's effective range?

Definition at line 285 of file DublinCore.py.

00285 
00286     def isEffective( self, date ):
00287         """ Is the date within the resource's effective range?
00288         """
00289         pastEffective = ( self.effective_date is None
00290                        or self.effective_date <= date )
00291         beforeExpiration = ( self.expiration_date is None
00292                           or self.expiration_date >= date )
00293         return pastEffective and beforeExpiration

Dublin Core Language element - resource language.

Definition at line 263 of file DublinCore.py.

00263 
00264     def Language( self ):
00265         """ Dublin Core Language element - resource language.
00266         """
00267         return self.language

Here is the caller graph for this function:

Dublin Core Contributor elements - resource collaborators.

Definition at line 180 of file DublinCore.py.

00180 
00181     def listContributors(self):
00182         """ Dublin Core Contributor elements - resource collaborators.
00183         """
00184         return self.contributors

Here is the caller graph for this function:

List Dublin Core Creator elements - resource authors.

Definition at line 137 of file DublinCore.py.

00137 
00138     def listCreators(self):
00139         """ List Dublin Core Creator elements - resource authors.
00140         """
00141         if not hasattr(aq_base(self), 'creators'):
00142             # for content created with CMF versions before 1.5
00143             owner_tuple = self.getOwnerTuple()
00144             if owner_tuple:
00145                 self.creators = (owner_tuple[1],)
00146             else:
00147                 self.creators = ()
00148         return self.creators

Here is the caller graph for this function:

def CMFDefault.DublinCore.DefaultDublinCoreImpl.manage_editMetadata (   self,
  title,
  subject,
  description,
  contributors,
  effective_date,
  expiration_date,
  format,
  language,
  rights,
  REQUEST 
)
Update metadata from the ZMI.

Definition at line 478 of file DublinCore.py.

00478 
00479                            ):
00480         """ Update metadata from the ZMI.
00481         """
00482         self._editMetadata( title, subject, description, contributors
00483                           , effective_date, expiration_date
00484                           , format, language, rights
00485                           )
00486         REQUEST[ 'RESPONSE' ].redirect( self.absolute_url()
00487                                 + '/manage_metadata'
00488                                 + '?manage_tabs_message=Metadata+updated.' )

Here is the call graph for this function:

Dublin Core Date element - date resource last modified.

Definition at line 234 of file DublinCore.py.

00234 
00235     def ModificationDate( self, zone=None ):
00236         """ Dublin Core Date element - date resource last modified.
00237         """
00238         if zone is None:
00239             zone = _zone
00240         return self.modified().toZone(zone).ISO()

Here is the call graph for this function:

Here is the caller graph for this function:

Dublin Core Date element - date resource last modified.

Definition at line 325 of file DublinCore.py.

00325 
00326     def modified( self ):
00327         """ Dublin Core Date element - date resource last modified.
00328         """
00329         date = self.modification_date
00330         if date is None:
00331             # Upgrade.
00332             date = self.bobobase_modification_time()
00333             self.modification_date = date
00334         return date

Here is the caller graph for this function:

Take appropriate action after the resource has been modified.

Update creators and modification_date.

Definition at line 96 of file DublinCore.py.

00096 
00097     def notifyModified(self):
00098         """ Take appropriate action after the resource has been modified.
00099 
00100         Update creators and modification_date.
00101         """
00102         self.addCreator()
00103         self.setModificationDate()

Here is the call graph for this function:

Here is the caller graph for this function:

Dublin Core Publisher element - resource publisher.

Definition at line 169 of file DublinCore.py.

00169 
00170     def Publisher( self ):
00171         """ Dublin Core Publisher element - resource publisher.
00172         """
00173         tool = getToolByName(self, 'portal_metadata', None)
00174 
00175         if tool is not None:
00176             return tool.getPublisher()
00177 
00178         return 'No publisher'

Here is the call graph for this function:

Here is the caller graph for this function:

Dublin Core Rights element - resource copyright.

Definition at line 269 of file DublinCore.py.

00269 
00270     def Rights( self ):
00271         """ Dublin Core Rights element - resource copyright.
00272         """
00273         return self.rights

Here is the caller graph for this function:

Set Dublin Core Contributor elements - resource collaborators.

Definition at line 390 of file DublinCore.py.

00390 
00391     def setContributors( self, contributors ):
00392         """ Set Dublin Core Contributor elements - resource collaborators.
00393         """
00394         # XXX: fixme
00395         self.contributors = tuplize('contributors', contributors, semi_split)

Here is the caller graph for this function:

Set Dublin Core Creator elements - resource authors.

Definition at line 372 of file DublinCore.py.

00372 
00373     def setCreators(self, creators):
00374         """ Set Dublin Core Creator elements - resource authors.
00375         """
00376         self.creators = tuplize('creators', creators)

Here is the call graph for this function:

Here is the caller graph for this function:

Set Dublin Core Description element - resource summary.

Definition at line 384 of file DublinCore.py.

00384 
00385     def setDescription( self, description ):
00386         """ Set Dublin Core Description element - resource summary.
00387         """
00388         self.description = description

Here is the caller graph for this function:

Set Dublin Core Date element - date resource becomes effective.

Definition at line 397 of file DublinCore.py.

00397 
00398     def setEffectiveDate( self, effective_date ):
00399         """ Set Dublin Core Date element - date resource becomes effective.
00400         """
00401         self.effective_date = self._datify( effective_date )

Here is the caller graph for this function:

Set Dublin Core Date element - date resource expires.

Definition at line 403 of file DublinCore.py.

00403 
00404     def setExpirationDate( self, expiration_date ):
00405         """ Set Dublin Core Date element - date resource expires.
00406         """
00407         self.expiration_date = self._datify( expiration_date )

Here is the caller graph for this function:

Set Dublin Core Format element - resource format.

Definition at line 409 of file DublinCore.py.

00409 
00410     def setFormat( self, format ):
00411         """ Set Dublin Core Format element - resource format.
00412         """
00413         self.format = format

Here is the caller graph for this function:

Set Dublin Core Language element - resource language.

Definition at line 415 of file DublinCore.py.

00415 
00416     def setLanguage( self, language ):
00417         """ Set Dublin Core Language element - resource language.
00418         """
00419         self.language = language

Here is the caller graph for this function:

def CMFDefault.DublinCore.DefaultDublinCoreImpl.setModificationDate (   self,
  modification_date = None 
)
Set the date when the resource was last modified.

When called without an argument, sets the date to now.

Definition at line 117 of file DublinCore.py.

00117 
00118     def setModificationDate(self, modification_date=None):
00119         """ Set the date when the resource was last modified.
00120 
00121         When called without an argument, sets the date to now.
00122         """
00123         if modification_date is None:
00124             self.modification_date = DateTime()
00125         else:
00126             self.modification_date = self._datify(modification_date)

Here is the call graph for this function:

Here is the caller graph for this function:

Set Dublin Core Rights element - resource copyright.

Definition at line 421 of file DublinCore.py.

00421 
00422     def setRights( self, rights ):
00423         """ Set Dublin Core Rights element - resource copyright.
00424         """
00425         self.rights = rights

Here is the caller graph for this function:

Set Dublin Core Subject element - resource keywords.

Definition at line 378 of file DublinCore.py.

00378 
00379     def setSubject( self, subject ):
00380         """ Set Dublin Core Subject element - resource keywords.
00381         """
00382         self.subject = tuplize( 'subject', subject )

Here is the caller graph for this function:

Set Dublin Core Title element - resource name.

Definition at line 366 of file DublinCore.py.

00366 
00367     def setTitle( self, title ):
00368         """ Set Dublin Core Title element - resource name.
00369         """
00370         self.title = title

Here is the caller graph for this function:

Dublin Core Subject element - resource keywords.

Definition at line 157 of file DublinCore.py.

00157 
00158     def Subject( self ):
00159         """ Dublin Core Subject element - resource keywords.
00160         """
00161         return getattr( self, 'subject', () ) # compensate for *old* content

Here is the caller graph for this function:

Dublin Core Title element - resource name.

Definition at line 131 of file DublinCore.py.

00131 
00132     def Title( self ):
00133         """ Dublin Core Title element - resource name.
00134         """
00135         return self.title

Here is the caller graph for this function:

Dublin Core Type element - resource type.

Definition at line 242 of file DublinCore.py.

00242 
00243     def Type( self ):
00244         """ Dublin Core Type element - resource type.
00245         """
00246         ti = self.getTypeInfo()
00247         return ti is not None and ti.Title() or 'Unknown'

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

tuple CMFDefault.DublinCore.DefaultDublinCoreImpl.__CEILING_DATE = DateTime( 2500, 0 ) [static, private]

Definition at line 315 of file DublinCore.py.

tuple CMFDefault.DublinCore.DefaultDublinCoreImpl.__FLOOR_DATE = DateTime( 1970, 0 ) [static, private]

Definition at line 282 of file DublinCore.py.

Initial value:
(z2IDublinCore, z2ICatalogableDublinCore,
                      z2IMutableDublinCore)

Definition at line 56 of file DublinCore.py.

Definition at line 394 of file DublinCore.py.

Definition at line 73 of file DublinCore.py.

Definition at line 75 of file DublinCore.py.

Definition at line 387 of file DublinCore.py.

Definition at line 400 of file DublinCore.py.

Definition at line 406 of file DublinCore.py.

Definition at line 412 of file DublinCore.py.

Definition at line 418 of file DublinCore.py.

tuple CMFDefault.DublinCore.DefaultDublinCoreImpl.manage_metadata = DTMLFile( 'zmi_metadata', _dtmldir ) [static]

Definition at line 464 of file DublinCore.py.

Definition at line 93 of file DublinCore.py.

Definition at line 424 of file DublinCore.py.

tuple CMFDefault.DublinCore.DefaultDublinCoreImpl.security = ClassSecurityInfo() [static]

Definition at line 59 of file DublinCore.py.

Definition at line 381 of file DublinCore.py.

Definition at line 369 of file DublinCore.py.


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