本文整理汇总了Python中pyasm.search.SearchKey.extract_base_search_type方法的典型用法代码示例。如果您正苦于以下问题:Python SearchKey.extract_base_search_type方法的具体用法?Python SearchKey.extract_base_search_type怎么用?Python SearchKey.extract_base_search_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.search.SearchKey
的用法示例。
在下文中一共展示了SearchKey.extract_base_search_type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from pyasm.search import SearchKey [as 别名]
# 或者: from pyasm.search.SearchKey import extract_base_search_type [as 别名]
#.........这里部分代码省略.........
my.element_descriptions = []
for element_name in my.element_names:
my.element_titles.append( my.config.get_element_title(element_name) )
my.element_descriptions.append( my.config.get_element_description(element_name) )
#my.element_titles = my.config.get_element_titles()
#my.element_descriptions = my.config.get_element_descriptions()
# MongoDb
# Default columns
if not my.element_names:
impl = SearchType.get_database_impl_by_search_type(my.search_type)
if impl.get_database_type() == "MongoDb":
my.element_names = impl.get_default_columns()
my.element_titles = ['Code', 'Name', 'Description']
my.element_descriptions = ['Code', 'Name', 'Description']
my.input_prefix = my.kwargs.get('input_prefix')
if not my.input_prefix:
my.input_prefix = 'edit'
security = Environment.get_security()
default_access = "edit"
project_code = Project.get_project_code()
if my.parent_key:
from pyasm.biz import Schema
schema = Schema.get()
parent_stype = SearchKey.extract_base_search_type(my.parent_key)
relationship = schema.get_relationship_attrs(parent_stype, my.search_type, type="hierarchy")
for element_name in my.element_names:
# If parent_key is available, data associated with the parent table does not need
# to be specified by the user, and their widgets can be excluded from the edit widget
if element_name == relationship.get("from_col"):
ignore.append(element_name)
for i, element_name in enumerate(my.element_names):
if element_name in ignore:
my.skipped_element_names.append(element_name)
continue
# check security access
access_key2 = {
'search_type': my.search_type,
'project': project_code
}
access_key1 = {
'search_type': my.search_type,
'key': element_name,
'project': project_code
}
access_keys = [access_key1, access_key2]
is_editable = security.check_access('element', access_keys, "edit", default=default_access)
if not is_editable:
my.skipped_element_names.append(element_name)