Changeset 3087

Show
Ignore:
Timestamp:
01/17/08 19:48:46 (11 months ago)
Author:
ixokai
Message:

Fixed it so you can watch WikiStart, and a couple other 'watcher' mods.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • announcerplugin/0.11/announcerplugin/subscribers/watchers.py

    r3086 r3087  
    1616        ITicketChangeListener, IWikiChangeListener) 
    1717 
    18     watchable_paths = ListOption('announcer', 'watchable_paths', '/wiki*,/ticket*', 
     18    watchable_paths = ListOption('announcer', 'watchable_paths', '/,/wiki*,/ticket*', 
    1919        doc='List of URL paths to allow voting on. Globs are supported.') 
    2020 
     
    4444        if self.is_watching(sid, authenticated, realm, resource): 
    4545            self.set_unwatch(sid, authenticated, realm, resource) 
     46            self._schedule_notice(req, 'You are no longer watching this resource for changes.') 
     47        else: 
     48            self.set_watch(sid, authenticated, realm, resource) 
    4649            self._schedule_notice(req, 'You are now watching this resource for changes.') 
    47         else: 
    48             self.set_watch(sid, authenticated, realm, resource) 
    49             self._schedule_notice(req, 'You are no longer watching this resource for changes.') 
    5050             
    5151    def _schedule_notice(self, req, message): 
     
    104104        """, ( 
    105105                sid, authenticated,  
    106                 'watcher', realm, 'changed',  
     106                'watcher', realm, '*',  
    107107                resource, 'email' 
    108108            ) 
     
    139139            for path in self.watchable_paths: 
    140140                if re.match(path, req.path_info): 
    141                     realm, _ = self.normalise_resource(req.path_info).split('/', 1) 
     141                    if req.path_info == '/': 
     142                        realm = 'wiki' 
     143                    else: 
     144                        realm, _ = self.normalise_resource(req.path_info).split('/', 1) 
     145     
    142146                    if '%s_VIEW' % realm.upper() not in req.perm: 
    143147                        return handler 
     
    153157    # Internal methods 
    154158    def render_watcher(self, req): 
    155         resource = self.normalise_resource(req.path_info) 
    156         realm, resource = resource.split('/', 1) 
     159        if req.path_info == '/': 
     160            resource = 'WikiStart' 
     161            realm = 'wiki' 
     162        else: 
     163            resource = self.normalise_resource(req.path_info) 
     164            realm, resource = resource.split('/', 1) 
    157165                 
    158166        if self.is_watching(req.session.sid, not req.authname == 'anonymous', realm, resource): 
     
    230238         
    231239    def get_subscription_categories(self, realm): 
    232         return ('changed', 'attachment added') 
     240        return ('created', 'changed', 'attachment added') 
    233241         
    234242    def get_subscriptions_for_event(self, event):