1. Ryan Ollos
  2. MoreWikiMacrosPlugin


rjollos  committed 18678bf Draft

Strip leading and trailing quotes, and use `can_view` since `is_viewable` does not exist in Trac 0.12

  • Participants
  • Parent commits 68655b4
  • Branches default

Comments (0)

Files changed (1)

File morewikimacros/macros.py

View file
  • Ignore whitespace
     def expand_macro(self, formatter, name, content):
         if content:
-            fqpath = content
+            fqpath = content.strip('\'\"')
             return system_message(_('Error: Invalid usage'),
                                   _('Repository path must be specified as the fist argument'))
         repos_mgr = RepositoryManager(self.env)
         repos_name, repos, path = repos_mgr.get_repository_by_path(fqpath) #0.12+ only
         path, rev = _split_path(path)
+        rev = rev or repos.get_youngest_rev()
         if repos.has_node(path, rev):
             node = repos.get_node(path, rev)
-            rev = rev or repos.get_youngest_rev()
             entries = [n for n in sorted(node.get_entries(), key=lambda n: 
-                       if n.is_viewable(formatter.req.perm)]
+                       if n.can_view(formatter.req.perm)]
             if not entries:
                 return system_message(_('Error: Invalid usage'),
                                       _("Listing files is not yet supported."))
-            rev = rev or repos.get_youngest_rev()
             raise NoSuchNode(path, rev)
         list_items = [tag.li(tag.a(e.path, href=formatter.href.browser(repos_name + '/' +