except (ValueError, TypeError):
            pass

        if not size:
            return None

        if isinstance(size, (int, long)):
            if size < SIZE_CONST[smaller]:
                return '1 %s' % smaller
            for c in SIZE_ORDER:
                if size / SIZE_CONST[c] > 0:
                    break
            return '%.1f %s' % (float(size / float(SIZE_CONST[c])), c)
        return size

    _eioRegistry.unregister('getObjSize')
    registerIndexableAttribute('getObjSize', getObjSize)

## Monkeypatch the breadcrumbs to show the name of the page you're on, even if its the defult page

from Products.CMFPlone.browser.navigation import PhysicalNavigationBreadcrumbs

if not hasattr(PhysicalNavigationBreadcrumbs, 'RhaptosSite_patch'):
    logger.info(
        "Patching CMFPlone.browser.navigation to include default page in breadcrumbs"
    )

    PhysicalNavigationBreadcrumbs.RhaptosSite_patch = 1

    from Products.CMFPlone.browser.navigation import *  # get all the original's imports and definitions
        except (ValueError, TypeError):
            pass

        if not size:
            return None

        if isinstance(size, (int, long)):
            if size < SIZE_CONST[smaller]:
                return '1 %s' % smaller
            for c in SIZE_ORDER:
                if size/SIZE_CONST[c] > 0:
                    break
            return '%.1f %s' % (float(size/float(SIZE_CONST[c])), c)
        return size

    _eioRegistry.unregister('getObjSize')
    registerIndexableAttribute('getObjSize', getObjSize)


## Monkeypatch the breadcrumbs to show the name of the page you're on, even if its the defult page
    
from Products.CMFPlone.browser.navigation import PhysicalNavigationBreadcrumbs

if not hasattr(PhysicalNavigationBreadcrumbs, 'RhaptosSite_patch'):
    logger.info("Patching CMFPlone.browser.navigation to include default page in breadcrumbs")

    PhysicalNavigationBreadcrumbs.RhaptosSite_patch = 1

    from Products.CMFPlone.browser.navigation import *     # get all the original's imports and definitions

    def breadcrumbs(self):
示例#3
0
 def beforeTearDown(self):
     _eioRegistry.unregister('dummy')