How to use the horizon.utils.memoized.memoized_method function in horizon

To help you get started, we’ve selected a few horizon 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 openstack / horizon / openstack_dashboard / contrib / trove / content / database_clusters / forms.py View on Github external
    @memoized.memoized_method
    def datastores(self, request):
        try:
            return trove_api.trove.datastore_list(request)
        except Exception:
            LOG.exception("Exception while obtaining datastores list")
            self._datastores = []
            redirect = reverse('horizon:project:database_clusters:index')
            exceptions.handle(request,
                              _('Unable to obtain datastores.'),
                              redirect=redirect)
github openstack / horizon / openstack_dashboard / dashboards / project / volumes / snapshots / views.py View on Github external
    @memoized.memoized_method
    def get_data(self):
        try:
            snapshot_id = self.kwargs['snapshot_id']
            snapshot = api.cinder.volume_snapshot_get(self.request,
                                                      snapshot_id)
        except Exception:
            redirect = self.get_redirect_url()
            exceptions.handle(self.request,
                              _('Unable to retrieve snapshot details.'),
                              redirect=redirect)
        return snapshot
github openstack / senlin-dashboard / senlin_dashboard / cluster / clusters / views.py View on Github external
    @memoized.memoized_method
    def get_form(self, **kwargs):
        form_class = kwargs.get('form_class', self.get_form_class())
        return super(ManagePoliciesView, self).get_form(form_class)
github openstack / horizon / openstack_dashboard / dashboards / project / volumes / volumes / views.py View on Github external
    @memoized.memoized_method
    def get_volume_data(self):
        try:
            volume_id = self.kwargs['volume_id']
            volume = cinder.volume_get(self.request, volume_id)
        except Exception:
            redirect = self.get_redirect_url()
            exceptions.handle(self.request,
                              _('Unable to retrieve volume details.'),
                              redirect=redirect)
        return volume
github openstack / manila-ui / manila_ui / dashboards / project / share_networks / views.py View on Github external
    @memoized.memoized_method
    def get_share_networks_data(self):
        try:
            share_networks = manila.share_network_list(
                self.request, detailed=True)
            if base.is_service_enabled(self.request, 'network'):
                neutron_net_names = dict((net.id, net.name) for net in
                                         neutron.network_list(self.request))
                neutron_subnet_names = dict((net.id, net.name) for net in
                                            neutron.subnet_list(self.request))
                for sn in share_networks:
                    sn.neutron_net = neutron_net_names.get(
                        sn.neutron_net_id) or sn.neutron_net_id or "-"
                    sn.neutron_subnet = neutron_subnet_names.get(
                        sn.neutron_subnet_id) or sn.neutron_subnet_id or "-"
        except Exception:
            share_networks = []
github openstack / horizon / openstack_dashboard / dashboards / project / routers / extensions / extraroutes / views.py View on Github external
    @memoized.memoized_method
    def get_object(self):
        try:
            router_id = self.kwargs["router_id"]
            return api.neutron.router_get(self.request, router_id)
        except Exception:
            redirect = reverse(self.url, args=[router_id])
            msg = _("Unable to retrieve router.")
            exceptions.handle(self.request, msg, redirect=redirect)
github openstack / horizon / openstack_dashboard / dashboards / project / loadbalancers / views.py View on Github external
    @memoized.memoized_method
    def get_data(self):
        pid = self.kwargs['pool_id']

        try:
            pool = api.lbaas.pool_get(self.request, pid)
        except Exception:
            pool = []
            exceptions.handle(self.request,
                              _('Unable to retrieve pool details.'))
        else:
            for monitor in pool.health_monitors:
                display_name = utils.get_monitor_display_name(monitor)
                setattr(monitor, 'display_name', display_name)

        return pool
github openstack / horizon / openstack_dashboard / dashboards / admin / volume_types / views.py View on Github external
    @memoized.memoized_method
    def get_name(self):
        if not hasattr(self, "name"):
            self.name = _get_volume_type_name(self.request, self.kwargs)
        return self.name
github openstack / designate-dashboard / designatedashboard / dashboards / project / dns_domains / tables.py View on Github external
    @memoized.memoized_method
    def allowed(self, request, datum):
        if policy.check((("dns", "get_quota"),), request):
            try:
                if self.table:
                    quota = api.designate.quota_get(request)
                    return quota['domains'] > len(self.table.data)
            except Exception:
                msg = _("The quotas could not be retrieved.")
                messages.warning(request, msg)
        return True
github openstack / horizon / openstack_dashboard / dashboards / project / databases / workflows / create_instance.py View on Github external
    @memoized.memoized_method
    def datastores(self, request):
        try:
            return api.trove.datastore_list(request)
        except Exception:
            LOG.exception("Exception while obtaining datastores list")
            self._datastores = []