Changeset 3877

Show
Ignore:
Timestamp:
06/21/08 10:15:39 (2 months ago)
Author:
athomas
Message:

Fix Wiki tag saving semantics. Fixes #3206.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tagsplugin/trunk/tractags/wiki.py

    r3808 r3877  
    5050 
    5151    def validate_wiki_page(self, req, page): 
     52        # If we're saving the wiki page, and can modify tags, do so 
    5253        if req and 'TAGS_MODIFY' in req.perm(page.resource) \ 
    5354                and req.path_info.startswith('/wiki') and 'save' in req.args: 
    54             if self._update_tags(req, page) and \ 
    55                     page.text == page.old_text and \ 
    56                     page.readonly == int('readonly' in req.args) and \ 
    57                     page.version > 0: 
    58                 req.redirect(get_resource_url(self.env, page.resource, req.href, version=None)) 
     55            page_modified = req.args.get('text') != page.old_text or \ 
     56                    page.readonly != int('readonly' in req.args) 
     57            # Always save tags if the page has been otherwise modified 
     58            if page_modified: 
     59                self._update_tags(req, page) 
     60            elif page.version > 0: 
     61                # If the page hasn't been otherwise modified, save the tags 
     62                # and redirect so we don't get the "page has not been modified" 
     63                # warning 
     64                if self._update_tags(req, page): 
     65                    req.redirect(get_resource_url(self.env, page.resource, req.href, version=None)) 
    5966        return [] 
    6067