How to use the pyramid.decorator.reify function in pyramid

To help you get started, we’ve selected a few pyramid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bbangert / velruse / velruse / store / memcached_store.py View on Github external
    @reify
    def _conn(self):
        """The Memcached connection, cached for this call"""
        return memcache.Client(self.servers)
github devpi / devpi / server / devpi_server / view_auth.py View on Github external
    @reify
    def stage(self):
        return self.getstage(self.username, self.index)
github Kotti / Kotti / kotti / scaffolds / __init__.py View on Github external
    @reify
    def _settings(self):  # pragma: no cover
        s = Settings('org.pylonsproject.kotti.ScaffoldDefaults')
        s.add_setting("author", unicode, default='')
        s.add_setting("email", str, default='')
        s.add_setting("gh_user", str, '')
        s.load_settings()  # loads anything that might be saved

        return s
github VoteIT / voteit.core / voteit / core / models / read_names.py View on Github external
    @reify
    def path_query(self):
        return Eq('path', resource_path(self.context))
github Pylons / substanced / substanced / folder / views.py View on Github external
    @reify
    def system_catalog(self):
        return find_catalog(self.context, 'system')
github Kotti / Kotti / kotti / views / util.py View on Github external
    @reify
    def edit_links(self):
        if not hasattr(self.context, "type_info"):
            return []
        return [
            l
            for l in self.context.type_info.edit_links
            if l.visible(self.context, self.request)
        ]
github sdayu / pumbaa / pumbaa / request_factory.py View on Github external
    @reify
    def userid(self):
        return authenticated_userid(self)
github Pylons / pyramid_layout / bottlecap / layouts / popper / layout.py View on Github external
    @reify
    def devmode(self):
        """Let templates know if we are in devmode, for comments """

        sn = 'bottlecap.devmode'
        dm = self.request.registry.settings.get(sn, "false")
        return dm == "true"
github liqd / adhocracy3 / src / adhocracy_core / adhocracy_core / sheets / __init__.py View on Github external
    @reify
    def _fields(self) -> dict:
        fields = defaultdict(dict)
        for node in self.schema.children:
            field = node.name
            if not hasattr(node, 'reftype'):
                fields['data'][field] = node
            elif not node.backref:
                fields['reference'][field] = node
            else:
                fields['back_reference'][field] = node
            if getattr(node, 'readonly', False):
                fields['readonly'][field] = node
        return fields
github liqd / adhocracy3 / src / adhocracy / adhocracy / rest / views / contents.py View on Github external
    @reify
    def viewable_sheets(self):
        sheets = {}
        for ifacename, sheet in self.sheets.items():
            permission = sheet.view_permission
            if has_permission(permission, self.context, self.request):
                sheets[ifacename] = sheet
        return sheets