Imported Upstream version 0.48
[platform/upstream/libical.git] / src / python / Attendee.py
1 #!/usr/bin/env python 
2 # -*- Mode: python -*-
3 #======================================================================
4 # FILE: Property.py
5 # CREATOR: eric 
6 #
7 # DESCRIPTION:
8 #   
9 #
10 #  $Id: Attendee.py,v 1.1 2001-04-03 15:18:42 ebusboom Exp $
11 #  $Locker:  $
12 #
13 # (C) COPYRIGHT 2001, Eric Busboom <eric@softwarestudio.org>
14 # (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>  
15 #
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of either: 
18 #
19 #    The LGPL as published by the Free Software Foundation, version
20 #    2.1, available at: http://www.fsf.org/copyleft/lesser.html
21 #
22 #  Or:
23 #
24 #    The Mozilla Public License Version 1.0. You may obtain a copy of
25 #    the License at http://www.mozilla.org/MPL/
26 #======================================================================
27
28 from LibicalWrap import *
29 from Property import Property
30 from types import DictType, StringType, IntType
31
32 class Attendee(Property):
33     """Class for Attendee properties.
34
35     Usage:
36     Attendee([dict])
37     Attendee([address])
38
39     Where:
40     dict is an optional dictionary with keys of
41      'value': CAL-ADDRESS string and any parameter: parameter_value entries.
42      'name' and 'value_type' entries in dict are ignored and automatically set
43      with the appropriate values.
44     address is the CAL-ADDRESS (string) of the Attendee 
45     """
46
47     def __init__(self, arg={}):
48         
49         assert(isinstance(arg,DictType))
50
51         ref = None
52         
53         if arg!={}:
54             ref = arg['ref']
55
56         Property.__init__(self,type='ATTENDEE',ref=ref)
57         
58     def _doParam(self, parameter, v):
59         if v!=None:
60             self[parameter]=v
61         return self[parameter]
62
63     # Methods for accessing enumerated parameters
64     def cn(self, v=None): self._doParam('CN', v)
65     def cutype(self, v=None): self._doParam('CUTYPE', v)
66     def dir(self, v=None): self._doParam('DIR', v)
67     def delegated_from(self, v=None): self._doParam('DELEGATED-FROM', v)
68     def delegated_to(self, v=None): self._doParam('DELEGATED-TO', v)
69     def language(self, v=None): self._doParam('LANGUAGE', v)
70     def member(self, v=None): self._doParam('MEMBER', v)
71     def partstat(self, v=None): self._doParam('PARTSTAT', v)
72     def role(self, v=None): self._doParam('ROLE', v)
73     def rsvp(self, v=None): self._doParam('RSVP', v)
74     def sent_by(self, v=None): self._doParam('SENT-BY', v)
75
76
77 class Organizer(Property):
78     """Class for Organizer property.
79     """
80
81     def __init__(self, arg={}):
82
83         assert(isinstance(arg, DictType))
84         
85         ref = None
86         if arg != {}:
87             ref = arg['ref']
88         Property.__init__(self, type='ORGANIZER', ref=ref)
89        
90 ##         param_t = ( 'CN', 'DIR', 'SENT-BY', 'LANGUAGE' )
91 ##         for param in param_t:
92 ##             self[param] = None
93 ##         if value != None:
94 ##             self.value(value)
95
96
97     def _doParam(self, parameter, v):
98         if v!=None:
99             self[parameter]=v
100         return self[parameter]
101
102     def name(self):
103         "Return the name of the property."
104         return Property.name(self)
105
106     def value_type(self):
107         "Return the value type of the property."
108         return self._desc['value_type']
109
110     # Methods for accessing enumerated parameters
111     def cn(self, v=None): self._doParam('CN', v)
112     def dir(self, v=None): self._doParam('DIR', v)
113     def language(self, v=None): self._doParam('LANGUAGE', v)
114     def sent_by(self, v=None): self._doParam('SENT-BY', v)