[IMP]: Caldav: Improvement in code, added help text in attendee and alarm object

bzr revid: rpa@tinyerp.com-20091223095404-ihojnyyrhfh2pcxc
This commit is contained in:
rpa (Open ERP) 2009-12-23 15:24:04 +05:30
parent 1502dc1224
commit 1b1772e204
2 changed files with 42 additions and 36 deletions

View File

@ -22,12 +22,8 @@
from datetime import datetime, timedelta
from dateutil import parser
from dateutil.rrule import *
from osv import fields, osv
from pytz import timezone
from time import strftime
import base64
from osv import osv
import re
import time
import vobject
# O-1 Optional and can come only once
@ -81,13 +77,12 @@ class CalDAV(object):
for date in exdate:
datetime_obj = todate(date)
rset1._exdate.append(datetime_obj)
re_dates = rset1._iter()
recurrent_dates = map(lambda x:x.strftime('%Y-%m-%d %H:%M:%S'), re_dates)
return recurrent_dates
re_dates = map(lambda x:x.strftime('%Y-%m-%d %H:%M:%S'), rset1._iter())
return re_dates
def ical_set(self, name, value, type):
if name in self.__attribute__ and self.__attribute__[name]:
self.__attribute__[name][type] = value
self.__attribute__[name][type] = value
return True
def ical_get(self, name, type):
@ -104,7 +99,7 @@ class CalDAV(object):
val = int(val)
return val
else:
return self.__attribute__.get(name, None)
return self.__attribute__.get(name, None)
def ical_reset(self, type):
for name in self.__attribute__:
@ -297,10 +292,8 @@ class Timezone(CalDAV):
'tzid': None, # Use: R-1, Type: Text, Specifies the text value that uniquely identifies the "VTIMEZONE" calendar component.
'last-mod': None, # Use: O-1, Type: DATE-TIME, Specifies the date and time that the information associated with the calendar component was last revised in the calendar store.
'tzurl': None, # Use: O-1, Type: URI, Provides a means for a VTIMEZONE component to point to a network location that can be used to retrieve an up-to-date version of itself.
'standardc': # Use: R-n,
{'tzprop': None, }, # Use: R-1,
'daylightc': # Use: R-n, Type: Text,
{'tzprop': None, }, # Use: R-1,
'standardc': {'tzprop': None}, # Use: R-1,
'daylightc': {'tzprop': None}, # Use: R-1,
'x-prop': None, # Use: O-n, Type: Text,
}
@ -419,4 +412,4 @@ class Attendee(CalDAV, osv.osv_memory):
Attendee()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -51,22 +51,29 @@ class crm_caldav_attendee(osv.osv):
_columns = {
'cutype': fields.selection([('INDIVIDUAL', 'INDIVIDUAL'), ('GROUP', 'GROUP'), \
('RESOURCE', 'RESOURCE'), ('ROOM', 'ROOM'), \
('UNKNOWN', 'UNKNOWN') ], 'CUTYPE'),
'member': fields.char('Member', size=124),
('UNKNOWN', 'UNKNOWN') ], 'CUTYPE', \
help="Specify the type of calendar user"),
'member': fields.char('Member', size=124, help="Indicate the groups that the attendee belongs to"),
'role': fields.selection([ ('REQ-PARTICIPANT', 'REQ-PARTICIPANT'), \
('CHAIR', 'CHAIR'), ('OPT-PARTICIPANT', 'OPT-PARTICIPANT'), \
('NON-PARTICIPANT', 'NON-PARTICIPANT')], 'ROLE'),
'partstat': fields.selection([('NEEDS-ACTION', 'NEEDS-ACTION'), \
('ACCEPTED', 'ACCEPTED'), ('DECLINED', 'DECLINED'), \
('TENTATIVE', 'TENTATIVE'), \
('DELEGATED', 'DELEGATED')], 'PARTSTAT'),
'rsvp': fields.boolean('RSVP'),
'delegated_to': fields.char('DELEGATED-TO', size=124),
'delegated_from': fields.char('DELEGATED-FROM', size=124),
'sent_by': fields.char('SENT-BY', size=124),
'cn': fields.char('CN', size=124),
'dir': fields.char('DIR', size=124),
'language': fields.char('LANGUAGE', size=124),
('NON-PARTICIPANT', 'NON-PARTICIPANT')], 'ROLE', \
help='Participation role for the calendar user'),
'partstat': fields.selection([('TENTATIVE', 'TENTATIVE'),
('NEEDS-ACTION', 'NEEDS-ACTION'),
('ACCEPTED', 'ACCEPTED'),
('DECLINED', 'DECLINED'),
('DELEGATED', 'DELEGATED')], 'PARTSTAT', \
help="Status of the attendee's participation"),
'rsvp': fields.boolean('RSVP', help="Indicats whether the favor of a reply is requested"),
'delegated_to': fields.char('DELEGATED-TO', size=124, \
help="The calendar users that the original request was delegated to"),
'delegated_from': fields.char('DELEGATED-FROM', size=124, \
help="Indicates whom the request was delegated from"),
'sent_by': fields.char('SENT-BY', size=124, \
help="Specify the calendar user that is acting on behalf of the calendar user"),
'cn': fields.char('CN', size=124, help="The common or displayable name to be associated with the calendar user"),
'dir': fields.char('DIR', size=124, help="Reference to the URI that points to the directory information corresponding to the attendee."),
'language': fields.char('LANGUAGE', size=124, help="To specify the language for text values in a property or property parameter."),
}
_defaults = {
'cn': lambda *x: 'MAILTO:',
@ -93,22 +100,28 @@ class crm_caldav_alarm(osv.osv):
}
_columns = {
'name': fields.char('Summary', size=124),
'name': fields.char('Summary', size=124, help="""Contains the text to be used as the message subject for EMAIL
or contains the text to be used for DISPLAY"""),
'action': fields.selection([('AUDIO', 'AUDIO'), ('DISPLAY', 'DISPLAY'), \
('PROCEDURE', 'PROCEDURE'), ('EMAIL', 'EMAIL') ], 'Action', required=True),
'description': fields.text('Description'),
('PROCEDURE', 'PROCEDURE'), ('EMAIL', 'EMAIL') ], 'Action', \
required=True, help="Defines the action to be invoked when an alarm is triggered"),
'description': fields.text('Description', help='Provides a more complete description of the calendar component, than that provided by the "SUMMARY" property'),
'attendee_ids': fields.many2many('crm.caldav.attendee', 'alarm_attendee_rel', \
'alarm_id', 'attendee_id', 'Attendees'),
'trigger_occurs': fields.selection([('BEFORE', 'BEFORE'), ('AFTER', 'AFTER')], \
'Trigger time', required=True),
'trigger_interval': fields.selection([('MINUTES', 'MINUTES'), ('HOURS', 'HOURS'), \
('DAYS', 'DAYS')], 'Trugger duration', required=True),
('DAYS', 'DAYS')], 'Trigger duration', required=True),
'trigger_duration': fields.integer('TIme', required=True),
'trigger_related': fields.selection([('start', 'The event starts'), ('end', \
'The event ends')], 'Trigger Occures at', required=True),
'duration': fields.integer('Duration'),
'duration': fields.integer('Duration', help="""Duration' and 'Repeat' \
are both optional, but if one occurs, so MUST the other"""),
'repeat': fields.integer('Repeat'), # TODO
'attach': fields.binary('Attachment'),
'attach': fields.binary('Attachment', help="""* Points to a sound resource, which is rendered when the alarm is triggered for AUDIO,
* File which is intended to be sent as message attachments for EMAIL,
* Points to a procedure resource, which is invoked when the alarm is triggered for PROCEDURE.
"""),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the event alarm information without removing it."),
}
@ -214,7 +227,7 @@ class virtual_wizard(web_services.wizard):
if 'id' in datas:
datas['id'] = caldevIDs2readIDs(datas['id'])
for id in datas['ids']:
new_ids.append(caldevIDs2readIDs(id))
new_ids.append(caldevIDs2readIDs(id))
datas['ids'] = new_ids
res=super(virtual_wizard, self).exp_execute(db, uid, wiz_id, datas, action, context)
return res