id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
221,100
openstack/horizon
openstack_dashboard/utils/identity.py
get_domain_id_for_operation
def get_domain_id_for_operation(request): """Get the ID of the domain in which the current operation should happen. If the user has a domain context set, use that, otherwise use the user's effective domain. """ domain_context = request.session.get('domain_context') if domain_context: r...
python
def get_domain_id_for_operation(request): """Get the ID of the domain in which the current operation should happen. If the user has a domain context set, use that, otherwise use the user's effective domain. """ domain_context = request.session.get('domain_context') if domain_context: r...
[ "def", "get_domain_id_for_operation", "(", "request", ")", ":", "domain_context", "=", "request", ".", "session", ".", "get", "(", "'domain_context'", ")", "if", "domain_context", ":", "return", "domain_context", "return", "api", ".", "keystone", ".", "get_effecti...
Get the ID of the domain in which the current operation should happen. If the user has a domain context set, use that, otherwise use the user's effective domain.
[ "Get", "the", "ID", "of", "the", "domain", "in", "which", "the", "current", "operation", "should", "happen", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/utils/identity.py#L18-L28
221,101
openstack/horizon
openstack_dashboard/management/commands/migrate_settings.py
get_module_path
def get_module_path(module_name): """Gets the module path without importing anything. Avoids conflicts with package dependencies. (taken from http://github.com/sitkatech/pypatch) """ path = sys.path for name in module_name.split('.'): file_pointer, path, desc = imp.find_module(name, pat...
python
def get_module_path(module_name): """Gets the module path without importing anything. Avoids conflicts with package dependencies. (taken from http://github.com/sitkatech/pypatch) """ path = sys.path for name in module_name.split('.'): file_pointer, path, desc = imp.find_module(name, pat...
[ "def", "get_module_path", "(", "module_name", ")", ":", "path", "=", "sys", ".", "path", "for", "name", "in", "module_name", ".", "split", "(", "'.'", ")", ":", "file_pointer", ",", "path", ",", "desc", "=", "imp", ".", "find_module", "(", "name", ",",...
Gets the module path without importing anything. Avoids conflicts with package dependencies. (taken from http://github.com/sitkatech/pypatch)
[ "Gets", "the", "module", "path", "without", "importing", "anything", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/management/commands/migrate_settings.py#L31-L44
221,102
openstack/horizon
openstack_dashboard/management/commands/migrate_settings.py
Command.gendiff
def gendiff(self, force=False): """Generate a diff between self.local_settings and the example file. """ with DirContext(self.local_settings_dir) as dircontext: if not os.path.exists(self.local_settings_diff) or force: with open(self.local_settings_example, 'r') as ...
python
def gendiff(self, force=False): """Generate a diff between self.local_settings and the example file. """ with DirContext(self.local_settings_dir) as dircontext: if not os.path.exists(self.local_settings_diff) or force: with open(self.local_settings_example, 'r') as ...
[ "def", "gendiff", "(", "self", ",", "force", "=", "False", ")", ":", "with", "DirContext", "(", "self", ".", "local_settings_dir", ")", "as", "dircontext", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "local_settings_diff", ")", ...
Generate a diff between self.local_settings and the example file.
[ "Generate", "a", "diff", "between", "self", ".", "local_settings", "and", "the", "example", "file", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/management/commands/migrate_settings.py#L120-L162
221,103
openstack/horizon
openstack_dashboard/management/commands/migrate_settings.py
Command.patch
def patch(self, force=False): """Patch local_settings.py.example with local_settings.diff. The patch application generates the local_settings.py file (the local_settings.py.example remains unchanged). http://github.com/sitkatech/pypatch fails if the local_settings.py.example fi...
python
def patch(self, force=False): """Patch local_settings.py.example with local_settings.diff. The patch application generates the local_settings.py file (the local_settings.py.example remains unchanged). http://github.com/sitkatech/pypatch fails if the local_settings.py.example fi...
[ "def", "patch", "(", "self", ",", "force", "=", "False", ")", ":", "with", "DirContext", "(", "self", ".", "local_settings_dir", ")", "as", "dircontext", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "local_settings_diff", ")", ":", "i...
Patch local_settings.py.example with local_settings.diff. The patch application generates the local_settings.py file (the local_settings.py.example remains unchanged). http://github.com/sitkatech/pypatch fails if the local_settings.py.example file is not 100% identical to the one used ...
[ "Patch", "local_settings", ".", "py", ".", "example", "with", "local_settings", ".", "diff", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/management/commands/migrate_settings.py#L164-L220
221,104
openstack/horizon
openstack_dashboard/policy.py
check
def check(actions, request, target=None): """Wrapper of the configurable policy method.""" policy_check = utils_settings.import_setting("POLICY_CHECK_FUNCTION") if policy_check: return policy_check(actions, request, target) return True
python
def check(actions, request, target=None): """Wrapper of the configurable policy method.""" policy_check = utils_settings.import_setting("POLICY_CHECK_FUNCTION") if policy_check: return policy_check(actions, request, target) return True
[ "def", "check", "(", "actions", ",", "request", ",", "target", "=", "None", ")", ":", "policy_check", "=", "utils_settings", ".", "import_setting", "(", "\"POLICY_CHECK_FUNCTION\"", ")", "if", "policy_check", ":", "return", "policy_check", "(", "actions", ",", ...
Wrapper of the configurable policy method.
[ "Wrapper", "of", "the", "configurable", "policy", "method", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/policy.py#L18-L26
221,105
openstack/horizon
openstack_dashboard/api/_nova.py
get_auth_params_from_request
def get_auth_params_from_request(request): """Extracts properties needed by novaclient call from the request object. These will be used to memoize the calls to novaclient. """ return ( request.user.username, request.user.token.id, request.user.tenant_id, request.user.tok...
python
def get_auth_params_from_request(request): """Extracts properties needed by novaclient call from the request object. These will be used to memoize the calls to novaclient. """ return ( request.user.username, request.user.token.id, request.user.tenant_id, request.user.tok...
[ "def", "get_auth_params_from_request", "(", "request", ")", ":", "return", "(", "request", ".", "user", ".", "username", ",", "request", ".", "user", ".", "token", ".", "id", ",", "request", ".", "user", ".", "tenant_id", ",", "request", ".", "user", "."...
Extracts properties needed by novaclient call from the request object. These will be used to memoize the calls to novaclient.
[ "Extracts", "properties", "needed", "by", "novaclient", "call", "from", "the", "request", "object", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/_nova.py#L99-L111
221,106
openstack/horizon
openstack_dashboard/dashboards/project/network_topology/utils.py
get_context
def get_context(request, context=None): """Returns common context data for network topology views.""" if context is None: context = {} network_config = getattr(settings, 'OPENSTACK_NEUTRON_NETWORK', {}) context['launch_instance_allowed'] = policy.check( (("compute", "os_compute_api:ser...
python
def get_context(request, context=None): """Returns common context data for network topology views.""" if context is None: context = {} network_config = getattr(settings, 'OPENSTACK_NEUTRON_NETWORK', {}) context['launch_instance_allowed'] = policy.check( (("compute", "os_compute_api:ser...
[ "def", "get_context", "(", "request", ",", "context", "=", "None", ")", ":", "if", "context", "is", "None", ":", "context", "=", "{", "}", "network_config", "=", "getattr", "(", "settings", ",", "'OPENSTACK_NEUTRON_NETWORK'", ",", "{", "}", ")", "context",...
Returns common context data for network topology views.
[ "Returns", "common", "context", "data", "for", "network", "topology", "views", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/project/network_topology/utils.py#L26-L50
221,107
openstack/horizon
openstack_dashboard/dashboards/identity/users/role_assignments/tables.py
RoleAssignmentsTable.get_object_id
def get_object_id(self, datum): """Identifier of the role assignment.""" # Role assignment doesn't have identifier so one will be created # from the identifier of scope, user and role. This will guaranty the # unicity. scope_id = "" if "project" in datum.scope: ...
python
def get_object_id(self, datum): """Identifier of the role assignment.""" # Role assignment doesn't have identifier so one will be created # from the identifier of scope, user and role. This will guaranty the # unicity. scope_id = "" if "project" in datum.scope: ...
[ "def", "get_object_id", "(", "self", ",", "datum", ")", ":", "# Role assignment doesn't have identifier so one will be created", "# from the identifier of scope, user and role. This will guaranty the", "# unicity.", "scope_id", "=", "\"\"", "if", "\"project\"", "in", "datum", "."...
Identifier of the role assignment.
[ "Identifier", "of", "the", "role", "assignment", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/identity/users/role_assignments/tables.py#L85-L103
221,108
openstack/horizon
openstack_dashboard/api/base.py
get_url_for_service
def get_url_for_service(service, region, endpoint_type): if 'type' not in service: return None identity_version = get_version_from_service(service) service_endpoints = service.get('endpoints', []) available_endpoints = [endpoint for endpoint in service_endpoints if re...
python
def get_url_for_service(service, region, endpoint_type): if 'type' not in service: return None identity_version = get_version_from_service(service) service_endpoints = service.get('endpoints', []) available_endpoints = [endpoint for endpoint in service_endpoints if re...
[ "def", "get_url_for_service", "(", "service", ",", "region", ",", "endpoint_type", ")", ":", "if", "'type'", "not", "in", "service", ":", "return", "None", "identity_version", "=", "get_version_from_service", "(", "service", ")", "service_endpoints", "=", "service...
if we are dealing with the identity service and there is no endpoint in the current region, it is okay to use the first endpoint for any identity service endpoints and we can assume that it is global
[ "if", "we", "are", "dealing", "with", "the", "identity", "service", "and", "there", "is", "no", "endpoint", "in", "the", "current", "region", "it", "is", "okay", "to", "use", "the", "first", "endpoint", "for", "any", "identity", "service", "endpoints", "an...
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/base.py#L295-L323
221,109
openstack/horizon
horizon/utils/units.py
is_larger
def is_larger(unit_1, unit_2): """Returns a boolean indicating whether unit_1 is larger than unit_2. E.g: >>> is_larger('KB', 'B') True >>> is_larger('min', 'day') False """ unit_1 = functions.value_for_key(INFORMATION_UNITS, unit_1) unit_2 = functions.value_for_key(INFORMATION_UNI...
python
def is_larger(unit_1, unit_2): """Returns a boolean indicating whether unit_1 is larger than unit_2. E.g: >>> is_larger('KB', 'B') True >>> is_larger('min', 'day') False """ unit_1 = functions.value_for_key(INFORMATION_UNITS, unit_1) unit_2 = functions.value_for_key(INFORMATION_UNI...
[ "def", "is_larger", "(", "unit_1", ",", "unit_2", ")", ":", "unit_1", "=", "functions", ".", "value_for_key", "(", "INFORMATION_UNITS", ",", "unit_1", ")", "unit_2", "=", "functions", ".", "value_for_key", "(", "INFORMATION_UNITS", ",", "unit_2", ")", "return"...
Returns a boolean indicating whether unit_1 is larger than unit_2. E.g: >>> is_larger('KB', 'B') True >>> is_larger('min', 'day') False
[ "Returns", "a", "boolean", "indicating", "whether", "unit_1", "is", "larger", "than", "unit_2", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/utils/units.py#L40-L53
221,110
openstack/horizon
horizon/utils/units.py
convert
def convert(value, source_unit, target_unit, fmt=False): """Converts value from source_unit to target_unit. Returns a tuple containing the converted value and target_unit. Having fmt set to True causes the value to be formatted to 1 decimal digit if it's a decimal or be formatted as integer if it's an ...
python
def convert(value, source_unit, target_unit, fmt=False): """Converts value from source_unit to target_unit. Returns a tuple containing the converted value and target_unit. Having fmt set to True causes the value to be formatted to 1 decimal digit if it's a decimal or be formatted as integer if it's an ...
[ "def", "convert", "(", "value", ",", "source_unit", ",", "target_unit", ",", "fmt", "=", "False", ")", ":", "orig_target_unit", "=", "target_unit", "source_unit", "=", "functions", ".", "value_for_key", "(", "INFORMATION_UNITS", ",", "source_unit", ")", "target_...
Converts value from source_unit to target_unit. Returns a tuple containing the converted value and target_unit. Having fmt set to True causes the value to be formatted to 1 decimal digit if it's a decimal or be formatted as integer if it's an integer. E.g: >>> convert(2, 'hr', 'min') (120.0, ...
[ "Converts", "value", "from", "source_unit", "to", "target_unit", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/utils/units.py#L56-L79
221,111
openstack/horizon
horizon/utils/units.py
normalize
def normalize(value, unit): """Converts the value so that it belongs to some expected range. Returns the new value and new unit. E.g: >>> normalize(1024, 'KB') (1, 'MB') >>> normalize(90, 'min') (1.5, 'hr') >>> normalize(1.0, 'object') (1, 'object') """ if value < 0: ...
python
def normalize(value, unit): """Converts the value so that it belongs to some expected range. Returns the new value and new unit. E.g: >>> normalize(1024, 'KB') (1, 'MB') >>> normalize(90, 'min') (1.5, 'hr') >>> normalize(1.0, 'object') (1, 'object') """ if value < 0: ...
[ "def", "normalize", "(", "value", ",", "unit", ")", ":", "if", "value", "<", "0", ":", "raise", "ValueError", "(", "'Negative value: %s %s.'", "%", "(", "value", ",", "unit", ")", ")", "if", "unit", "in", "functions", ".", "get_keys", "(", "INFORMATION_U...
Converts the value so that it belongs to some expected range. Returns the new value and new unit. E.g: >>> normalize(1024, 'KB') (1, 'MB') >>> normalize(90, 'min') (1.5, 'hr') >>> normalize(1.0, 'object') (1, 'object')
[ "Converts", "the", "value", "so", "that", "it", "belongs", "to", "some", "expected", "range", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/utils/units.py#L82-L105
221,112
openstack/horizon
openstack_dashboard/api/rest/utils.py
ajax
def ajax(authenticated=True, data_required=False, json_encoder=json.JSONEncoder): """Decorator to allow the wrappered view to exist in an AJAX environment. Provide a decorator to wrap a view method so that it may exist in an entirely AJAX environment: - data decoded from JSON as input and dat...
python
def ajax(authenticated=True, data_required=False, json_encoder=json.JSONEncoder): """Decorator to allow the wrappered view to exist in an AJAX environment. Provide a decorator to wrap a view method so that it may exist in an entirely AJAX environment: - data decoded from JSON as input and dat...
[ "def", "ajax", "(", "authenticated", "=", "True", ",", "data_required", "=", "False", ",", "json_encoder", "=", "json", ".", "JSONEncoder", ")", ":", "def", "decorator", "(", "function", ",", "authenticated", "=", "authenticated", ",", "data_required", "=", ...
Decorator to allow the wrappered view to exist in an AJAX environment. Provide a decorator to wrap a view method so that it may exist in an entirely AJAX environment: - data decoded from JSON as input and data coded as JSON as output - result status is coded in the HTTP status code; any non-2xx respon...
[ "Decorator", "to", "allow", "the", "wrappered", "view", "to", "exist", "in", "an", "AJAX", "environment", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/rest/utils.py#L76-L149
221,113
openstack/horizon
openstack_dashboard/api/rest/utils.py
parse_filters_kwargs
def parse_filters_kwargs(request, client_keywords=None): """Extract REST filter parameters from the request GET args. Client processes some keywords separately from filters and takes them as separate inputs. This will ignore those keys to avoid potential conflicts. """ filters = {} kwargs =...
python
def parse_filters_kwargs(request, client_keywords=None): """Extract REST filter parameters from the request GET args. Client processes some keywords separately from filters and takes them as separate inputs. This will ignore those keys to avoid potential conflicts. """ filters = {} kwargs =...
[ "def", "parse_filters_kwargs", "(", "request", ",", "client_keywords", "=", "None", ")", ":", "filters", "=", "{", "}", "kwargs", "=", "{", "}", "client_keywords", "=", "client_keywords", "or", "{", "}", "for", "param", "in", "request", ".", "GET", ":", ...
Extract REST filter parameters from the request GET args. Client processes some keywords separately from filters and takes them as separate inputs. This will ignore those keys to avoid potential conflicts.
[ "Extract", "REST", "filter", "parameters", "from", "the", "request", "GET", "args", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/rest/utils.py#L159-L175
221,114
openstack/horizon
openstack_dashboard/api/rest/utils.py
post2data
def post2data(func): """Decorator to restore original form values along with their types. The sole purpose of this decorator is to restore original form values along with their types stored on client-side under key $$originalJSON. This in turn prevents the loss of field types when they are passed with ...
python
def post2data(func): """Decorator to restore original form values along with their types. The sole purpose of this decorator is to restore original form values along with their types stored on client-side under key $$originalJSON. This in turn prevents the loss of field types when they are passed with ...
[ "def", "post2data", "(", "func", ")", ":", "def", "wrapper", "(", "self", ",", "request", ")", ":", "request", ".", "DATA", "=", "request", ".", "POST", "if", "'$$originalJSON'", "in", "request", ".", "POST", ":", "request", ".", "DATA", "=", "jsonutil...
Decorator to restore original form values along with their types. The sole purpose of this decorator is to restore original form values along with their types stored on client-side under key $$originalJSON. This in turn prevents the loss of field types when they are passed with header 'Content-Type: mu...
[ "Decorator", "to", "restore", "original", "form", "values", "along", "with", "their", "types", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/rest/utils.py#L178-L194
221,115
openstack/horizon
horizon/workflows/views.py
WorkflowView.get_workflow
def get_workflow(self): """Returns the instantiated workflow class.""" extra_context = self.get_initial() entry_point = self.request.GET.get("step", None) workflow = self.workflow_class(self.request, context_seed=extra_context, ...
python
def get_workflow(self): """Returns the instantiated workflow class.""" extra_context = self.get_initial() entry_point = self.request.GET.get("step", None) workflow = self.workflow_class(self.request, context_seed=extra_context, ...
[ "def", "get_workflow", "(", "self", ")", ":", "extra_context", "=", "self", ".", "get_initial", "(", ")", "entry_point", "=", "self", ".", "request", ".", "GET", ".", "get", "(", "\"step\"", ",", "None", ")", "workflow", "=", "self", ".", "workflow_class...
Returns the instantiated workflow class.
[ "Returns", "the", "instantiated", "workflow", "class", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/workflows/views.py#L76-L83
221,116
openstack/horizon
horizon/workflows/views.py
WorkflowView.get_context_data
def get_context_data(self, **kwargs): """Returns the template context, including the workflow class. This method should be overridden in subclasses to provide additional context data to the template. """ context = super(WorkflowView, self).get_context_data(**kwargs) work...
python
def get_context_data(self, **kwargs): """Returns the template context, including the workflow class. This method should be overridden in subclasses to provide additional context data to the template. """ context = super(WorkflowView, self).get_context_data(**kwargs) work...
[ "def", "get_context_data", "(", "self", ",", "*", "*", "kwargs", ")", ":", "context", "=", "super", "(", "WorkflowView", ",", "self", ")", ".", "get_context_data", "(", "*", "*", "kwargs", ")", "workflow", "=", "self", ".", "get_workflow", "(", ")", "w...
Returns the template context, including the workflow class. This method should be overridden in subclasses to provide additional context data to the template.
[ "Returns", "the", "template", "context", "including", "the", "workflow", "class", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/workflows/views.py#L85-L103
221,117
openstack/horizon
horizon/workflows/views.py
WorkflowView.get_layout
def get_layout(self): """Returns classes for the workflow element in template. The returned classes are determied based on the workflow characteristics. """ if self.request.is_ajax(): layout = ['modal', ] else: layout = ['static_page', ] ...
python
def get_layout(self): """Returns classes for the workflow element in template. The returned classes are determied based on the workflow characteristics. """ if self.request.is_ajax(): layout = ['modal', ] else: layout = ['static_page', ] ...
[ "def", "get_layout", "(", "self", ")", ":", "if", "self", ".", "request", ".", "is_ajax", "(", ")", ":", "layout", "=", "[", "'modal'", ",", "]", "else", ":", "layout", "=", "[", "'static_page'", ",", "]", "if", "self", ".", "workflow_class", ".", ...
Returns classes for the workflow element in template. The returned classes are determied based on the workflow characteristics.
[ "Returns", "classes", "for", "the", "workflow", "element", "in", "template", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/workflows/views.py#L105-L119
221,118
openstack/horizon
horizon/workflows/views.py
WorkflowView.get_template_names
def get_template_names(self): """Returns the template name to use for this request.""" if self.request.is_ajax(): template = self.ajax_template_name else: template = self.template_name return template
python
def get_template_names(self): """Returns the template name to use for this request.""" if self.request.is_ajax(): template = self.ajax_template_name else: template = self.template_name return template
[ "def", "get_template_names", "(", "self", ")", ":", "if", "self", ".", "request", ".", "is_ajax", "(", ")", ":", "template", "=", "self", ".", "ajax_template_name", "else", ":", "template", "=", "self", ".", "template_name", "return", "template" ]
Returns the template name to use for this request.
[ "Returns", "the", "template", "name", "to", "use", "for", "this", "request", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/workflows/views.py#L121-L127
221,119
openstack/horizon
horizon/workflows/views.py
WorkflowView.get
def get(self, request, *args, **kwargs): """Handler for HTTP GET requests.""" try: context = self.get_context_data(**kwargs) except exceptions.NotAvailable: exceptions.handle(request) self.set_workflow_step_errors(context) return self.render_to_response(co...
python
def get(self, request, *args, **kwargs): """Handler for HTTP GET requests.""" try: context = self.get_context_data(**kwargs) except exceptions.NotAvailable: exceptions.handle(request) self.set_workflow_step_errors(context) return self.render_to_response(co...
[ "def", "get", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "context", "=", "self", ".", "get_context_data", "(", "*", "*", "kwargs", ")", "except", "exceptions", ".", "NotAvailable", ":", "exceptions", ...
Handler for HTTP GET requests.
[ "Handler", "for", "HTTP", "GET", "requests", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/workflows/views.py#L144-L151
221,120
openstack/horizon
horizon/workflows/views.py
WorkflowView.validate_steps
def validate_steps(self, request, workflow, start, end): """Validates the workflow steps from ``start`` to ``end``, inclusive. Returns a dict describing the validation state of the workflow. """ errors = {} for step in workflow.steps[start:end + 1]: if not step.actio...
python
def validate_steps(self, request, workflow, start, end): """Validates the workflow steps from ``start`` to ``end``, inclusive. Returns a dict describing the validation state of the workflow. """ errors = {} for step in workflow.steps[start:end + 1]: if not step.actio...
[ "def", "validate_steps", "(", "self", ",", "request", ",", "workflow", ",", "start", ",", "end", ")", ":", "errors", "=", "{", "}", "for", "step", "in", "workflow", ".", "steps", "[", "start", ":", "end", "+", "1", "]", ":", "if", "not", "step", ...
Validates the workflow steps from ``start`` to ``end``, inclusive. Returns a dict describing the validation state of the workflow.
[ "Validates", "the", "workflow", "steps", "from", "start", "to", "end", "inclusive", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/workflows/views.py#L153-L168
221,121
openstack/horizon
horizon/workflows/views.py
WorkflowView.post
def post(self, request, *args, **kwargs): """Handler for HTTP POST requests.""" context = self.get_context_data(**kwargs) workflow = context[self.context_object_name] try: # Check for the VALIDATE_STEP* headers, if they are present # and valid integers, return val...
python
def post(self, request, *args, **kwargs): """Handler for HTTP POST requests.""" context = self.get_context_data(**kwargs) workflow = context[self.context_object_name] try: # Check for the VALIDATE_STEP* headers, if they are present # and valid integers, return val...
[ "def", "post", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "context", "=", "self", ".", "get_context_data", "(", "*", "*", "kwargs", ")", "workflow", "=", "context", "[", "self", ".", "context_object_name", "]", ...
Handler for HTTP POST requests.
[ "Handler", "for", "HTTP", "POST", "requests", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/workflows/views.py#L170-L219
221,122
openstack/horizon
horizon/templatetags/angular.py
update_angular_template_hash
def update_angular_template_hash(sender, **kwargs): """Listen for compress events. If the angular templates have been re-compressed, also clear them from the Django cache backend. This is important to allow deployers to change a template file, re-compress, and not accidentally serve the old Django...
python
def update_angular_template_hash(sender, **kwargs): """Listen for compress events. If the angular templates have been re-compressed, also clear them from the Django cache backend. This is important to allow deployers to change a template file, re-compress, and not accidentally serve the old Django...
[ "def", "update_angular_template_hash", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "context", "=", "kwargs", "[", "'context'", "]", "# context the compressor is working with", "compressed", "=", "context", "[", "'compressed'", "]", "# the compressed content", "c...
Listen for compress events. If the angular templates have been re-compressed, also clear them from the Django cache backend. This is important to allow deployers to change a template file, re-compress, and not accidentally serve the old Django cached version of that content to clients.
[ "Listen", "for", "compress", "events", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/templatetags/angular.py#L28-L55
221,123
openstack/horizon
horizon/templatetags/angular.py
angular_templates
def angular_templates(context): """Generate a dictionary of template contents for all static HTML templates. If the template has been overridden by a theme, load the override contents instead of the original HTML file. One use for this is to pre-populate the angular template cache. Args: c...
python
def angular_templates(context): """Generate a dictionary of template contents for all static HTML templates. If the template has been overridden by a theme, load the override contents instead of the original HTML file. One use for this is to pre-populate the angular template cache. Args: c...
[ "def", "angular_templates", "(", "context", ")", ":", "template_paths", "=", "context", "[", "'HORIZON_CONFIG'", "]", "[", "'external_templates'", "]", "all_theme_static_files", "=", "context", "[", "'HORIZON_CONFIG'", "]", "[", "'theme_static_files'", "]", "this_them...
Generate a dictionary of template contents for all static HTML templates. If the template has been overridden by a theme, load the override contents instead of the original HTML file. One use for this is to pre-populate the angular template cache. Args: context: the context of the current Djan...
[ "Generate", "a", "dictionary", "of", "template", "contents", "for", "all", "static", "HTML", "templates", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/templatetags/angular.py#L81-L135
221,124
openstack/horizon
openstack_dashboard/api/microversions.py
get_microversion_for_features
def get_microversion_for_features(service, features, wrapper_class, min_ver, max_ver): """Retrieves that highest known functional microversion for features""" feature_versions = get_requested_versions(service, features) if not feature_versions: return None for ...
python
def get_microversion_for_features(service, features, wrapper_class, min_ver, max_ver): """Retrieves that highest known functional microversion for features""" feature_versions = get_requested_versions(service, features) if not feature_versions: return None for ...
[ "def", "get_microversion_for_features", "(", "service", ",", "features", ",", "wrapper_class", ",", "min_ver", ",", "max_ver", ")", ":", "feature_versions", "=", "get_requested_versions", "(", "service", ",", "features", ")", "if", "not", "feature_versions", ":", ...
Retrieves that highest known functional microversion for features
[ "Retrieves", "that", "highest", "known", "functional", "microversion", "for", "features" ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/microversions.py#L85-L96
221,125
openstack/horizon
horizon/base.py
Registry._register
def _register(self, cls): """Registers the given class. If the specified class is already registered then it is ignored. """ if not inspect.isclass(cls): raise ValueError('Only classes may be registered.') elif not issubclass(cls, self._registerable_class): ...
python
def _register(self, cls): """Registers the given class. If the specified class is already registered then it is ignored. """ if not inspect.isclass(cls): raise ValueError('Only classes may be registered.') elif not issubclass(cls, self._registerable_class): ...
[ "def", "_register", "(", "self", ",", "cls", ")", ":", "if", "not", "inspect", ".", "isclass", "(", "cls", ")", ":", "raise", "ValueError", "(", "'Only classes may be registered.'", ")", "elif", "not", "issubclass", "(", "cls", ",", "self", ".", "_register...
Registers the given class. If the specified class is already registered then it is ignored.
[ "Registers", "the", "given", "class", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L185-L200
221,126
openstack/horizon
horizon/base.py
Registry._unregister
def _unregister(self, cls): """Unregisters the given class. If the specified class isn't registered, ``NotRegistered`` will be raised. """ if not issubclass(cls, self._registerable_class): raise ValueError('Only %s classes or subclasses may be ' ...
python
def _unregister(self, cls): """Unregisters the given class. If the specified class isn't registered, ``NotRegistered`` will be raised. """ if not issubclass(cls, self._registerable_class): raise ValueError('Only %s classes or subclasses may be ' ...
[ "def", "_unregister", "(", "self", ",", "cls", ")", ":", "if", "not", "issubclass", "(", "cls", ",", "self", ".", "_registerable_class", ")", ":", "raise", "ValueError", "(", "'Only %s classes or subclasses may be '", "'unregistered.'", "%", "self", ".", "_regis...
Unregisters the given class. If the specified class isn't registered, ``NotRegistered`` will be raised.
[ "Unregisters", "the", "given", "class", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L202-L217
221,127
openstack/horizon
horizon/base.py
Panel.get_absolute_url
def get_absolute_url(self): """Returns the default URL for this panel. The default URL is defined as the URL pattern with ``name="index"`` in the URLconf for this panel. """ try: return reverse('horizon:%s:%s:%s' % (self._registered_with.slug, ...
python
def get_absolute_url(self): """Returns the default URL for this panel. The default URL is defined as the URL pattern with ``name="index"`` in the URLconf for this panel. """ try: return reverse('horizon:%s:%s:%s' % (self._registered_with.slug, ...
[ "def", "get_absolute_url", "(", "self", ")", ":", "try", ":", "return", "reverse", "(", "'horizon:%s:%s:%s'", "%", "(", "self", ".", "_registered_with", ".", "slug", ",", "self", ".", "slug", ",", "self", ".", "index_url_name", ")", ")", "except", "Excepti...
Returns the default URL for this panel. The default URL is defined as the URL pattern with ``name="index"`` in the URLconf for this panel.
[ "Returns", "the", "default", "URL", "for", "this", "panel", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L312-L327
221,128
openstack/horizon
horizon/base.py
Dashboard.get_panels
def get_panels(self): """Returns the Panel instances registered with this dashboard in order. Panel grouping information is not included. """ all_panels = [] panel_groups = self.get_panel_groups() for panel_group in panel_groups.values(): all_panels.extend(pa...
python
def get_panels(self): """Returns the Panel instances registered with this dashboard in order. Panel grouping information is not included. """ all_panels = [] panel_groups = self.get_panel_groups() for panel_group in panel_groups.values(): all_panels.extend(pa...
[ "def", "get_panels", "(", "self", ")", ":", "all_panels", "=", "[", "]", "panel_groups", "=", "self", ".", "get_panel_groups", "(", ")", "for", "panel_group", "in", "panel_groups", ".", "values", "(", ")", ":", "all_panels", ".", "extend", "(", "panel_grou...
Returns the Panel instances registered with this dashboard in order. Panel grouping information is not included.
[ "Returns", "the", "Panel", "instances", "registered", "with", "this", "dashboard", "in", "order", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L492-L501
221,129
openstack/horizon
horizon/base.py
Dashboard.get_absolute_url
def get_absolute_url(self): """Returns the default URL for this dashboard. The default URL is defined as the URL pattern with ``name="index"`` in the URLconf for the :class:`~horizon.Panel` specified by :attr:`~horizon.Dashboard.default_panel`. """ try: retur...
python
def get_absolute_url(self): """Returns the default URL for this dashboard. The default URL is defined as the URL pattern with ``name="index"`` in the URLconf for the :class:`~horizon.Panel` specified by :attr:`~horizon.Dashboard.default_panel`. """ try: retur...
[ "def", "get_absolute_url", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_registered", "(", "self", ".", "default_panel", ")", ".", "get_absolute_url", "(", ")", "except", "Exception", ":", "# Logging here since this will often be called in a template", ...
Returns the default URL for this dashboard. The default URL is defined as the URL pattern with ``name="index"`` in the URLconf for the :class:`~horizon.Panel` specified by :attr:`~horizon.Dashboard.default_panel`.
[ "Returns", "the", "default", "URL", "for", "this", "dashboard", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L531-L544
221,130
openstack/horizon
horizon/base.py
Dashboard._autodiscover
def _autodiscover(self): """Discovers panels to register from the current dashboard module.""" if getattr(self, "_autodiscover_complete", False): return panels_to_discover = [] panel_groups = [] # If we have a flat iterable of panel names, wrap it again so # ...
python
def _autodiscover(self): """Discovers panels to register from the current dashboard module.""" if getattr(self, "_autodiscover_complete", False): return panels_to_discover = [] panel_groups = [] # If we have a flat iterable of panel names, wrap it again so # ...
[ "def", "_autodiscover", "(", "self", ")", ":", "if", "getattr", "(", "self", ",", "\"_autodiscover_complete\"", ",", "False", ")", ":", "return", "panels_to_discover", "=", "[", "]", "panel_groups", "=", "[", "]", "# If we have a flat iterable of panel names, wrap i...
Discovers panels to register from the current dashboard module.
[ "Discovers", "panels", "to", "register", "from", "the", "current", "dashboard", "module", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L578-L625
221,131
openstack/horizon
horizon/base.py
Dashboard.allowed
def allowed(self, context): """Checks for role based access for this dashboard. Checks for access to any panels in the dashboard and of the dashboard itself. This method should be overridden to return the result of any policy checks required for the user to access this dashboar...
python
def allowed(self, context): """Checks for role based access for this dashboard. Checks for access to any panels in the dashboard and of the dashboard itself. This method should be overridden to return the result of any policy checks required for the user to access this dashboar...
[ "def", "allowed", "(", "self", ",", "context", ")", ":", "# if the dashboard has policy rules, honor those above individual", "# panels", "if", "not", "self", ".", "_can_access", "(", "context", "[", "'request'", "]", ")", ":", "return", "False", "# check if access is...
Checks for role based access for this dashboard. Checks for access to any panels in the dashboard and of the dashboard itself. This method should be overridden to return the result of any policy checks required for the user to access this dashboard when more complex checks are ...
[ "Checks", "for", "role", "based", "access", "for", "this", "dashboard", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L651-L673
221,132
openstack/horizon
horizon/base.py
Site.get_user_home
def get_user_home(self, user): """Returns the default URL for a particular user. This method can be used to customize where a user is sent when they log in, etc. By default it returns the value of :meth:`get_absolute_url`. An alternative function can be supplied to customize th...
python
def get_user_home(self, user): """Returns the default URL for a particular user. This method can be used to customize where a user is sent when they log in, etc. By default it returns the value of :meth:`get_absolute_url`. An alternative function can be supplied to customize th...
[ "def", "get_user_home", "(", "self", ",", "user", ")", ":", "user_home", "=", "self", ".", "_conf", "[", "'user_home'", "]", "if", "user_home", ":", "if", "callable", "(", "user_home", ")", ":", "return", "user_home", "(", "user", ")", "elif", "isinstanc...
Returns the default URL for a particular user. This method can be used to customize where a user is sent when they log in, etc. By default it returns the value of :meth:`get_absolute_url`. An alternative function can be supplied to customize this behavior by specifying a either...
[ "Returns", "the", "default", "URL", "for", "a", "particular", "user", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L793-L829
221,133
openstack/horizon
horizon/base.py
Site._lazy_urls
def _lazy_urls(self): """Lazy loading for URL patterns. This method avoids problems associated with attempting to evaluate the URLconf before the settings module has been loaded. """ def url_patterns(): return self._urls()[0] return LazyURLPattern(url_patter...
python
def _lazy_urls(self): """Lazy loading for URL patterns. This method avoids problems associated with attempting to evaluate the URLconf before the settings module has been loaded. """ def url_patterns(): return self._urls()[0] return LazyURLPattern(url_patter...
[ "def", "_lazy_urls", "(", "self", ")", ":", "def", "url_patterns", "(", ")", ":", "return", "self", ".", "_urls", "(", ")", "[", "0", "]", "return", "LazyURLPattern", "(", "url_patterns", ")", ",", "self", ".", "namespace", ",", "self", ".", "slug" ]
Lazy loading for URL patterns. This method avoids problems associated with attempting to evaluate the URLconf before the settings module has been loaded.
[ "Lazy", "loading", "for", "URL", "patterns", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L842-L851
221,134
openstack/horizon
horizon/base.py
Site._urls
def _urls(self): """Constructs the URLconf for Horizon from registered Dashboards.""" urlpatterns = self._get_default_urlpatterns() self._autodiscover() # Discover each dashboard's panels. for dash in self._registry.values(): dash._autodiscover() # Load the ...
python
def _urls(self): """Constructs the URLconf for Horizon from registered Dashboards.""" urlpatterns = self._get_default_urlpatterns() self._autodiscover() # Discover each dashboard's panels. for dash in self._registry.values(): dash._autodiscover() # Load the ...
[ "def", "_urls", "(", "self", ")", ":", "urlpatterns", "=", "self", ".", "_get_default_urlpatterns", "(", ")", "self", ".", "_autodiscover", "(", ")", "# Discover each dashboard's panels.", "for", "dash", "in", "self", ".", "_registry", ".", "values", "(", ")",...
Constructs the URLconf for Horizon from registered Dashboards.
[ "Constructs", "the", "URLconf", "for", "Horizon", "from", "registered", "Dashboards", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L853-L886
221,135
openstack/horizon
horizon/base.py
Site._autodiscover
def _autodiscover(self): """Discovers modules to register from ``settings.INSTALLED_APPS``. This makes sure that the appropriate modules get imported to register themselves with Horizon. """ if not getattr(self, '_registerable_class', None): raise ImproperlyConfigure...
python
def _autodiscover(self): """Discovers modules to register from ``settings.INSTALLED_APPS``. This makes sure that the appropriate modules get imported to register themselves with Horizon. """ if not getattr(self, '_registerable_class', None): raise ImproperlyConfigure...
[ "def", "_autodiscover", "(", "self", ")", ":", "if", "not", "getattr", "(", "self", ",", "'_registerable_class'", ",", "None", ")", ":", "raise", "ImproperlyConfigured", "(", "'You must set a '", "'\"_registerable_class\" property '", "'in order to use autodiscovery.'", ...
Discovers modules to register from ``settings.INSTALLED_APPS``. This makes sure that the appropriate modules get imported to register themselves with Horizon.
[ "Discovers", "modules", "to", "register", "from", "settings", ".", "INSTALLED_APPS", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L888-L908
221,136
openstack/horizon
horizon/base.py
Site._load_panel_customization
def _load_panel_customization(self): """Applies the plugin-based panel configurations. This method parses the panel customization from the ``HORIZON_CONFIG`` and make changes to the dashboard accordingly. It supports adding, removing and setting default panels on the dashboard....
python
def _load_panel_customization(self): """Applies the plugin-based panel configurations. This method parses the panel customization from the ``HORIZON_CONFIG`` and make changes to the dashboard accordingly. It supports adding, removing and setting default panels on the dashboard....
[ "def", "_load_panel_customization", "(", "self", ")", ":", "panel_customization", "=", "self", ".", "_conf", ".", "get", "(", "\"panel_customization\"", ",", "[", "]", ")", "# Process all the panel groups first so that they exist before panels", "# are added to them and Dashb...
Applies the plugin-based panel configurations. This method parses the panel customization from the ``HORIZON_CONFIG`` and make changes to the dashboard accordingly. It supports adding, removing and setting default panels on the dashboard. It also support registering a panel group.
[ "Applies", "the", "plugin", "-", "based", "panel", "configurations", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L910-L935
221,137
openstack/horizon
horizon/base.py
Site._process_panel_configuration
def _process_panel_configuration(self, config): """Add, remove and set default panels on the dashboard.""" try: dashboard = config.get('PANEL_DASHBOARD') if not dashboard: LOG.warning("Skipping %s because it doesn't have " "PANEL_DASHBO...
python
def _process_panel_configuration(self, config): """Add, remove and set default panels on the dashboard.""" try: dashboard = config.get('PANEL_DASHBOARD') if not dashboard: LOG.warning("Skipping %s because it doesn't have " "PANEL_DASHBO...
[ "def", "_process_panel_configuration", "(", "self", ",", "config", ")", ":", "try", ":", "dashboard", "=", "config", ".", "get", "(", "'PANEL_DASHBOARD'", ")", "if", "not", "dashboard", ":", "LOG", ".", "warning", "(", "\"Skipping %s because it doesn't have \"", ...
Add, remove and set default panels on the dashboard.
[ "Add", "remove", "and", "set", "default", "panels", "on", "the", "dashboard", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L937-L988
221,138
openstack/horizon
horizon/base.py
Site._process_panel_group_configuration
def _process_panel_group_configuration(self, config): """Adds a panel group to the dashboard.""" panel_group_slug = config.get('PANEL_GROUP') try: dashboard = config.get('PANEL_GROUP_DASHBOARD') if not dashboard: LOG.warning("Skipping %s because it doesn't...
python
def _process_panel_group_configuration(self, config): """Adds a panel group to the dashboard.""" panel_group_slug = config.get('PANEL_GROUP') try: dashboard = config.get('PANEL_GROUP_DASHBOARD') if not dashboard: LOG.warning("Skipping %s because it doesn't...
[ "def", "_process_panel_group_configuration", "(", "self", ",", "config", ")", ":", "panel_group_slug", "=", "config", ".", "get", "(", "'PANEL_GROUP'", ")", "try", ":", "dashboard", "=", "config", ".", "get", "(", "'PANEL_GROUP_DASHBOARD'", ")", "if", "not", "...
Adds a panel group to the dashboard.
[ "Adds", "a", "panel", "group", "to", "the", "dashboard", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/base.py#L990-L1022
221,139
openstack/horizon
horizon/tables/base.py
Row.load_cells
def load_cells(self, datum=None): """Load the row's data and initialize all the cells in the row. It also set the appropriate row properties which require the row's data to be determined. The row's data is provided either at initialization or as an argument to this function. ...
python
def load_cells(self, datum=None): """Load the row's data and initialize all the cells in the row. It also set the appropriate row properties which require the row's data to be determined. The row's data is provided either at initialization or as an argument to this function. ...
[ "def", "load_cells", "(", "self", ",", "datum", "=", "None", ")", ":", "# Compile all the cells on instantiation.", "table", "=", "self", ".", "table", "if", "datum", ":", "self", ".", "datum", "=", "datum", "else", ":", "datum", "=", "self", ".", "datum",...
Load the row's data and initialize all the cells in the row. It also set the appropriate row properties which require the row's data to be determined. The row's data is provided either at initialization or as an argument to this function. This function is called automatically ...
[ "Load", "the", "row", "s", "data", "and", "initialize", "all", "the", "cells", "in", "the", "row", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tables/base.py#L595-L645
221,140
openstack/horizon
horizon/tables/base.py
Cell.get_data
def get_data(self, datum, column, row): """Fetches the data to be displayed in this cell.""" table = row.table if column.auto == "multi_select": data = "" if row.can_be_selected(datum): widget = ThemableCheckboxInput(check_test=lambda value: False) ...
python
def get_data(self, datum, column, row): """Fetches the data to be displayed in this cell.""" table = row.table if column.auto == "multi_select": data = "" if row.can_be_selected(datum): widget = ThemableCheckboxInput(check_test=lambda value: False) ...
[ "def", "get_data", "(", "self", ",", "datum", ",", "column", ",", "row", ")", ":", "table", "=", "row", ".", "table", "if", "column", ".", "auto", "==", "\"multi_select\"", ":", "data", "=", "\"\"", "if", "row", ".", "can_be_selected", "(", "datum", ...
Fetches the data to be displayed in this cell.
[ "Fetches", "the", "data", "to", "be", "displayed", "in", "this", "cell", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tables/base.py#L743-L789
221,141
openstack/horizon
horizon/tables/base.py
Cell.value
def value(self): """Returns a formatted version of the data for final output. This takes into consideration the :attr:`~horizon.tables.Column.link`` and :attr:`~horizon.tables.Column.empty_value` attributes. """ try: data = self.column.get_data(self.d...
python
def value(self): """Returns a formatted version of the data for final output. This takes into consideration the :attr:`~horizon.tables.Column.link`` and :attr:`~horizon.tables.Column.empty_value` attributes. """ try: data = self.column.get_data(self.d...
[ "def", "value", "(", "self", ")", ":", "try", ":", "data", "=", "self", ".", "column", ".", "get_data", "(", "self", ".", "datum", ")", "if", "data", "is", "None", ":", "if", "callable", "(", "self", ".", "column", ".", "empty_value", ")", ":", "...
Returns a formatted version of the data for final output. This takes into consideration the :attr:`~horizon.tables.Column.link`` and :attr:`~horizon.tables.Column.empty_value` attributes.
[ "Returns", "a", "formatted", "version", "of", "the", "data", "for", "final", "output", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tables/base.py#L802-L831
221,142
openstack/horizon
horizon/tables/base.py
Cell.status
def status(self): """Gets the status for the column based on the cell's data.""" # Deal with status column mechanics based in this cell's data if hasattr(self, '_status'): # pylint: disable=access-member-before-definition return self._status if self.column.status...
python
def status(self): """Gets the status for the column based on the cell's data.""" # Deal with status column mechanics based in this cell's data if hasattr(self, '_status'): # pylint: disable=access-member-before-definition return self._status if self.column.status...
[ "def", "status", "(", "self", ")", ":", "# Deal with status column mechanics based in this cell's data", "if", "hasattr", "(", "self", ",", "'_status'", ")", ":", "# pylint: disable=access-member-before-definition", "return", "self", ".", "_status", "if", "self", ".", "...
Gets the status for the column based on the cell's data.
[ "Gets", "the", "status", "for", "the", "column", "based", "on", "the", "cell", "s", "data", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tables/base.py#L843-L860
221,143
openstack/horizon
horizon/tables/base.py
Cell.get_default_classes
def get_default_classes(self): """Returns a flattened string of the cell's CSS classes.""" if not self.url: self.column.classes = [cls for cls in self.column.classes if cls != "anchor"] column_class_string = self.column.get_final_attrs().get('class'...
python
def get_default_classes(self): """Returns a flattened string of the cell's CSS classes.""" if not self.url: self.column.classes = [cls for cls in self.column.classes if cls != "anchor"] column_class_string = self.column.get_final_attrs().get('class'...
[ "def", "get_default_classes", "(", "self", ")", ":", "if", "not", "self", ".", "url", ":", "self", ".", "column", ".", "classes", "=", "[", "cls", "for", "cls", "in", "self", ".", "column", ".", "classes", "if", "cls", "!=", "\"anchor\"", "]", "colum...
Returns a flattened string of the cell's CSS classes.
[ "Returns", "a", "flattened", "string", "of", "the", "cell", "s", "CSS", "classes", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tables/base.py#L871-L884
221,144
openstack/horizon
horizon/tables/base.py
Cell.update_allowed
def update_allowed(self): """Determines whether update of given cell is allowed. Calls allowed action of defined UpdateAction of the Column. """ return self.update_action.allowed(self.column.table.request, self.datum, ...
python
def update_allowed(self): """Determines whether update of given cell is allowed. Calls allowed action of defined UpdateAction of the Column. """ return self.update_action.allowed(self.column.table.request, self.datum, ...
[ "def", "update_allowed", "(", "self", ")", ":", "return", "self", ".", "update_action", ".", "allowed", "(", "self", ".", "column", ".", "table", ".", "request", ",", "self", ".", "datum", ",", "self", ")" ]
Determines whether update of given cell is allowed. Calls allowed action of defined UpdateAction of the Column.
[ "Determines", "whether", "update", "of", "given", "cell", "is", "allowed", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tables/base.py#L899-L906
221,145
openstack/horizon
openstack_dashboard/dashboards/project/instances/console.py
get_console
def get_console(request, console_type, instance): """Get a tuple of console url and console type.""" if console_type == 'AUTO': check_consoles = CONSOLES else: try: check_consoles = {console_type: CONSOLES[console_type]} except KeyError: msg = _('Console type ...
python
def get_console(request, console_type, instance): """Get a tuple of console url and console type.""" if console_type == 'AUTO': check_consoles = CONSOLES else: try: check_consoles = {console_type: CONSOLES[console_type]} except KeyError: msg = _('Console type ...
[ "def", "get_console", "(", "request", ",", "console_type", ",", "instance", ")", ":", "if", "console_type", "==", "'AUTO'", ":", "check_consoles", "=", "CONSOLES", "else", ":", "try", ":", "check_consoles", "=", "{", "console_type", ":", "CONSOLES", "[", "co...
Get a tuple of console url and console type.
[ "Get", "a", "tuple", "of", "console", "url", "and", "console", "type", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/project/instances/console.py#L34-L72
221,146
openstack/horizon
openstack_dashboard/dashboards/admin/flavors/tables.py
FlavorFilterAction.filter
def filter(self, table, flavors, filter_string): """Really naive case-insensitive search.""" q = filter_string.lower() def comp(flavor): return q in flavor.name.lower() return filter(comp, flavors)
python
def filter(self, table, flavors, filter_string): """Really naive case-insensitive search.""" q = filter_string.lower() def comp(flavor): return q in flavor.name.lower() return filter(comp, flavors)
[ "def", "filter", "(", "self", ",", "table", ",", "flavors", ",", "filter_string", ")", ":", "q", "=", "filter_string", ".", "lower", "(", ")", "def", "comp", "(", "flavor", ")", ":", "return", "q", "in", "flavor", ".", "name", ".", "lower", "(", ")...
Really naive case-insensitive search.
[ "Really", "naive", "case", "-", "insensitive", "search", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/admin/flavors/tables.py#L104-L111
221,147
openstack/horizon
horizon/middleware/operation_log.py
OperationLogMiddleware._process_response
def _process_response(self, request, response): """Log user operation.""" log_format = self._get_log_format(request) if not log_format: return response params = self._get_parameters_from_request(request) # log a message displayed to user messages = django_mes...
python
def _process_response(self, request, response): """Log user operation.""" log_format = self._get_log_format(request) if not log_format: return response params = self._get_parameters_from_request(request) # log a message displayed to user messages = django_mes...
[ "def", "_process_response", "(", "self", ",", "request", ",", "response", ")", ":", "log_format", "=", "self", ".", "_get_log_format", "(", "request", ")", "if", "not", "log_format", ":", "return", "response", "params", "=", "self", ".", "_get_parameters_from_...
Log user operation.
[ "Log", "user", "operation", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/middleware/operation_log.py#L87-L107
221,148
openstack/horizon
horizon/middleware/operation_log.py
OperationLogMiddleware.process_exception
def process_exception(self, request, exception): """Log error info when exception occurred.""" log_format = self._get_log_format(request) if log_format is None: return params = self._get_parameters_from_request(request, True) params['message'] = exception par...
python
def process_exception(self, request, exception): """Log error info when exception occurred.""" log_format = self._get_log_format(request) if log_format is None: return params = self._get_parameters_from_request(request, True) params['message'] = exception par...
[ "def", "process_exception", "(", "self", ",", "request", ",", "exception", ")", ":", "log_format", "=", "self", ".", "_get_log_format", "(", "request", ")", "if", "log_format", "is", "None", ":", "return", "params", "=", "self", ".", "_get_parameters_from_requ...
Log error info when exception occurred.
[ "Log", "error", "info", "when", "exception", "occurred", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/middleware/operation_log.py#L109-L119
221,149
openstack/horizon
horizon/middleware/operation_log.py
OperationLogMiddleware._get_log_format
def _get_log_format(self, request): """Return operation log format.""" user = getattr(request, 'user', None) if not user: return if not request.user.is_authenticated: return method = request.method.upper() if not (method in self.target_methods): ...
python
def _get_log_format(self, request): """Return operation log format.""" user = getattr(request, 'user', None) if not user: return if not request.user.is_authenticated: return method = request.method.upper() if not (method in self.target_methods): ...
[ "def", "_get_log_format", "(", "self", ",", "request", ")", ":", "user", "=", "getattr", "(", "request", ",", "'user'", ",", "None", ")", "if", "not", "user", ":", "return", "if", "not", "request", ".", "user", ".", "is_authenticated", ":", "return", "...
Return operation log format.
[ "Return", "operation", "log", "format", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/middleware/operation_log.py#L121-L135
221,150
openstack/horizon
horizon/middleware/operation_log.py
OperationLogMiddleware._get_parameters_from_request
def _get_parameters_from_request(self, request, exception=False): """Get parameters to log in OPERATION_LOG.""" user = request.user referer_url = None try: referer_dic = urlparse.urlsplit( urlparse.unquote(request.META.get('HTTP_REFERER'))) referer...
python
def _get_parameters_from_request(self, request, exception=False): """Get parameters to log in OPERATION_LOG.""" user = request.user referer_url = None try: referer_dic = urlparse.urlsplit( urlparse.unquote(request.META.get('HTTP_REFERER'))) referer...
[ "def", "_get_parameters_from_request", "(", "self", ",", "request", ",", "exception", "=", "False", ")", ":", "user", "=", "request", ".", "user", "referer_url", "=", "None", "try", ":", "referer_dic", "=", "urlparse", ".", "urlsplit", "(", "urlparse", ".", ...
Get parameters to log in OPERATION_LOG.
[ "Get", "parameters", "to", "log", "in", "OPERATION_LOG", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/middleware/operation_log.py#L137-L167
221,151
openstack/horizon
horizon/middleware/operation_log.py
OperationLogMiddleware._get_request_param
def _get_request_param(self, request): """Change POST data to JSON string and mask data.""" params = {} try: params = request.POST.copy() if not params: params = json.loads(request.body) except Exception: pass for key in params:...
python
def _get_request_param(self, request): """Change POST data to JSON string and mask data.""" params = {} try: params = request.POST.copy() if not params: params = json.loads(request.body) except Exception: pass for key in params:...
[ "def", "_get_request_param", "(", "self", ",", "request", ")", ":", "params", "=", "{", "}", "try", ":", "params", "=", "request", ".", "POST", ".", "copy", "(", ")", "if", "not", "params", ":", "params", "=", "json", ".", "loads", "(", "request", ...
Change POST data to JSON string and mask data.
[ "Change", "POST", "data", "to", "JSON", "string", "and", "mask", "data", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/middleware/operation_log.py#L169-L193
221,152
openstack/horizon
openstack_dashboard/dashboards/identity/projects/workflows.py
UpdateProject._update_project
def _update_project(self, request, data): """Update project info""" domain_id = identity.get_domain_id_for_operation(request) try: project_id = data['project_id'] # add extra information if keystone.VERSIONS.active >= 3: EXTRA_INFO = getattr(s...
python
def _update_project(self, request, data): """Update project info""" domain_id = identity.get_domain_id_for_operation(request) try: project_id = data['project_id'] # add extra information if keystone.VERSIONS.active >= 3: EXTRA_INFO = getattr(s...
[ "def", "_update_project", "(", "self", ",", "request", ",", "data", ")", ":", "domain_id", "=", "identity", ".", "get_domain_id_for_operation", "(", "request", ")", "try", ":", "project_id", "=", "data", "[", "'project_id'", "]", "# add extra information", "if",...
Update project info
[ "Update", "project", "info" ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/identity/projects/workflows.py#L683-L711
221,153
openstack/horizon
horizon/tables/formset.py
FormsetDataTableMixin.get_required_columns
def get_required_columns(self): """Lists names of columns that have required fields.""" required_columns = [] if self.formset_class: empty_form = self.get_formset().empty_form for column in self.columns.values(): field = empty_form.fields.get(column.name) ...
python
def get_required_columns(self): """Lists names of columns that have required fields.""" required_columns = [] if self.formset_class: empty_form = self.get_formset().empty_form for column in self.columns.values(): field = empty_form.fields.get(column.name) ...
[ "def", "get_required_columns", "(", "self", ")", ":", "required_columns", "=", "[", "]", "if", "self", ".", "formset_class", ":", "empty_form", "=", "self", ".", "get_formset", "(", ")", ".", "empty_form", "for", "column", "in", "self", ".", "columns", "."...
Lists names of columns that have required fields.
[ "Lists", "names", "of", "columns", "that", "have", "required", "fields", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tables/formset.py#L87-L96
221,154
openstack/horizon
horizon/tables/formset.py
FormsetDataTableMixin._get_formset_data
def _get_formset_data(self): """Formats the self.filtered_data in a way suitable for a formset.""" data = [] for datum in self.filtered_data: form_data = {} for column in self.columns.values(): value = column.get_data(datum) form_data[colum...
python
def _get_formset_data(self): """Formats the self.filtered_data in a way suitable for a formset.""" data = [] for datum in self.filtered_data: form_data = {} for column in self.columns.values(): value = column.get_data(datum) form_data[colum...
[ "def", "_get_formset_data", "(", "self", ")", ":", "data", "=", "[", "]", "for", "datum", "in", "self", ".", "filtered_data", ":", "form_data", "=", "{", "}", "for", "column", "in", "self", ".", "columns", ".", "values", "(", ")", ":", "value", "=", ...
Formats the self.filtered_data in a way suitable for a formset.
[ "Formats", "the", "self", ".", "filtered_data", "in", "a", "way", "suitable", "for", "a", "formset", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tables/formset.py#L98-L108
221,155
openstack/horizon
horizon/tables/formset.py
FormsetDataTableMixin.get_rows
def get_rows(self): """Return the row data for this table broken out by columns. The row objects get an additional ``form`` parameter, with the formset form corresponding to that row. """ try: rows = [] if self.formset_class is None: forms...
python
def get_rows(self): """Return the row data for this table broken out by columns. The row objects get an additional ``form`` parameter, with the formset form corresponding to that row. """ try: rows = [] if self.formset_class is None: forms...
[ "def", "get_rows", "(", "self", ")", ":", "try", ":", "rows", "=", "[", "]", "if", "self", ".", "formset_class", "is", "None", ":", "formset", "=", "[", "]", "else", ":", "formset", "=", "self", ".", "get_formset", "(", ")", "formset", ".", "is_val...
Return the row data for this table broken out by columns. The row objects get an additional ``form`` parameter, with the formset form corresponding to that row.
[ "Return", "the", "row", "data", "for", "this", "table", "broken", "out", "by", "columns", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tables/formset.py#L126-L153
221,156
openstack/horizon
openstack_dashboard/api/keystone.py
keystoneclient
def keystoneclient(request, admin=False): """Returns a client connected to the Keystone backend. Several forms of authentication are supported: * Username + password -> Unscoped authentication * Username + password + tenant id -> Scoped authentication * Unscoped token -> Unscoped authe...
python
def keystoneclient(request, admin=False): """Returns a client connected to the Keystone backend. Several forms of authentication are supported: * Username + password -> Unscoped authentication * Username + password + tenant id -> Scoped authentication * Unscoped token -> Unscoped authe...
[ "def", "keystoneclient", "(", "request", ",", "admin", "=", "False", ")", ":", "client_version", "=", "VERSIONS", ".", "get_active_version", "(", ")", "user", "=", "request", ".", "user", "token_id", "=", "user", ".", "token", ".", "id", "if", "is_multi_do...
Returns a client connected to the Keystone backend. Several forms of authentication are supported: * Username + password -> Unscoped authentication * Username + password + tenant id -> Scoped authentication * Unscoped token -> Unscoped authentication * Unscoped token + tenant id ->...
[ "Returns", "a", "client", "connected", "to", "the", "Keystone", "backend", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L141-L206
221,157
openstack/horizon
openstack_dashboard/api/keystone.py
get_default_domain
def get_default_domain(request, get_name=True): """Gets the default domain object to use when creating Identity object. Returns the domain context if is set, otherwise return the domain of the logon user. :param get_name: Whether to get the domain name from Keystone if the context isn't set. ...
python
def get_default_domain(request, get_name=True): """Gets the default domain object to use when creating Identity object. Returns the domain context if is set, otherwise return the domain of the logon user. :param get_name: Whether to get the domain name from Keystone if the context isn't set. ...
[ "def", "get_default_domain", "(", "request", ",", "get_name", "=", "True", ")", ":", "domain_id", "=", "request", ".", "session", ".", "get", "(", "\"domain_context\"", ",", "None", ")", "domain_name", "=", "request", ".", "session", ".", "get", "(", "\"do...
Gets the default domain object to use when creating Identity object. Returns the domain context if is set, otherwise return the domain of the logon user. :param get_name: Whether to get the domain name from Keystone if the context isn't set. Setting this to False prevents an unnecessary call ...
[ "Gets", "the", "default", "domain", "object", "to", "use", "when", "creating", "Identity", "object", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L284-L324
221,158
openstack/horizon
openstack_dashboard/api/keystone.py
get_effective_domain_id
def get_effective_domain_id(request): """Gets the id of the default domain. If the requests default domain is the same as DEFAULT_DOMAIN, return None. """ default_domain = get_default_domain(request) domain_id = default_domain.get('id') domain_name = default_domain.get('name') return No...
python
def get_effective_domain_id(request): """Gets the id of the default domain. If the requests default domain is the same as DEFAULT_DOMAIN, return None. """ default_domain = get_default_domain(request) domain_id = default_domain.get('id') domain_name = default_domain.get('name') return No...
[ "def", "get_effective_domain_id", "(", "request", ")", ":", "default_domain", "=", "get_default_domain", "(", "request", ")", "domain_id", "=", "default_domain", ".", "get", "(", "'id'", ")", "domain_name", "=", "default_domain", ".", "get", "(", "'name'", ")", ...
Gets the id of the default domain. If the requests default domain is the same as DEFAULT_DOMAIN, return None.
[ "Gets", "the", "id", "of", "the", "default", "domain", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L327-L336
221,159
openstack/horizon
openstack_dashboard/api/keystone.py
get_project_groups_roles
def get_project_groups_roles(request, project): """Gets the groups roles in a given project. :param request: the request entity containing the login user information :param project: the project to filter the groups roles. It accepts both project object resource or project ID :retur...
python
def get_project_groups_roles(request, project): """Gets the groups roles in a given project. :param request: the request entity containing the login user information :param project: the project to filter the groups roles. It accepts both project object resource or project ID :retur...
[ "def", "get_project_groups_roles", "(", "request", ",", "project", ")", ":", "groups_roles", "=", "collections", ".", "defaultdict", "(", "list", ")", "project_role_assignments", "=", "role_assignments_list", "(", "request", ",", "project", "=", "project", ")", "f...
Gets the groups roles in a given project. :param request: the request entity containing the login user information :param project: the project to filter the groups roles. It accepts both project object resource or project ID :returns group_roles: a dictionary mapping the groups and the...
[ "Gets", "the", "groups", "roles", "in", "a", "given", "project", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L671-L696
221,160
openstack/horizon
openstack_dashboard/api/keystone.py
role_list
def role_list(request, filters=None): """Returns a global list of available roles.""" manager = keystoneclient(request, admin=True).roles roles = [] kwargs = {} if filters is not None: kwargs.update(filters) if 'id' in kwargs: try: roles = [manager.get(kwargs['id'])] ...
python
def role_list(request, filters=None): """Returns a global list of available roles.""" manager = keystoneclient(request, admin=True).roles roles = [] kwargs = {} if filters is not None: kwargs.update(filters) if 'id' in kwargs: try: roles = [manager.get(kwargs['id'])] ...
[ "def", "role_list", "(", "request", ",", "filters", "=", "None", ")", ":", "manager", "=", "keystoneclient", "(", "request", ",", "admin", "=", "True", ")", ".", "roles", "roles", "=", "[", "]", "kwargs", "=", "{", "}", "if", "filters", "is", "not", ...
Returns a global list of available roles.
[ "Returns", "a", "global", "list", "of", "available", "roles", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L742-L758
221,161
openstack/horizon
openstack_dashboard/api/keystone.py
roles_for_user
def roles_for_user(request, user, project=None, domain=None): """Returns a list of user roles scoped to a project or domain.""" manager = keystoneclient(request, admin=True).roles if VERSIONS.active < 3: return manager.roles_for_user(user, project) else: return manager.list(user=user, do...
python
def roles_for_user(request, user, project=None, domain=None): """Returns a list of user roles scoped to a project or domain.""" manager = keystoneclient(request, admin=True).roles if VERSIONS.active < 3: return manager.roles_for_user(user, project) else: return manager.list(user=user, do...
[ "def", "roles_for_user", "(", "request", ",", "user", ",", "project", "=", "None", ",", "domain", "=", "None", ")", ":", "manager", "=", "keystoneclient", "(", "request", ",", "admin", "=", "True", ")", ".", "roles", "if", "VERSIONS", ".", "active", "<...
Returns a list of user roles scoped to a project or domain.
[ "Returns", "a", "list", "of", "user", "roles", "scoped", "to", "a", "project", "or", "domain", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L762-L768
221,162
openstack/horizon
openstack_dashboard/api/keystone.py
add_domain_user_role
def add_domain_user_role(request, user, role, domain): """Adds a role for a user on a domain.""" manager = keystoneclient(request, admin=True).roles return manager.grant(role, user=user, domain=domain)
python
def add_domain_user_role(request, user, role, domain): """Adds a role for a user on a domain.""" manager = keystoneclient(request, admin=True).roles return manager.grant(role, user=user, domain=domain)
[ "def", "add_domain_user_role", "(", "request", ",", "user", ",", "role", ",", "domain", ")", ":", "manager", "=", "keystoneclient", "(", "request", ",", "admin", "=", "True", ")", ".", "roles", "return", "manager", ".", "grant", "(", "role", ",", "user",...
Adds a role for a user on a domain.
[ "Adds", "a", "role", "for", "a", "user", "on", "a", "domain", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L791-L794
221,163
openstack/horizon
openstack_dashboard/api/keystone.py
remove_domain_user_role
def remove_domain_user_role(request, user, role, domain=None): """Removes a given single role for a user from a domain.""" manager = keystoneclient(request, admin=True).roles return manager.revoke(role, user=user, domain=domain)
python
def remove_domain_user_role(request, user, role, domain=None): """Removes a given single role for a user from a domain.""" manager = keystoneclient(request, admin=True).roles return manager.revoke(role, user=user, domain=domain)
[ "def", "remove_domain_user_role", "(", "request", ",", "user", ",", "role", ",", "domain", "=", "None", ")", ":", "manager", "=", "keystoneclient", "(", "request", ",", "admin", "=", "True", ")", ".", "roles", "return", "manager", ".", "revoke", "(", "ro...
Removes a given single role for a user from a domain.
[ "Removes", "a", "given", "single", "role", "for", "a", "user", "from", "a", "domain", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L798-L801
221,164
openstack/horizon
openstack_dashboard/api/keystone.py
add_tenant_user_role
def add_tenant_user_role(request, project=None, user=None, role=None, group=None, domain=None): """Adds a role for a user on a tenant.""" manager = keystoneclient(request, admin=True).roles if VERSIONS.active < 3: manager.add_user_role(user, role, project) else: ...
python
def add_tenant_user_role(request, project=None, user=None, role=None, group=None, domain=None): """Adds a role for a user on a tenant.""" manager = keystoneclient(request, admin=True).roles if VERSIONS.active < 3: manager.add_user_role(user, role, project) else: ...
[ "def", "add_tenant_user_role", "(", "request", ",", "project", "=", "None", ",", "user", "=", "None", ",", "role", "=", "None", ",", "group", "=", "None", ",", "domain", "=", "None", ")", ":", "manager", "=", "keystoneclient", "(", "request", ",", "adm...
Adds a role for a user on a tenant.
[ "Adds", "a", "role", "for", "a", "user", "on", "a", "tenant", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L831-L839
221,165
openstack/horizon
openstack_dashboard/api/keystone.py
remove_tenant_user_role
def remove_tenant_user_role(request, project=None, user=None, role=None, group=None, domain=None): """Removes a given single role for a user from a tenant.""" manager = keystoneclient(request, admin=True).roles if VERSIONS.active < 3: return manager.remove_user_role(user,...
python
def remove_tenant_user_role(request, project=None, user=None, role=None, group=None, domain=None): """Removes a given single role for a user from a tenant.""" manager = keystoneclient(request, admin=True).roles if VERSIONS.active < 3: return manager.remove_user_role(user,...
[ "def", "remove_tenant_user_role", "(", "request", ",", "project", "=", "None", ",", "user", "=", "None", ",", "role", "=", "None", ",", "group", "=", "None", ",", "domain", "=", "None", ")", ":", "manager", "=", "keystoneclient", "(", "request", ",", "...
Removes a given single role for a user from a tenant.
[ "Removes", "a", "given", "single", "role", "for", "a", "user", "from", "a", "tenant", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L843-L851
221,166
openstack/horizon
openstack_dashboard/api/keystone.py
remove_tenant_user
def remove_tenant_user(request, project=None, user=None, domain=None): """Removes all roles from a user on a tenant, removing them from it.""" client = keystoneclient(request, admin=True) roles = client.roles.roles_for_user(user, project) for role in roles: remove_tenant_user_role(request, user=...
python
def remove_tenant_user(request, project=None, user=None, domain=None): """Removes all roles from a user on a tenant, removing them from it.""" client = keystoneclient(request, admin=True) roles = client.roles.roles_for_user(user, project) for role in roles: remove_tenant_user_role(request, user=...
[ "def", "remove_tenant_user", "(", "request", ",", "project", "=", "None", ",", "user", "=", "None", ",", "domain", "=", "None", ")", ":", "client", "=", "keystoneclient", "(", "request", ",", "admin", "=", "True", ")", "roles", "=", "client", ".", "rol...
Removes all roles from a user on a tenant, removing them from it.
[ "Removes", "all", "roles", "from", "a", "user", "on", "a", "tenant", "removing", "them", "from", "it", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L854-L860
221,167
openstack/horizon
openstack_dashboard/api/keystone.py
add_group_role
def add_group_role(request, role, group, domain=None, project=None): """Adds a role for a group on a domain or project.""" manager = keystoneclient(request, admin=True).roles return manager.grant(role=role, group=group, domain=domain, project=project)
python
def add_group_role(request, role, group, domain=None, project=None): """Adds a role for a group on a domain or project.""" manager = keystoneclient(request, admin=True).roles return manager.grant(role=role, group=group, domain=domain, project=project)
[ "def", "add_group_role", "(", "request", ",", "role", ",", "group", ",", "domain", "=", "None", ",", "project", "=", "None", ")", ":", "manager", "=", "keystoneclient", "(", "request", ",", "admin", "=", "True", ")", ".", "roles", "return", "manager", ...
Adds a role for a group on a domain or project.
[ "Adds", "a", "role", "for", "a", "group", "on", "a", "domain", "or", "project", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L870-L874
221,168
openstack/horizon
openstack_dashboard/api/keystone.py
remove_group_role
def remove_group_role(request, role, group, domain=None, project=None): """Removes a given single role for a group from a domain or project.""" manager = keystoneclient(request, admin=True).roles return manager.revoke(role=role, group=group, project=project, domain=domain)
python
def remove_group_role(request, role, group, domain=None, project=None): """Removes a given single role for a group from a domain or project.""" manager = keystoneclient(request, admin=True).roles return manager.revoke(role=role, group=group, project=project, domain=domain)
[ "def", "remove_group_role", "(", "request", ",", "role", ",", "group", ",", "domain", "=", "None", ",", "project", "=", "None", ")", ":", "manager", "=", "keystoneclient", "(", "request", ",", "admin", "=", "True", ")", ".", "roles", "return", "manager",...
Removes a given single role for a group from a domain or project.
[ "Removes", "a", "given", "single", "role", "for", "a", "group", "from", "a", "domain", "or", "project", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L878-L882
221,169
openstack/horizon
openstack_dashboard/api/keystone.py
remove_group_roles
def remove_group_roles(request, group, domain=None, project=None): """Removes all roles from a group on a domain or project.""" client = keystoneclient(request, admin=True) roles = client.roles.list(group=group, domain=domain, project=project) for role in roles: remove_group_role(request, role=r...
python
def remove_group_roles(request, group, domain=None, project=None): """Removes all roles from a group on a domain or project.""" client = keystoneclient(request, admin=True) roles = client.roles.list(group=group, domain=domain, project=project) for role in roles: remove_group_role(request, role=r...
[ "def", "remove_group_roles", "(", "request", ",", "group", ",", "domain", "=", "None", ",", "project", "=", "None", ")", ":", "client", "=", "keystoneclient", "(", "request", ",", "admin", "=", "True", ")", "roles", "=", "client", ".", "roles", ".", "l...
Removes all roles from a group on a domain or project.
[ "Removes", "all", "roles", "from", "a", "group", "on", "a", "domain", "or", "project", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L886-L892
221,170
openstack/horizon
openstack_dashboard/api/keystone.py
get_default_role
def get_default_role(request): """Gets the default role object from Keystone and saves it as a global. Since this is configured in settings and should not change from request to request. Supports lookup by name or id. """ global DEFAULT_ROLE default = getattr(settings, "OPENSTACK_KEYSTONE_DEFAU...
python
def get_default_role(request): """Gets the default role object from Keystone and saves it as a global. Since this is configured in settings and should not change from request to request. Supports lookup by name or id. """ global DEFAULT_ROLE default = getattr(settings, "OPENSTACK_KEYSTONE_DEFAU...
[ "def", "get_default_role", "(", "request", ")", ":", "global", "DEFAULT_ROLE", "default", "=", "getattr", "(", "settings", ",", "\"OPENSTACK_KEYSTONE_DEFAULT_ROLE\"", ",", "None", ")", "if", "default", "and", "DEFAULT_ROLE", "is", "None", ":", "try", ":", "roles...
Gets the default role object from Keystone and saves it as a global. Since this is configured in settings and should not change from request to request. Supports lookup by name or id.
[ "Gets", "the", "default", "role", "object", "from", "Keystone", "and", "saves", "it", "as", "a", "global", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L895-L913
221,171
openstack/horizon
horizon/browsers/breadcrumb.py
Breadcrumb.render
def render(self): """Renders the table using the template from the table options.""" breadcrumb_template = template.loader.get_template(self.template) extra_context = {"breadcrumb": self} return breadcrumb_template.render(extra_context, self.request)
python
def render(self): """Renders the table using the template from the table options.""" breadcrumb_template = template.loader.get_template(self.template) extra_context = {"breadcrumb": self} return breadcrumb_template.render(extra_context, self.request)
[ "def", "render", "(", "self", ")", ":", "breadcrumb_template", "=", "template", ".", "loader", ".", "get_template", "(", "self", ".", "template", ")", "extra_context", "=", "{", "\"breadcrumb\"", ":", "self", "}", "return", "breadcrumb_template", ".", "render"...
Renders the table using the template from the table options.
[ "Renders", "the", "table", "using", "the", "template", "from", "the", "table", "options", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/browsers/breadcrumb.py#L41-L45
221,172
openstack/horizon
horizon/tabs/base.py
TabGroup.load_tab_data
def load_tab_data(self): """Preload all data that for the tabs that will be displayed.""" for tab in self._tabs.values(): if tab.load and not tab.data_loaded: try: tab._data = tab.get_context_data(self.request) except Exception: ...
python
def load_tab_data(self): """Preload all data that for the tabs that will be displayed.""" for tab in self._tabs.values(): if tab.load and not tab.data_loaded: try: tab._data = tab.get_context_data(self.request) except Exception: ...
[ "def", "load_tab_data", "(", "self", ")", ":", "for", "tab", "in", "self", ".", "_tabs", ".", "values", "(", ")", ":", "if", "tab", ".", "load", "and", "not", "tab", ".", "data_loaded", ":", "try", ":", "tab", ".", "_data", "=", "tab", ".", "get_...
Preload all data that for the tabs that will be displayed.
[ "Preload", "all", "data", "that", "for", "the", "tabs", "that", "will", "be", "displayed", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tabs/base.py#L170-L178
221,173
openstack/horizon
horizon/tabs/base.py
TabGroup.get_default_classes
def get_default_classes(self): """Returns a list of the default classes for the tab group. Defaults to ``["nav", "nav-tabs", "ajax-tabs"]``. """ default_classes = super(TabGroup, self).get_default_classes() default_classes.extend(CSS_TAB_GROUP_CLASSES) return default_cla...
python
def get_default_classes(self): """Returns a list of the default classes for the tab group. Defaults to ``["nav", "nav-tabs", "ajax-tabs"]``. """ default_classes = super(TabGroup, self).get_default_classes() default_classes.extend(CSS_TAB_GROUP_CLASSES) return default_cla...
[ "def", "get_default_classes", "(", "self", ")", ":", "default_classes", "=", "super", "(", "TabGroup", ",", "self", ")", ".", "get_default_classes", "(", ")", "default_classes", ".", "extend", "(", "CSS_TAB_GROUP_CLASSES", ")", "return", "default_classes" ]
Returns a list of the default classes for the tab group. Defaults to ``["nav", "nav-tabs", "ajax-tabs"]``.
[ "Returns", "a", "list", "of", "the", "default", "classes", "for", "the", "tab", "group", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tabs/base.py#L188-L195
221,174
openstack/horizon
horizon/tabs/base.py
TabGroup.get_tab
def get_tab(self, tab_name, allow_disabled=False): """Returns a specific tab from this tab group. If the tab is not allowed or not enabled this method returns ``None``. If the tab is disabled but you wish to return it anyway, you can pass ``True`` to the allow_disabled argument. ...
python
def get_tab(self, tab_name, allow_disabled=False): """Returns a specific tab from this tab group. If the tab is not allowed or not enabled this method returns ``None``. If the tab is disabled but you wish to return it anyway, you can pass ``True`` to the allow_disabled argument. ...
[ "def", "get_tab", "(", "self", ",", "tab_name", ",", "allow_disabled", "=", "False", ")", ":", "tab", "=", "self", ".", "_tabs", ".", "get", "(", "tab_name", ",", "None", ")", "if", "tab", "and", "tab", ".", "_allowed", "and", "(", "tab", ".", "_en...
Returns a specific tab from this tab group. If the tab is not allowed or not enabled this method returns ``None``. If the tab is disabled but you wish to return it anyway, you can pass ``True`` to the allow_disabled argument.
[ "Returns", "a", "specific", "tab", "from", "this", "tab", "group", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tabs/base.py#L236-L247
221,175
openstack/horizon
horizon/tabs/base.py
TabGroup.get_selected_tab
def get_selected_tab(self): """Returns the tab specific by the GET request parameter. In the event that there is no GET request parameter, the value of the query parameter is invalid, or the tab is not allowed/enabled, the return value of this function is None. """ selec...
python
def get_selected_tab(self): """Returns the tab specific by the GET request parameter. In the event that there is no GET request parameter, the value of the query parameter is invalid, or the tab is not allowed/enabled, the return value of this function is None. """ selec...
[ "def", "get_selected_tab", "(", "self", ")", ":", "selected", "=", "self", ".", "request", ".", "GET", ".", "get", "(", "self", ".", "param_name", ",", "None", ")", "if", "selected", ":", "try", ":", "tab_group", ",", "tab_name", "=", "selected", ".", ...
Returns the tab specific by the GET request parameter. In the event that there is no GET request parameter, the value of the query parameter is invalid, or the tab is not allowed/enabled, the return value of this function is None.
[ "Returns", "the", "tab", "specific", "by", "the", "GET", "request", "parameter", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tabs/base.py#L252-L267
221,176
openstack/horizon
horizon/tabs/base.py
Tab.render
def render(self): """Renders the tab to HTML. :meth:`~horizon.tabs.Tab.get_context_data` method and the :meth:`~horizon.tabs.Tab.get_template_name` method are called. If :attr:`~horizon.tabs.Tab.preload` is ``False`` and ``force_load`` is not ``True``, or either :meth:`...
python
def render(self): """Renders the tab to HTML. :meth:`~horizon.tabs.Tab.get_context_data` method and the :meth:`~horizon.tabs.Tab.get_template_name` method are called. If :attr:`~horizon.tabs.Tab.preload` is ``False`` and ``force_load`` is not ``True``, or either :meth:`...
[ "def", "render", "(", "self", ")", ":", "if", "not", "self", ".", "load", ":", "return", "''", "try", ":", "context", "=", "self", ".", "data", "except", "exceptions", ".", "Http302", ":", "raise", "except", "Exception", ":", "exc_type", ",", "exc_valu...
Renders the tab to HTML. :meth:`~horizon.tabs.Tab.get_context_data` method and the :meth:`~horizon.tabs.Tab.get_template_name` method are called. If :attr:`~horizon.tabs.Tab.preload` is ``False`` and ``force_load`` is not ``True``, or either :meth:`~horizon.tabs.Tab.allowed` or...
[ "Renders", "the", "tab", "to", "HTML", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tabs/base.py#L356-L377
221,177
openstack/horizon
horizon/tabs/base.py
Tab.get_default_classes
def get_default_classes(self): """Returns a list of the default classes for the tab. Defaults to and empty list (``[]``), however additional classes may be added depending on the state of the tab as follows: If the tab is the active tab for the tab group, in which the class ``"...
python
def get_default_classes(self): """Returns a list of the default classes for the tab. Defaults to and empty list (``[]``), however additional classes may be added depending on the state of the tab as follows: If the tab is the active tab for the tab group, in which the class ``"...
[ "def", "get_default_classes", "(", "self", ")", ":", "default_classes", "=", "super", "(", "Tab", ",", "self", ")", ".", "get_default_classes", "(", ")", "if", "self", ".", "is_active", "(", ")", ":", "default_classes", ".", "extend", "(", "CSS_ACTIVE_TAB_CL...
Returns a list of the default classes for the tab. Defaults to and empty list (``[]``), however additional classes may be added depending on the state of the tab as follows: If the tab is the active tab for the tab group, in which the class ``"active"`` will be added. If the t...
[ "Returns", "a", "list", "of", "the", "default", "classes", "for", "the", "tab", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tabs/base.py#L389-L406
221,178
openstack/horizon
horizon/tabs/base.py
Tab.get_template_name
def get_template_name(self, request): """Returns the name of the template to be used for rendering this tab. By default it returns the value of the ``template_name`` attribute on the ``Tab`` class. """ if not hasattr(self, "template_name"): raise AttributeError("%s m...
python
def get_template_name(self, request): """Returns the name of the template to be used for rendering this tab. By default it returns the value of the ``template_name`` attribute on the ``Tab`` class. """ if not hasattr(self, "template_name"): raise AttributeError("%s m...
[ "def", "get_template_name", "(", "self", ",", "request", ")", ":", "if", "not", "hasattr", "(", "self", ",", "\"template_name\"", ")", ":", "raise", "AttributeError", "(", "\"%s must have a template_name attribute or \"", "\"override the get_template_name method.\"", "%",...
Returns the name of the template to be used for rendering this tab. By default it returns the value of the ``template_name`` attribute on the ``Tab`` class.
[ "Returns", "the", "name", "of", "the", "template", "to", "be", "used", "for", "rendering", "this", "tab", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tabs/base.py#L408-L418
221,179
openstack/horizon
horizon/templatetags/breadcrumb_nav.py
breadcrumb_nav
def breadcrumb_nav(context): """A logic heavy function for automagically creating a breadcrumb. It uses the dashboard, panel group(if it exists), then current panel. Can also use a "custom_breadcrumb" context item to add extra items. """ breadcrumb = [] dashboard = context.request.horizon['dash...
python
def breadcrumb_nav(context): """A logic heavy function for automagically creating a breadcrumb. It uses the dashboard, panel group(if it exists), then current panel. Can also use a "custom_breadcrumb" context item to add extra items. """ breadcrumb = [] dashboard = context.request.horizon['dash...
[ "def", "breadcrumb_nav", "(", "context", ")", ":", "breadcrumb", "=", "[", "]", "dashboard", "=", "context", ".", "request", ".", "horizon", "[", "'dashboard'", "]", "try", ":", "panel_groups", "=", "dashboard", ".", "get_panel_groups", "(", ")", "except", ...
A logic heavy function for automagically creating a breadcrumb. It uses the dashboard, panel group(if it exists), then current panel. Can also use a "custom_breadcrumb" context item to add extra items.
[ "A", "logic", "heavy", "function", "for", "automagically", "creating", "a", "breadcrumb", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/templatetags/breadcrumb_nav.py#L22-L61
221,180
openstack/horizon
horizon/utils/html.py
HTMLElement.get_final_attrs
def get_final_attrs(self, classes=True): """Returns a dict containing the final attributes to be rendered.""" final_attrs = copy.copy(self.get_default_attrs()) final_attrs.update(self.attrs) if classes: final_attrs['class'] = self.get_final_css() else: fin...
python
def get_final_attrs(self, classes=True): """Returns a dict containing the final attributes to be rendered.""" final_attrs = copy.copy(self.get_default_attrs()) final_attrs.update(self.attrs) if classes: final_attrs['class'] = self.get_final_css() else: fin...
[ "def", "get_final_attrs", "(", "self", ",", "classes", "=", "True", ")", ":", "final_attrs", "=", "copy", ".", "copy", "(", "self", ".", "get_default_attrs", "(", ")", ")", "final_attrs", ".", "update", "(", "self", ".", "attrs", ")", "if", "classes", ...
Returns a dict containing the final attributes to be rendered.
[ "Returns", "a", "dict", "containing", "the", "final", "attributes", "to", "be", "rendered", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/utils/html.py#L38-L47
221,181
openstack/horizon
horizon/utils/html.py
HTMLElement.get_final_css
def get_final_css(self): """Returns a final css class concatenated string.""" default = " ".join(self.get_default_classes()) defined = self.attrs.get('class', '') additional = " ".join(getattr(self, "classes", [])) non_empty = [test for test in (defined, default, additional) if t...
python
def get_final_css(self): """Returns a final css class concatenated string.""" default = " ".join(self.get_default_classes()) defined = self.attrs.get('class', '') additional = " ".join(getattr(self, "classes", [])) non_empty = [test for test in (defined, default, additional) if t...
[ "def", "get_final_css", "(", "self", ")", ":", "default", "=", "\" \"", ".", "join", "(", "self", ".", "get_default_classes", "(", ")", ")", "defined", "=", "self", ".", "attrs", ".", "get", "(", "'class'", ",", "''", ")", "additional", "=", "\" \"", ...
Returns a final css class concatenated string.
[ "Returns", "a", "final", "css", "class", "concatenated", "string", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/utils/html.py#L49-L56
221,182
openstack/horizon
openstack_dashboard/dashboards/project/instances/utils.py
flavor_list
def flavor_list(request): """Utility method to retrieve a list of flavors.""" try: return api.nova.flavor_list(request) except Exception: exceptions.handle(request, _('Unable to retrieve instance flavors.')) return []
python
def flavor_list(request): """Utility method to retrieve a list of flavors.""" try: return api.nova.flavor_list(request) except Exception: exceptions.handle(request, _('Unable to retrieve instance flavors.')) return []
[ "def", "flavor_list", "(", "request", ")", ":", "try", ":", "return", "api", ".", "nova", ".", "flavor_list", "(", "request", ")", "except", "Exception", ":", "exceptions", ".", "handle", "(", "request", ",", "_", "(", "'Unable to retrieve instance flavors.'",...
Utility method to retrieve a list of flavors.
[ "Utility", "method", "to", "retrieve", "a", "list", "of", "flavors", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/project/instances/utils.py#L27-L34
221,183
openstack/horizon
openstack_dashboard/dashboards/project/instances/utils.py
sort_flavor_list
def sort_flavor_list(request, flavors, with_menu_label=True): """Utility method to sort a list of flavors. By default, returns the available flavors, sorted by RAM usage (ascending). Override these behaviours with a ``CREATE_INSTANCE_FLAVOR_SORT`` dict in ``local_settings.py``. """ def get_key(...
python
def sort_flavor_list(request, flavors, with_menu_label=True): """Utility method to sort a list of flavors. By default, returns the available flavors, sorted by RAM usage (ascending). Override these behaviours with a ``CREATE_INSTANCE_FLAVOR_SORT`` dict in ``local_settings.py``. """ def get_key(...
[ "def", "sort_flavor_list", "(", "request", ",", "flavors", ",", "with_menu_label", "=", "True", ")", ":", "def", "get_key", "(", "flavor", ",", "sort_key", ")", ":", "try", ":", "return", "getattr", "(", "flavor", ",", "sort_key", ")", "except", "Attribute...
Utility method to sort a list of flavors. By default, returns the available flavors, sorted by RAM usage (ascending). Override these behaviours with a ``CREATE_INSTANCE_FLAVOR_SORT`` dict in ``local_settings.py``.
[ "Utility", "method", "to", "sort", "a", "list", "of", "flavors", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/project/instances/utils.py#L37-L70
221,184
openstack/horizon
openstack_dashboard/dashboards/project/instances/utils.py
server_group_list
def server_group_list(request): """Utility method to retrieve a list of server groups.""" try: return api.nova.server_group_list(request) except Exception: exceptions.handle(request, _('Unable to retrieve Nova server groups.')) return []
python
def server_group_list(request): """Utility method to retrieve a list of server groups.""" try: return api.nova.server_group_list(request) except Exception: exceptions.handle(request, _('Unable to retrieve Nova server groups.')) return []
[ "def", "server_group_list", "(", "request", ")", ":", "try", ":", "return", "api", ".", "nova", ".", "server_group_list", "(", "request", ")", "except", "Exception", ":", "exceptions", ".", "handle", "(", "request", ",", "_", "(", "'Unable to retrieve Nova ser...
Utility method to retrieve a list of server groups.
[ "Utility", "method", "to", "retrieve", "a", "list", "of", "server", "groups", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/project/instances/utils.py#L83-L90
221,185
openstack/horizon
openstack_dashboard/dashboards/project/instances/utils.py
network_field_data
def network_field_data(request, include_empty_option=False, with_cidr=False, for_launch=False): """Returns a list of tuples of all networks. Generates a list of networks available to the user (request). And returns a list of (id, name) tuples. :param request: django http request...
python
def network_field_data(request, include_empty_option=False, with_cidr=False, for_launch=False): """Returns a list of tuples of all networks. Generates a list of networks available to the user (request). And returns a list of (id, name) tuples. :param request: django http request...
[ "def", "network_field_data", "(", "request", ",", "include_empty_option", "=", "False", ",", "with_cidr", "=", "False", ",", "for_launch", "=", "False", ")", ":", "tenant_id", "=", "request", ".", "user", ".", "tenant_id", "networks", "=", "[", "]", "if", ...
Returns a list of tuples of all networks. Generates a list of networks available to the user (request). And returns a list of (id, name) tuples. :param request: django http request object :param include_empty_option: flag to include a empty tuple in the front of the list :param with_cidr:...
[ "Returns", "a", "list", "of", "tuples", "of", "all", "networks", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/project/instances/utils.py#L93-L140
221,186
openstack/horizon
openstack_dashboard/dashboards/project/instances/utils.py
keypair_field_data
def keypair_field_data(request, include_empty_option=False): """Returns a list of tuples of all keypairs. Generates a list of keypairs available to the user (request). And returns a list of (id, name) tuples. :param request: django http request object :param include_empty_option: flag to include a...
python
def keypair_field_data(request, include_empty_option=False): """Returns a list of tuples of all keypairs. Generates a list of keypairs available to the user (request). And returns a list of (id, name) tuples. :param request: django http request object :param include_empty_option: flag to include a...
[ "def", "keypair_field_data", "(", "request", ",", "include_empty_option", "=", "False", ")", ":", "keypair_list", "=", "[", "]", "try", ":", "keypairs", "=", "api", ".", "nova", ".", "keypair_list", "(", "request", ")", "keypair_list", "=", "[", "(", "kp",...
Returns a list of tuples of all keypairs. Generates a list of keypairs available to the user (request). And returns a list of (id, name) tuples. :param request: django http request object :param include_empty_option: flag to include a empty tuple in the front of the list :return: list of (...
[ "Returns", "a", "list", "of", "tuples", "of", "all", "keypairs", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/project/instances/utils.py#L143-L168
221,187
openstack/horizon
openstack_dashboard/dashboards/project/instances/utils.py
flavor_field_data
def flavor_field_data(request, include_empty_option=False): """Returns a list of tuples of all image flavors. Generates a list of image flavors available. And returns a list of (id, name) tuples. :param request: django http request object :param include_empty_option: flag to include a empty tuple ...
python
def flavor_field_data(request, include_empty_option=False): """Returns a list of tuples of all image flavors. Generates a list of image flavors available. And returns a list of (id, name) tuples. :param request: django http request object :param include_empty_option: flag to include a empty tuple ...
[ "def", "flavor_field_data", "(", "request", ",", "include_empty_option", "=", "False", ")", ":", "flavors", "=", "flavor_list", "(", "request", ")", "if", "flavors", ":", "flavors_list", "=", "sort_flavor_list", "(", "request", ",", "flavors", ")", "if", "incl...
Returns a list of tuples of all image flavors. Generates a list of image flavors available. And returns a list of (id, name) tuples. :param request: django http request object :param include_empty_option: flag to include a empty tuple in the front of the list :return: list of (id, name) tu...
[ "Returns", "a", "list", "of", "tuples", "of", "all", "image", "flavors", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/project/instances/utils.py#L171-L191
221,188
openstack/horizon
openstack_dashboard/dashboards/project/instances/utils.py
port_field_data
def port_field_data(request, with_network=False): """Returns a list of tuples of all ports available for the tenant. Generates a list of ports that have no device_owner based on the networks available to the tenant doing the request. :param request: django http request object :param with_network: ...
python
def port_field_data(request, with_network=False): """Returns a list of tuples of all ports available for the tenant. Generates a list of ports that have no device_owner based on the networks available to the tenant doing the request. :param request: django http request object :param with_network: ...
[ "def", "port_field_data", "(", "request", ",", "with_network", "=", "False", ")", ":", "def", "add_more_info_port_name", "(", "port", ",", "network", ")", ":", "# add more info to the port for the display", "port_name", "=", "\"{} ({})\"", ".", "format", "(", "port"...
Returns a list of tuples of all ports available for the tenant. Generates a list of ports that have no device_owner based on the networks available to the tenant doing the request. :param request: django http request object :param with_network: include network name in field name :return: list of (...
[ "Returns", "a", "list", "of", "tuples", "of", "all", "ports", "available", "for", "the", "tenant", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/project/instances/utils.py#L194-L227
221,189
openstack/horizon
openstack_dashboard/dashboards/project/instances/utils.py
server_group_field_data
def server_group_field_data(request): """Returns a list of tuples of all server groups. Generates a list of server groups available. And returns a list of (id, name) tuples. :param request: django http request object :return: list of (id, name) tuples """ server_groups = server_group_list(...
python
def server_group_field_data(request): """Returns a list of tuples of all server groups. Generates a list of server groups available. And returns a list of (id, name) tuples. :param request: django http request object :return: list of (id, name) tuples """ server_groups = server_group_list(...
[ "def", "server_group_field_data", "(", "request", ")", ":", "server_groups", "=", "server_group_list", "(", "request", ")", "if", "server_groups", ":", "server_groups_list", "=", "[", "(", "sg", ".", "id", ",", "sg", ".", "name", ")", "for", "sg", "in", "s...
Returns a list of tuples of all server groups. Generates a list of server groups available. And returns a list of (id, name) tuples. :param request: django http request object :return: list of (id, name) tuples
[ "Returns", "a", "list", "of", "tuples", "of", "all", "server", "groups", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/project/instances/utils.py#L230-L245
221,190
openstack/horizon
openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tables.py
ExtraRoutesTable.get_object_display
def get_object_display(self, datum): """Display ExtraRoutes when deleted.""" return (super(ExtraRoutesTable, self).get_object_display(datum) or datum.destination + " -> " + datum.nexthop)
python
def get_object_display(self, datum): """Display ExtraRoutes when deleted.""" return (super(ExtraRoutesTable, self).get_object_display(datum) or datum.destination + " -> " + datum.nexthop)
[ "def", "get_object_display", "(", "self", ",", "datum", ")", ":", "return", "(", "super", "(", "ExtraRoutesTable", ",", "self", ")", ".", "get_object_display", "(", "datum", ")", "or", "datum", ".", "destination", "+", "\" -> \"", "+", "datum", ".", "nexth...
Display ExtraRoutes when deleted.
[ "Display", "ExtraRoutes", "when", "deleted", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tables.py#L68-L71
221,191
openstack/horizon
openstack_dashboard/api/rest/json_encoder.py
NaNJSONEncoder.iterencode
def iterencode(self, o, _one_shot=False): """JSON encoder with NaN and float inf support. The sole purpose of defining a custom JSONEncoder class is to override floatstr() inner function, or more specifically the representation of NaN and +/-float('inf') values in a JSON. Although ...
python
def iterencode(self, o, _one_shot=False): """JSON encoder with NaN and float inf support. The sole purpose of defining a custom JSONEncoder class is to override floatstr() inner function, or more specifically the representation of NaN and +/-float('inf') values in a JSON. Although ...
[ "def", "iterencode", "(", "self", ",", "o", ",", "_one_shot", "=", "False", ")", ":", "if", "self", ".", "check_circular", ":", "markers", "=", "{", "}", "else", ":", "markers", "=", "None", "if", "self", ".", "ensure_ascii", ":", "_encoder", "=", "e...
JSON encoder with NaN and float inf support. The sole purpose of defining a custom JSONEncoder class is to override floatstr() inner function, or more specifically the representation of NaN and +/-float('inf') values in a JSON. Although Infinity values are not supported by JSON standard...
[ "JSON", "encoder", "with", "NaN", "and", "float", "inf", "support", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/rest/json_encoder.py#L27-L84
221,192
openstack/horizon
openstack_dashboard/templatetags/context_selection.py
get_project_name
def get_project_name(project_id, projects): """Retrieves project name for given project id Args: projects: List of projects project_id: project id Returns: Project name or None if there is no match """ for project in projects: if project_id == project.id: return...
python
def get_project_name(project_id, projects): """Retrieves project name for given project id Args: projects: List of projects project_id: project id Returns: Project name or None if there is no match """ for project in projects: if project_id == project.id: return...
[ "def", "get_project_name", "(", "project_id", ",", "projects", ")", ":", "for", "project", "in", "projects", ":", "if", "project_id", "==", "project", ".", "id", ":", "return", "project", ".", "name" ]
Retrieves project name for given project id Args: projects: List of projects project_id: project id Returns: Project name or None if there is no match
[ "Retrieves", "project", "name", "for", "given", "project", "id" ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/templatetags/context_selection.py#L120-L131
221,193
openstack/horizon
horizon/templatetags/parse_date.py
ParseDateNode.render
def render(self, datestring): """Parses a date-like string into a timezone aware Python datetime.""" formats = ["%Y-%m-%dT%H:%M:%S.%f", "%Y-%m-%d %H:%M:%S.%f", "%Y-%m-%dT%H:%M:%S", "%Y-%m-%d %H:%M:%S"] if datestring: for format in formats: try: ...
python
def render(self, datestring): """Parses a date-like string into a timezone aware Python datetime.""" formats = ["%Y-%m-%dT%H:%M:%S.%f", "%Y-%m-%d %H:%M:%S.%f", "%Y-%m-%dT%H:%M:%S", "%Y-%m-%d %H:%M:%S"] if datestring: for format in formats: try: ...
[ "def", "render", "(", "self", ",", "datestring", ")", ":", "formats", "=", "[", "\"%Y-%m-%dT%H:%M:%S.%f\"", ",", "\"%Y-%m-%d %H:%M:%S.%f\"", ",", "\"%Y-%m-%dT%H:%M:%S\"", ",", "\"%Y-%m-%d %H:%M:%S\"", "]", "if", "datestring", ":", "for", "format", "in", "formats", ...
Parses a date-like string into a timezone aware Python datetime.
[ "Parses", "a", "date", "-", "like", "string", "into", "a", "timezone", "aware", "Python", "datetime", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/templatetags/parse_date.py#L33-L46
221,194
openstack/horizon
horizon/utils/memoized.py
_try_weakref
def _try_weakref(arg, remove_callback): """Return a weak reference to arg if possible, or arg itself if not.""" try: arg = weakref.ref(arg, remove_callback) except TypeError: # Not all types can have a weakref. That includes strings # and floats and such, so just pass them through di...
python
def _try_weakref(arg, remove_callback): """Return a weak reference to arg if possible, or arg itself if not.""" try: arg = weakref.ref(arg, remove_callback) except TypeError: # Not all types can have a weakref. That includes strings # and floats and such, so just pass them through di...
[ "def", "_try_weakref", "(", "arg", ",", "remove_callback", ")", ":", "try", ":", "arg", "=", "weakref", ".", "ref", "(", "arg", ",", "remove_callback", ")", "except", "TypeError", ":", "# Not all types can have a weakref. That includes strings", "# and floats and such...
Return a weak reference to arg if possible, or arg itself if not.
[ "Return", "a", "weak", "reference", "to", "arg", "if", "possible", "or", "arg", "itself", "if", "not", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/utils/memoized.py#L28-L36
221,195
openstack/horizon
horizon/utils/memoized.py
_get_key
def _get_key(args, kwargs, remove_callback): """Calculate the cache key, using weak references where possible.""" # Use tuples, because lists are not hashable. weak_args = tuple(_try_weakref(arg, remove_callback) for arg in args) # Use a tuple of (key, values) pairs, because dict is not hashable. # ...
python
def _get_key(args, kwargs, remove_callback): """Calculate the cache key, using weak references where possible.""" # Use tuples, because lists are not hashable. weak_args = tuple(_try_weakref(arg, remove_callback) for arg in args) # Use a tuple of (key, values) pairs, because dict is not hashable. # ...
[ "def", "_get_key", "(", "args", ",", "kwargs", ",", "remove_callback", ")", ":", "# Use tuples, because lists are not hashable.", "weak_args", "=", "tuple", "(", "_try_weakref", "(", "arg", ",", "remove_callback", ")", "for", "arg", "in", "args", ")", "# Use a tup...
Calculate the cache key, using weak references where possible.
[ "Calculate", "the", "cache", "key", "using", "weak", "references", "where", "possible", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/utils/memoized.py#L39-L48
221,196
openstack/horizon
horizon/utils/memoized.py
memoized
def memoized(func=None, max_size=None): """Decorator that caches function calls. Caches the decorated function's return value the first time it is called with the given arguments. If called later with the same arguments, the cached value is returned instead of calling the decorated function again. ...
python
def memoized(func=None, max_size=None): """Decorator that caches function calls. Caches the decorated function's return value the first time it is called with the given arguments. If called later with the same arguments, the cached value is returned instead of calling the decorated function again. ...
[ "def", "memoized", "(", "func", "=", "None", ",", "max_size", "=", "None", ")", ":", "def", "decorate", "(", "func", ")", ":", "# The dictionary in which all the data will be cached. This is a", "# separate instance for every decorated function, and it's stored in a", "# clos...
Decorator that caches function calls. Caches the decorated function's return value the first time it is called with the given arguments. If called later with the same arguments, the cached value is returned instead of calling the decorated function again. It operates as a LRU cache and keeps up to th...
[ "Decorator", "that", "caches", "function", "calls", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/utils/memoized.py#L51-L132
221,197
openstack/horizon
openstack_dashboard/management/commands/make_web_conf.py
_getattr
def _getattr(obj, name, default): """Like getattr but return `default` if None or False. By default, getattr(obj, name, default) returns default only if attr does not exist, here, we return `default` even if attr evaluates to None or False. """ value = getattr(obj, name, default) if value: ...
python
def _getattr(obj, name, default): """Like getattr but return `default` if None or False. By default, getattr(obj, name, default) returns default only if attr does not exist, here, we return `default` even if attr evaluates to None or False. """ value = getattr(obj, name, default) if value: ...
[ "def", "_getattr", "(", "obj", ",", "name", ",", "default", ")", ":", "value", "=", "getattr", "(", "obj", ",", "name", ",", "default", ")", "if", "value", ":", "return", "value", "else", ":", "return", "default" ]
Like getattr but return `default` if None or False. By default, getattr(obj, name, default) returns default only if attr does not exist, here, we return `default` even if attr evaluates to None or False.
[ "Like", "getattr", "but", "return", "default", "if", "None", "or", "False", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/management/commands/make_web_conf.py#L56-L67
221,198
openstack/horizon
openstack_dashboard/api/neutron.py
list_resources_with_long_filters
def list_resources_with_long_filters(list_method, filter_attr, filter_values, **params): """List neutron resources with handling RequestURITooLong exception. If filter parameters are long, list resources API request leads to 414 error (URL is too long). For such case, t...
python
def list_resources_with_long_filters(list_method, filter_attr, filter_values, **params): """List neutron resources with handling RequestURITooLong exception. If filter parameters are long, list resources API request leads to 414 error (URL is too long). For such case, t...
[ "def", "list_resources_with_long_filters", "(", "list_method", ",", "filter_attr", ",", "filter_values", ",", "*", "*", "params", ")", ":", "try", ":", "params", "[", "filter_attr", "]", "=", "filter_values", "return", "list_method", "(", "*", "*", "params", "...
List neutron resources with handling RequestURITooLong exception. If filter parameters are long, list resources API request leads to 414 error (URL is too long). For such case, this method split list parameters specified by a list_field argument into chunks and call the specified list_method repeatedly...
[ "List", "neutron", "resources", "with", "handling", "RequestURITooLong", "exception", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/neutron.py#L821-L872
221,199
openstack/horizon
openstack_dashboard/api/neutron.py
network_list_for_tenant
def network_list_for_tenant(request, tenant_id, include_external=False, include_pre_auto_allocate=False, **params): """Return a network list available for the tenant. The list contains networks owned by the tenant and public networks. If requested_net...
python
def network_list_for_tenant(request, tenant_id, include_external=False, include_pre_auto_allocate=False, **params): """Return a network list available for the tenant. The list contains networks owned by the tenant and public networks. If requested_net...
[ "def", "network_list_for_tenant", "(", "request", ",", "tenant_id", ",", "include_external", "=", "False", ",", "include_pre_auto_allocate", "=", "False", ",", "*", "*", "params", ")", ":", "LOG", ".", "debug", "(", "\"network_list_for_tenant(): tenant_id=%(tenant_id)...
Return a network list available for the tenant. The list contains networks owned by the tenant and public networks. If requested_networks specified, it searches requested_networks only.
[ "Return", "a", "network", "list", "available", "for", "the", "tenant", "." ]
5601ea9477323e599d9b766fcac1f8be742935b2
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/neutron.py#L1052-L1098