imip-agent

imip_manager.py

478:a165cad1a1ff
2015-04-04 Paul Boddie Changed get_attendees to obtain a normalised list of unique attendees, providing update_attendees for adding and removing from such a list. Introduced get_attendees into the event finalisation process.
     1 #!/usr/bin/env python     2      3 """     4 A Web interface to a user's calendar.     5      6 Copyright (C) 2014, 2015 Paul Boddie <paul@boddie.org.uk>     7      8 This program is free software; you can redistribute it and/or modify it under     9 the terms of the GNU General Public License as published by the Free Software    10 Foundation; either version 3 of the License, or (at your option) any later    11 version.    12     13 This program is distributed in the hope that it will be useful, but WITHOUT    14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    15 FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more    16 details.    17     18 You should have received a copy of the GNU General Public License along with    19 this program.  If not, see <http://www.gnu.org/licenses/>.    20 """    21     22 # Edit this path to refer to the location of the imiptools libraries, if    23 # necessary.    24     25 LIBRARY_PATH = "/var/lib/imip-agent"    26     27 import sys    28 sys.path.append(LIBRARY_PATH)    29     30 from imipweb.calendar import CalendarPage    31 from imipweb.event import EventPage    32 from imipweb.resource import Resource    33     34 class Manager(Resource):    35     36     "A simple manager application."    37     38     def select_action(self):    39     40         "Select the desired action and show the result."    41     42         path_info = self.env.get_path_info().strip("/")    43     44         if not path_info:    45             CalendarPage(self).show()    46         elif EventPage(self).show(path_info):    47             pass    48         else:    49             self.no_page()    50     51     def __call__(self):    52     53         "Interpret a request and show an appropriate response."    54     55         if not self.user:    56             self.no_user()    57         else:    58             self.select_action()    59     60         # Write the headers and actual content.    61     62         print >>self.out, "Content-Type: text/html; charset=%s" % self.encoding    63         print >>self.out    64         self.out.write(unicode(self.page).encode(self.encoding))    65     66 if __name__ == "__main__":    67     Manager()()    68     69 # vim: tabstop=4 expandtab shiftwidth=4