Changeset 935

Show
Ignore:
Timestamp:
06/21/06 01:02:09 (3 years ago)
Author:
pacopablo
Message:

TracBlogPlugin:

Part of the reason for not including a special flag is the whole complexity deal. Right now the blog plugin doesn't have to update the enviroment in anyway. This is nice. Also, normal wiki pages aren't tagged with anything by default. Blog pages should be tagged with 'blog' by default, unless you specifically go into webadmin and change the 'Default Tag' setting.

  • Added BlogShow macro to the macro blacklist. It need not be specified in the 'Macro Blacklist' webadmin option.
  • Added a check for recursive reference. The BlogShow macro will not render the page from which it is called if it happens to be one of the pages in the list of tagged blog entries
  • Closes #447
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tracblogplugin/0.10/blog/web_ui.py

    r766 r935  
    9191    used. 
    9292 
     93    Because any wiki page can be a blog entry,it is suggested that one uses a 
     94    unique tag for any page that should appear in the blog, such as the tag: 
     95    'blog' (the default). 
     96 
    9397    The following options can be specified: 
    9498 
     
    227231        else: 
    228232            blog = tags.get_tagged_names(tlist, operation='intersection') 
     233        macropage = req.args.get('page', None) 
    229234 
    230235        poststart, postend, default_times = self._get_time_range(req, **kwargs) 
     
    236241        macro_bl = self.env.config.get('blog', 'macro_blacklist', '').split(',') 
    237242        macro_bl = [name.strip() for name in macro_bl if name.strip()] 
     243        macro_bl.append('BlogShow') 
    238244                        
    239245        num_posts = self._choose_value('num_posts', req, kwargs, convert=int) 
     
    242248            postend = 0 
    243249        for blog_entry in blog: 
     250            if blog_entry == macropage: 
     251                continue 
    244252            page = WikiPage(self.env, version=1, name=blog_entry) 
    245253            version, post_time, author, comment, ipnr = page.get_history( 
     
    253261                              or '%x %X' 
    254262                timeStr = format_datetime(post_time, format=time_format)  
    255                 text = self._trim_page(page.text, blog_entry) 
     263                post_size = self._choose_value('post_size', req, kwargs, int) 
     264                if not post_size: 
     265                    post_size = int(self.env.config.get('blog', 'post_size',  
     266                                    1024)) 
     267                text = self._trim_page(page.text, blog_entry, post_size) 
    256268                pagetags = [x for x in tags.get_name_tags(blog_entry) if x not in tlist] 
    257269                tagtags = [] 
     
    512524        return val 
    513525 
    514     def _trim_page(self, text, page_name): 
     526    def _trim_page(self, text, page_name, post_size): 
    515527        """Trim the page text to the {{{post_size}} in trac.ini 
    516528 
     
    520532 
    521533        """ 
    522         post_size = int(self.env.config.get('blog', 'post_size', 1024)) 
    523534        tlines = [] 
    524535        entry_size = 0