comparison MoinMoin/wikiutil.py @ 1549:e36313297589

introduce request.cfg.cache object, start using it for some precompiled regexes
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 14 Sep 2006 22:08:45 +0200
parents 563bfe02b04f
children a4f0632414da
comparison
equal deleted inserted replaced
1548:2eb5117aa7de 1549:e36313297589
680 680
681 @param pagename: the page name 681 @param pagename: the page name
682 @rtype: bool 682 @rtype: bool
683 @return: true if page is a template page 683 @return: true if page is a template page
684 """ 684 """
685 filter = re.compile(request.cfg.page_template_regex, re.UNICODE) 685 return request.cfg.cache.page_template_regex.search(pagename) is not None
686 return filter.search(pagename) is not None
687 686
688 687
689 def isGroupPage(request, pagename): 688 def isGroupPage(request, pagename):
690 """ Is this a name of group page? 689 """ Is this a name of group page?
691 690
692 @param pagename: the page name 691 @param pagename: the page name
693 @rtype: bool 692 @rtype: bool
694 @return: true if page is a form page 693 @return: true if page is a form page
695 """ 694 """
696 filter = re.compile(request.cfg.page_group_regex, re.UNICODE) 695 return request.cfg.cache.page_group_regex.search(pagename) is not None
697 return filter.search(pagename) is not None
698 696
699 697
700 def filterCategoryPages(request, pagelist): 698 def filterCategoryPages(request, pagelist):
701 """ Return category pages in pagelist 699 """ Return category pages in pagelist
702 700
709 707
710 @param pagelist: a list of pages 708 @param pagelist: a list of pages
711 @rtype: list 709 @rtype: list
712 @return: only the category pages of pagelist 710 @return: only the category pages of pagelist
713 """ 711 """
714 func = re.compile(request.cfg.page_category_regex, re.UNICODE).search 712 func = request.cfg.cache.page_category_regex.search
715 return filter(func, pagelist) 713 return filter(func, pagelist)
716 714
717 715
718 # TODO: we may rename this to getLocalizedPage because it returns page 716 # TODO: we may rename this to getLocalizedPage because it returns page
719 # that have translations. 717 # that have translations.