Changeset 3089

Show
Ignore:
Timestamp:
01/17/08 20:29:13 (10 months ago)
Author:
ixokai
Message:

Cleaned up previous watch + WikiStart fix. To do it smartlierest like okay.

Files:

Legend:

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

    r3088 r3089  
    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 
     
    137137         
    138138        if req.authname != "anonymous": 
    139             for path in self.watchable_paths: 
    140                 if re.match(path, req.path_info): 
    141                     if req.path_info == '/': 
    142                         realm = 'wiki' 
    143                     else: 
    144                         realm, _ = self.normalise_resource(req.path_info).split('/', 1) 
     139            for pattern in self.watchable_paths: 
     140                path = self.normalise_resource(req.path_info) 
     141                if re.match(pattern, path): 
     142                    realm, _ = path.split('/', 1) 
    145143     
    146144                    if '%s_VIEW' % realm.upper() not in req.perm: 
     
    157155    # Internal methods 
    158156    def render_watcher(self, req): 
    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) 
     157        resource = self.normalise_resource(req.path_info) 
     158        realm, resource = resource.split('/', 1) 
    165159                 
    166160        if self.is_watching(req.session.sid, not req.authname == 'anonymous', realm, resource): 
     
    179173            resource = resource.strip('/') 
    180174            # Special-case start page 
    181             if resource == 'wiki': 
     175            if not resource: 
     176                resource = "wiki/WikiStart" 
     177            elif resource == 'wiki': 
    182178                resource += '/WikiStart' 
    183179            return resource