Back to index

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

List of all members.

Public Member Functions

def __init__
def getEndStrings
def getStartStrings
def edit
def buildTimes
def buildDays
def buildMonths
def buildYears
def setStartDate
def setEndDate
def start
def end
def getStartTimeString
def getStopTimeString
def handleText
def setMetadata
def getMetadataHeaders
def PUT
 FTP handlers.
def manage_FTPget
def get_size

Public Attributes

 id
 effective_date
 expiration_date
 location
 contact_name
 contact_email
 contact_phone
 event_url
 start_date
 end_date

Static Public Attributes

tuple security = ClassSecurityInfo()

Private Member Functions

def _datify

Static Private Attributes

tuple __implements__

Detailed Description

Events are objects for the Calendar topical query.

Definition at line 92 of file Event.py.


Constructor & Destructor Documentation

def CMFCalendar.Event.Event.__init__ (   self,
  id,
  title = '',
  description = '',
  effective_date = None,
  expiration_date = None,
  start_date = None,
  end_date = None,
  location = '',
  contact_name = '',
  contact_email = '',
  contact_phone = '',
  event_url = '' 
)

Definition at line 119 of file Event.py.

00119 
00120                 ):
00121         DefaultDublinCoreImpl.__init__(self)
00122         self.id=id
00123         self.setTitle(title)
00124         self.setDescription(description)
00125         self.effective_date = effective_date
00126         self.expiration_date = expiration_date
00127         self.setStartDate(start_date)
00128 
00129         if start_date is None:
00130             start_date = DateTime()
00131         if end_date is None:
00132             end_date = start_date
00133 
00134         if end_date < start_date:
00135             end_date = start_date
00136 
00137         self.setEndDate(end_date)
00138         self.location=location
00139         self.contact_name=contact_name
00140         self.contact_email=contact_email
00141         self.contact_phone=contact_phone
00142         self.event_url=event_url


Member Function Documentation

def CMFCalendar.Event.Event._datify (   self,
  attrib 
) [private]

Definition at line 144 of file Event.py.

00144 
00145     def _datify( self, attrib ):
00146         if attrib == 'None':
00147             attrib = None
00148         elif not isinstance( attrib, DateTime ):
00149             if attrib is not None:
00150                 attrib = DateTime( attrib )
00151         return attrib

Here is the caller graph for this function:

Definition at line 249 of file Event.py.

00249 
00250     def buildDays(self):
00251         result = []
00252         for day in range (1, 32):
00253             result.append(str('%d' % (day)))
00254         return result

Definition at line 256 of file Event.py.

00256 
00257     def buildMonths(self):
00258         result = []
00259         for month in range (1, 13):
00260             result.append(str('%d' % (month)))
00261         return result

Definition at line 241 of file Event.py.

00241 
00242     def buildTimes(self):
00243         result = []
00244         for hour in range (1, 13):
00245             for min in (00, 30):
00246                 result.append('%02d:%02d' % (hour, min))
00247         return result

Definition at line 263 of file Event.py.

00263 
00264     def buildYears(self):
00265         result = []
00266         start = (DateTime().year() - 2)
00267         end = (DateTime().year() + 5)
00268         for year in range (start, end):
00269             result.append(str(year))
00270         return result

def CMFCalendar.Event.Event.edit (   self,
  title = None,
  description = None,
  eventType = None,
  effectiveDay = None,
  effectiveMo = None,
  effectiveYear = None,
  expirationDay = None,
  expirationMo = None,
  expirationYear = None,
  start_time = None,
  startAMPM = None,
  stop_time = None,
  stopAMPM = None,
  location = None,
  contact_name = None,
  contact_email = None,
  contact_phone = None,
  event_url = None 
)
\

Definition at line 188 of file Event.py.

00188 
00189             ):
00190         """\
00191         """
00192 
00193         if title is not None: 
00194             self.setTitle(title)
00195         if description is not None:
00196             self.setDescription(description)
00197         if eventType is not None:
00198             self.setSubject(eventType)
00199 
00200         start_date = end_date = None
00201 
00202         if effectiveDay and effectiveMo and effectiveYear and start_time:
00203             efdate = '%s/%s/%s %s %s' % (effectiveYear
00204                                          , effectiveMo
00205                                          , effectiveDay
00206                                          , start_time
00207                                          , startAMPM
00208                                          )
00209             start_date = DateTime( efdate )
00210 
00211         if expirationDay and expirationMo and expirationYear and stop_time:
00212 
00213             exdate = '%s/%s/%s %s %s' % (expirationYear
00214                                          , expirationMo
00215                                          , expirationDay
00216                                          , stop_time
00217                                          , stopAMPM
00218                                          )
00219             end_date = DateTime( exdate )
00220 
00221         if start_date and end_date:
00222 
00223             if end_date < start_date:
00224                 end_date = start_date
00225 
00226             self.setStartDate( start_date )
00227             self.setEndDate( end_date )
00228 
00229         if location is not None:
00230             self.location = location
00231         if contact_name is not None:
00232             self.contact_name = contact_name
00233         if contact_email is not None:
00234             self.contact_email = contact_email
00235         if contact_phone is not None:
00236             self.contact_phone = contact_phone
00237         if event_url is not None:
00238             self.event_url = event_url
00239         self.reindexObject()

