~ubuntu-branches/ubuntu/hardy/emesene/hardy-proposed

« back to all changes in this revision

Viewing changes to GroupManager.py

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2008-02-06 21:57:05 UTC
  • Revision ID: james.westby@ubuntu.com-20080206215705-d1abf07rdwcaju3p
Tags: upstream-1.0~r1013
ImportĀ upstreamĀ versionĀ 1.0~r1013

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
#   This file is part of emesene.
 
4
#
 
5
#    Emesene is free software; you can redistribute it and/or modify
 
6
#    it under the terms of the GNU General Public License as published by
 
7
#    the Free Software Foundation; either version 2 of the License, or
 
8
#    (at your option) any later version.
 
9
#
 
10
#    emesene is distributed in the hope that it will be useful,
 
11
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
#    GNU General Public License for more details.
 
14
#
 
15
#    You should have received a copy of the GNU General Public License
 
16
#    along with emesene; if not, write to the Free Software
 
17
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 
 
19
'''a module to handle groups'''
 
20
import gettext
 
21
 
 
22
import abstract.stock as stock
 
23
import abstract.GroupManager
 
24
 
 
25
_ = gettext.gettext
 
26
 
 
27
class GroupManager(abstract.GroupManager.GroupManager):
 
28
    '''this class represent an abstract class that provide methods
 
29
    to interact with groups, implementing this class with the
 
30
    undeliying protocol library let the upper layer use the services
 
31
    of the protocol implementation independently of the api, in this
 
32
    way, the protocol library can be modified (or replaced) 
 
33
    without effect on the clients'''
 
34
 
 
35
    def __init__(self, dialog_manager, protocol):
 
36
        '''initialize the object, dialog_manager is a implementation
 
37
        ot DialogManager, it's used to interact with the user'''
 
38
        abstract.GroupManager.GroupManager.__init__(self, 
 
39
            dialog_manager, protocol)
 
40
 
 
41
    def add(self, name):
 
42
        '''add a group'''
 
43
        if name:
 
44
            self.protocol.addGroup(name)
 
45
        else:
 
46
            debug("invalid group name '%s'" % (name,))
 
47
 
 
48
    def rename(self, name, new_name):
 
49
        '''rename a group'''
 
50
        if new_name and name != new_name:
 
51
            self.protocol.renameGroup(name, new_name)
 
52
        else:
 
53
            debug("invalid group name '%s'" % (new_name,))
 
54
 
 
55
    def remove(self, name):
 
56
        '''remove a group'''
 
57
        self.protocol.removeGroup(name)
 
58