equal
deleted
inserted
replaced
91 |
91 |
92 msg = self.NON_UNIQUE_SERVICE_FMT % (service, services) |
92 msg = self.NON_UNIQUE_SERVICE_FMT % (service, services) |
93 super(NonUniqueService, self).__init__(msg) |
93 super(NonUniqueService, self).__init__(msg) |
94 |
94 |
95 |
95 |
|
96 class AlreadyRegisteredRight(Error): |
|
97 """Error raised when a right is registrated a second time |
|
98 """ |
|
99 |
|
100 ALREADY_REGISTERED_RIGHT_FMT = "Tried to register right '%s' a second time." |
|
101 |
|
102 def __init__(self, right): |
|
103 """Instantiates a new exception with a customized message. |
|
104 """ |
|
105 |
|
106 msg = self.ALREADY_REGISTERED_RIGHT_FMT % right |
|
107 super(AlreadyRegisteredRight, self).__init__(msg) |
|
108 |
|
109 |
96 class Core(object): |
110 class Core(object): |
97 """The core handler that controls the Melange API. |
111 """The core handler that controls the Melange API. |
98 """ |
112 """ |
99 |
113 |
100 def __init__(self): |
114 def __init__(self): |
325 |
339 |
326 def registerRight(self, key, value): |
340 def registerRight(self, key, value): |
327 """Registers the specified right. |
341 """Registers the specified right. |
328 """ |
342 """ |
329 |
343 |
|
344 if key in self.rights: |
|
345 raise AlreadyRegisteredRight(key) |
|
346 |
330 self.rights[key] = value |
347 self.rights[key] = value |