Here is the call graph for this function:

Here is the caller graph for this function:

Return our end time as a DateTime object

Definition at line 291 of file Event.py.

00291 
00292     def end(self):
00293         """ Return our end time as a DateTime object
00294         """
00295         date = getattr( self, 'end_date', None )
00296         return date is None and self.start() or date

Here is the call graph for this function:

Here is the caller graph for this function:

Used for FTP and apparently the ZMI now too 

Definition at line 418 of file Event.py.

00418 
00419     def get_size( self ):
00420         """ Used for FTP and apparently the ZMI now too """
00421         return len(self.manage_FTPget())
00422 
00423 InitializeClass(Event)

Here is the call graph for this function:

Here is the caller graph for this function:

Returns a mapping with string representations for the end time

o keys are 'day', 'month' and 'year'

Definition at line 153 of file Event.py.

00153 
00154     def getEndStrings(self):
00155         """ Returns a mapping with string representations for the end time
00156 
00157         o keys are 'day', 'month' and 'year'
00158         """
00159         return _dateStrings(self.end())

Here is the call graph for this function:

Return metadata attributes in RFC-822-style header spec.

Definition at line 356 of file Event.py.

00356 
00357     def getMetadataHeaders(self):
00358         """ Return metadata attributes in RFC-822-style header spec.
00359         """
00360         fmt = '%Y-%m-%d %H:%M:%S'
00361         hdrlist = [x for x in DefaultDublinCoreImpl.getMetadataHeaders(self)
00362                          if x[0] != 'Description']
00363         hdrlist.append(('Startdate', self.start().strftime(fmt)))
00364         hdrlist.append(('Enddate',  self.end().strftime(fmt)))
00365         hdrlist.append(('Location', self.location))
00366         hdrlist.append(('Contactname', self.contact_name))
00367         hdrlist.append(('Contactemail', self.contact_email))
00368         hdrlist.append(('Contactphone', self.contact_phone))
00369         hdrlist.append(('Eventurl', self.event_url))
00370 
00371         return hdrlist

Here is the call graph for this function:

Here is the caller graph for this function:

Returns a mapping with string representations for the start time

o keys are 'day', 'month' and 'year'

Definition at line 161 of file Event.py.

00161 
00162     def getStartStrings(self):
00163         """ Returns a mapping with string representations for the start time
00164 
00165         o keys are 'day', 'month' and 'year'
00166         """
00167         return _dateStrings(self.start())

Here is the call graph for this function:

Return our start time as a string.

Definition at line 298 of file Event.py.

00298 
00299     def getStartTimeString( self ):
00300         """ Return our start time as a string.
00301         """
00302         return self.start().AMPMMinutes() 

Here is the call graph for this function:

Return our stop time as a string.

Definition at line 304 of file Event.py.

00304 
00305     def getStopTimeString( self ):
00306         """ Return our stop time as a string.
00307         """
00308         return self.end().AMPMMinutes() 

Here is the call graph for this function:

def CMFCalendar.Event.Event.handleText (   self,
  text,
  format = None 
)
Handles the raw text, returning headers, body, cooked, format 

Definition at line 310 of file Event.py.

00310 
00311     def handleText(self, text, format=None):
00312         """ Handles the raw text, returning headers, body, cooked, format """
00313         headers = {}
00314         if format == 'html':
00315             parser = SimpleHTMLParser()
00316             parser.feed(text)
00317             headers.update(parser.metatags)
00318             if parser.title:
00319                 headers['Title'] = parser.title
00320             bodyfound = bodyfinder(text)
00321             if bodyfound:
00322                 body = bodyfound
00323         else:
00324             headers, body = parseHeadersBody(text, headers)
00325 
00326         return headers, body, format

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 409 of file Event.py.

00409 
00410     def manage_FTPget(self):
00411         "Get the document body for FTP download (also used for the WebDAV SRC)"
00412         hdrlist = self.getMetadataHeaders()
00413         hdrtext = formatRFC822Headers( hdrlist )
00414         bodytext = '%s\r\n\r\n%s' % ( hdrtext, self.Description() )
00415 
00416         return bodytext

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCalendar.Event.Event.PUT (   self,
  REQUEST,
  RESPONSE 
)

