~ubuntu-branches/ubuntu/oneiric/moin/oneiric-security

« back to all changes in this revision

Viewing changes to MoinMoin/events/__init__.py

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2010-03-30 12:55:34 UTC
  • mfrom: (0.1.17 sid)
  • Revision ID: james.westby@ubuntu.com-20100330125534-4c2ufc1rok24447l
Tags: 1.9.2-2ubuntu1
* Merge from Debian testing (LP: #521834). Based on work by Stefan Ebner.
  Remaining changes:
 - Remove python-xml from Suggests field, the package isn't anymore in
   sys.path.
 - Demote fckeditor from Recommends to Suggests; the code was previously
   embedded in moin, but it was also disabled, so there's no reason for us
   to pull this in by default currently. Note: This isn't necessary anymore
   but needs a MIR for fckeditor, so postpone dropping this change until
   lucid+1
* debian/rules:
  - Replace hardcoded python2.5 with python* and hardcore python2.6 for ln
* debian/control.in: drop versioned depends on cdbs

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
        self.size = size
120
120
 
121
121
 
 
122
class FileRemovedEvent(PageEvent):
 
123
 
 
124
    name = u"FileRemovedEvent"
 
125
    description = _(u"""An attachment has been removed""")
 
126
    req_superuser = False
 
127
 
 
128
    def __init__(self, request, pagename, filename, size):
 
129
        PageEvent.__init__(self, request)
 
130
        self.request = request
 
131
        self.pagename = pagename
 
132
        self.filename = filename
 
133
        self.size = size
 
134
 
 
135
 
122
136
class PageRevertedEvent(PageEvent):
123
137
 
124
138
    name = u"PageRevertedEvent"
151
165
        Event.__init__(self, request)
152
166
        self.jid = jid
153
167
 
 
168
 
154
169
class JabberIDUnsetEvent(Event):
155
170
    """ Sent when Jabber ID is no longer used
156
171
 
162
177
        Event.__init__(self, request)
163
178
        self.jid = jid
164
179
 
 
180
 
165
181
class UserCreatedEvent(Event):
166
182
    """ Sent when a new user has been created """
167
183
 
173
189
        Event.__init__(self, request)
174
190
        self.user = user
175
191
 
 
192
 
176
193
class PagePreSaveEvent(Event):
177
194
    """ Event sent when a page is about to be saved
178
195
 
179
 
    This can be used to abort a save, for instance,
180
 
    if handler returns
181
 
 
 
196
    This can be used to abort a save, for instance, if handler returns Abort.
182
197
    """
183
198
 
184
199
    name = u"PagePreSaveEvent"
193
208
    """ This is a base class for messages passed from event handlers """
194
209
    pass
195
210
 
 
211
 
196
212
class Abort(EventResult):
197
213
    """ Result returned if handler wants to abort operation that sent the event """
198
214
    def __init__(self, reason):
205
221
def get_handlers(cfg):
206
222
    """Create a list of available event handlers.
207
223
 
208
 
    Each handler is a handle() function defined in an plugin,
 
224
    Each handler is a handle() function defined in a plugin,
209
225
    pretty much like in case of actions.
210
226
 
211
227
    TODO: maybe make it less dumb? ;-)
212
 
 
213
228
    """
214
229
    event_handlers = []
215
230
    names = wikiutil.getPlugins("events", cfg)
248
263
 
249
264
    return msg
250
265
 
 
266
 
251
267
def get_subscribable_events():
252
268
    """Create and return a list of user-visible events
253
269
 
265
281
 
266
282
# Get rid of the dummy getText so that it doesn't get imported with *
267
283
del _
 
284