Changeset 7647


Ignore:
Timestamp:
14 Feb 2012, 10:38:04 (13 years ago)
Author:
uli
Message:

Move ReindexPage? to general browser module as it is not student specific.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r7600 r7647  
    3333    IPrincipalRoleManager, IPrincipalRoleMap)
    3434from zope.component import (
    35     getUtility, createObject,getAllUtilitiesRegisteredFor)
     35    getUtility, queryUtility, createObject, getAllUtilitiesRegisteredFor)
    3636#from zope.component.interfaces import Invalid
    3737from zope.event import notify
     
    5959from waeup.sirp.authentication import get_principal_role_manager
    6060from waeup.sirp.utils.helpers import get_user_account
    61 from waeup.sirp.browser.layout import jsaction, action
     61from waeup.sirp.browser.layout import jsaction, action, UtilityView
    6262
    6363grok.context(ISIRPObject)
     
    316316    def entries(self):
    317317        return ()
     318
     319class ReindexPage(UtilityView, grok.View):
     320    """ Reindex view.
     321
     322    Reindexes a catalog. For managers only.
     323    """
     324    grok.context(IUniversity)
     325    grok.name('reindex')
     326    grok.require('waeup.manageUniversity')
     327
     328    def update(self,ctlg=None):
     329        if ctlg is None:
     330            self.flash('No catalog name provided.')
     331            return
     332        cat = queryUtility(ICatalog, name='%s_catalog' % ctlg)
     333        if cat is None:
     334            self.flash('%s_catalog does not exist' % ctlg)
     335            return
     336        cat.updateIndexes()
     337        self.flash('%s reindexed.' % ctlg.capitalize())
     338        return
     339
     340    def render(self):
     341        self.redirect(self.url(self.context, '@@index'))
     342        return
    318343
    319344#
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r7646 r7647  
    18481848        return
    18491849
    1850 class ReindexPage(UtilityView, grok.View):
    1851     """ Reindex view.
    1852 
    1853     Reindexes a catalog.
    1854     """
    1855     grok.context(IUniversity)
    1856     grok.name('reindex')
    1857     grok.require('waeup.manageUniversity')
    1858 
    1859     def update(self,ctlg=None):
    1860         if ctlg is None:
    1861             self.flash('No catalog name provided.')
    1862             return
    1863         cat = queryUtility(ICatalog, name='%s_catalog' % ctlg)
    1864         if cat is None:
    1865             self.flash('%s_catalog does not exist' % ctlg)
    1866             return
    1867         cat.updateIndexes()
    1868         self.flash('%s reindexed.' % ctlg.capitalize())
    1869         return
    1870 
    1871     def render(self):
    1872         self.redirect(self.url(self.context, '@@index'))
    1873         return
Note: See TracChangeset for help on using the changeset viewer.