FTP handlers.

Handle HTTP (and presumably FTP?) PUT requests 

Definition at line 375 of file Event.py.

00375 
00376     def PUT(self, REQUEST, RESPONSE):
00377         """ Handle HTTP (and presumably FTP?) PUT requests """
00378         self.dav__init(REQUEST, RESPONSE)
00379         self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
00380         body = REQUEST.get('BODY', '')
00381         guessedformat = REQUEST.get_header('Content-Type', 'text/plain')
00382         ishtml = (guessedformat == 'text/html') or html_headcheck(body)
00383 
00384         if ishtml: self.setFormat('text/html')
00385         else: self.setFormat('text/plain')
00386 
00387         try:
00388             headers, body, format = self.handleText(text=body)
00389             self.setMetadata(headers)
00390             self.setStartDate(headers['Startdate'])
00391             self.setEndDate(headers['Enddate'])
00392             self.edit( location=headers['Location']
00393              , contact_name=headers['Contactname']
00394              , contact_email=headers['Contactemail']
00395              , contact_phone=headers['Contactphone']
00396              , event_url=headers['Eventurl']
00397              , description=body
00398              )
00399 
00400         except ResourceLockedError, msg:
00401             transaction.abort()
00402             RESPONSE.setStatus(423)
00403             return RESPONSE
00404 
00405         RESPONSE.setStatus(204)
00406         self.reindexObject()
00407         return RESPONSE

Here is the call graph for this function:

def CMFCalendar.Event.Event.setEndDate (   self,
  end 
)
Setting the event end date, when the event ends.

Definition at line 278 of file Event.py.

00278 
00279     def setEndDate(self, end):
00280         """ Setting the event end date, when the event ends.
00281         """
00282         self.end_date = self._datify(end)

Here is the caller graph for this function:

def CMFCalendar.Event.Event.setMetadata (   self,
  headers 
)
Set an Event's metadata

o headers is a mapping containing keys corresponding to
Dublin Core metadata fields
o Only those attributes that are passed in with the mapping are
manipulated

Definition at line 328 of file Event.py.

00328 
00329     def setMetadata(self, headers):
00330         """ Set an Event's metadata
00331 
00332         o headers is a mapping containing keys corresponding to
00333         Dublin Core metadata fields
00334         o Only those attributes that are passed in with the mapping are
00335         manipulated
00336         """
00337         headers['Format'] = self.Format()
00338         new_subject = keywordsplitter(headers)
00339         headers['Subject'] = new_subject or self.Subject()
00340         new_contrib = contributorsplitter(headers)
00341         headers['Contributors'] = new_contrib or self.Contributors()
00342         haveheader = headers.has_key
00343         for key, value in self.getMetadataHeaders():
00344             if not haveheader(key):
00345                 headers[key] = value
00346         self._editMetadata(title=headers['Title'],
00347                           subject=headers['Subject'],
00348                           contributors=headers['Contributors'],
00349                           effective_date=headers['Effective_date'],
00350                           expiration_date=headers['Expiration_date'],
00351                           format=headers['Format'],
00352                           language=headers['Language'],
00353                           rights=headers['Rights'],
00354                           )

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCalendar.Event.Event.setStartDate (   self,
  start 
)
Setting the event start date when the event is scheduled to begin.

Definition at line 272 of file Event.py.

00272 
00273     def setStartDate(self, start):
00274         """ Setting the event start date when the event is scheduled to begin.
00275         """
00276         self.start_date = self._datify(start)

Here is the caller graph for this function:

Return our start time as a DateTime object

Definition at line 284 of file Event.py.

00284 
00285     def start(self):
00286         """ Return our start time as a DateTime object
00287         """
00288         date = getattr( self, 'start_date', None )
00289         return date is None and self.created() or date

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

tuple CMFCalendar.Event.Event.__implements__ [static, private]
Initial value:
( PortalContent.__implements__
                     , DefaultDublinCoreImpl.__implements__
                     )

Definition at line 102 of file Event.py.

Definition at line 139 of file Event.py.

Definition at line 138 of file Event.py.

Definition at line 140 of file Event.py.

Definition at line 124 of file Event.py.

Definition at line 281 of file Event.py.

Definition at line 141 of file Event.py.

Definition at line 125 of file Event.py.

Definition at line 121 of file Event.py.

Definition at line 137 of file Event.py.

tuple CMFCalendar.Event.Event.security = ClassSecurityInfo() [static]

Definition at line 98 of file Event.py.

Definition at line 275 of file Event.py.


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