Changeset 3090 in products for quintagroup.analytics


Ignore:
Timestamp:
Mar 31, 2011 11:07:51 AM (13 years ago)
Author:
mylan
Message:

Added view for getting information about size of all objects by path

Location:
quintagroup.analytics/branches/update_mt/quintagroup/analytics/browser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.analytics/branches/update_mt/quintagroup/analytics/browser/configure.zcml

    r3088 r3090  
    6666        /> 
    6767 
     68    <browser:page 
     69        name="size_stats_path" 
     70        for="*" 
     71        permission="zope2.ViewManagementScreens" 
     72        attribute="getSizeInfoByPath" 
     73        class=".views.SizeByPath" 
     74        /> 
     75 
    6876    <browser:resource 
    6977        name="stats_style.css" 
  • quintagroup.analytics/branches/update_mt/quintagroup/analytics/browser/views.py

    r3089 r3090  
    560560        return self.cat(path=path, Language="all") 
    561561 
     562    def getValidPath(self): 
     563        portal = self.purl.getPortalObject() 
     564        return "/%s%s" % (portal.getId(), self.basepath) 
     565 
     566    def getSizeInfoByPath(self): 
     567        """API for chart builder""" 
     568        path = self.getValidPath() 
     569        return [{'size': getSize(b), 
     570                 'type': b.portal_type, 
     571                 'path': b.getPath()} \ 
     572                for b in self._brainsByPath(path)] 
     573 
    562574    def _walk(self, obj, path): 
    563575        result = {} 
     
    595607            return [] 
    596608 
    597         portal = self.purl.getPortalObject() 
    598         path = "/%s%s" % (portal.getId(), self.basepath) 
    599          
    600609        infos = [] 
     610        path = self.getValidPath() 
    601611        for size, brain in self._walk(self.context, path): 
    602612            if self.DEBUG or size > 1: 
Note: See TracChangeset for help on using the changeset viewer.