Mercurial > moin > 2.0
diff MoinMoin/items/__init__.py @ 477:72899d48db41
alphabetic listing of global index, with link to item index
author | Akash Sinha <akash2607@gmail.com> |
---|---|
date | Thu, 07 Jul 2011 03:36:08 +0530 |
parents | eea3a94a4061 |
children | 19b257c0e102 |
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py Wed Jun 29 02:25:05 2011 +0530 +++ b/MoinMoin/items/__init__.py Thu Jul 07 03:36:08 2011 +0530 @@ -575,15 +575,26 @@ for item in item_iterator] return sorted(items) - def flat_index(self): + def flat_index(self, startswith=None): index = self.get_index() - index = [(fullname, relname, contenttype) - for fullname, relname, contenttype in index - if u'/' not in relname] + if startswith: + startswith = (u'%s' % startswith, u'%s' % startswith.swapcase()) + index = [(fullname, relname, contenttype) + for fullname, relname, contenttype in index + if u'/' not in relname and relname.startswith(startswith)] + else: + index = [(fullname, relname, contenttype) + for fullname, relname, contenttype in index + if u'/' not in relname] + return index index_template = 'index.html' + def name_initial(self, names=None): + initials = [(name[1][0]) + for name in names] + return initials class NonExistent(Item): contenttype_groups = [