本文整理汇总了Python中group.Group.get方法的典型用法代码示例。如果您正苦于以下问题:Python Group.get方法的具体用法?Python Group.get怎么用?Python Group.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类group.Group
的用法示例。
在下文中一共展示了Group.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import get [as 别名]
def __init__(self, states, condition=True, action=None, show=True,
confirm=False, group=None, icon=None, redirect=None):
# In its simpler form, "states" is a list of 2 states:
# (fromState, toState). But it can also be a list of several
# (fromState, toState) sub-lists. This way, you may define only 1
# transition at several places in the state-transition diagram. It may
# be useful for "undo" transitions, for example.
self.states = self.standardiseStates(states)
self.condition = condition
if isinstance(condition, basestring):
# The condition specifies the name of a role
self.condition = Role(condition)
self.action = action
self.show = show # If False, the end user will not be able to trigger
# the transition. It will only be possible by code.
self.confirm = confirm # If True, a confirm popup will show up.
self.group = Group.get(group)
# The user may specify a specific icon to show for this transition.
self.icon = icon or 'transition'
# If redirect is None, once the transition will be triggered, Appy will
# perform an automatic redirect:
# (a) if you were on some "view" page, Appy will redirect you to this
# page (thus refreshing it entirely);
# (b) if you were in a list of objects, Appy will Ajax-refresh the row
# containing the object from which you triggered the transition.
# Case (b) can be problematic if the transition modifies the list of
# objects, or if it modifies other elements shown outside this list.
# If you specify redirect='page', case (a) will always apply.
self.redirect = redirect
示例2: __init__
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import get [as 别名]
def __init__(self, name=None, group=None, sortBy='', sortOrder='asc',
maxPerPage=30, default=False, colspan=1, translated=None,
show=True, translatedDescr=None, checkboxes=False,
checkboxesDefault=True, **fields):
# "name" is mandatory, excepted in some special cases (ie, when used as
# "select" param for a Ref field).
self.name = name
# Searches may be visually grouped in the portlet.
self.group = Group.get(group)
self.sortBy = sortBy
self.sortOrder = sortOrder
self.maxPerPage = maxPerPage
# If this search is the default one, it will be triggered by clicking
# on main link.
self.default = default
self.colspan = colspan
# If a translated name or description is already given here, we will
# use it instead of trying to translate from labels.
self.translated = translated
self.translatedDescr = translatedDescr
# Condition for showing or not this search
self.show = show
# In the dict below, keys are indexed field names or names of standard
# indexes, and values are search values.
self.fields = fields
# Do we need to display checkboxes for every object of the query result?
self.checkboxes = checkboxes
# Default value for checkboxes
self.checkboxesDefault = checkboxesDefault
示例3: __init__
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import get [as 别名]
def __init__(self, states, condition=True, action=None, show=True,
confirm=False, group=None, icon=None):
# In its simpler form, "states" is a list of 2 states:
# (fromState, toState). But it can also be a list of several
# (fromState, toState) sub-lists. This way, you may define only 1
# transition at several places in the state-transition diagram. It may
# be useful for "undo" transitions, for example.
self.states = self.standardiseStates(states)
self.condition = condition
if isinstance(condition, basestring):
# The condition specifies the name of a role.
self.condition = Role(condition)
self.action = action
self.show = show # If False, the end user will not be able to trigger
# the transition. It will only be possible by code.
self.confirm = confirm # If True, a confirm popup will show up.
self.group = Group.get(group)
# The user may specify a specific icon to show for this transition.
self.icon = icon or 'transition'
示例4: __init__
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import get [as 别名]
def __init__(self, name, group=None, sortBy='', sortOrder='asc', limit=None,
default=False, colspan=1, translated=None, show=True,
translatedDescr=None, **fields):
self.name = name
# Searches may be visually grouped in the portlet.
self.group = Group.get(group)
self.sortBy = sortBy
self.sortOrder = sortOrder
self.limit = limit
# If this search is the default one, it will be triggered by clicking
# on main link.
self.default = default
self.colspan = colspan
# If a translated name or description is already given here, we will
# use it instead of trying to translate from labels.
self.translated = translated
self.translatedDescr = translatedDescr
# Condition for showing or not this search
self.show = show
# In the dict below, keys are indexed field names or names of standard
# indexes, and values are search values.
self.fields = fields
示例5: __init__
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import get [as 别名]
def __init__(self, name=None, group=None, sortBy='', sortOrder='asc',
maxPerPage=30, default=False, colspan=1, translated=None,
show=True, showActions=True, translatedDescr=None,
checkboxes=False, checkboxesDefault=True, klass=None,
**fields):
# "name" is mandatory, excepted in some special cases (ie, when used as
# "select" param for a Ref field).
self.name = name
# Searches may be visually grouped in the portlet
self.group = Group.get(group)
self.sortBy = sortBy
self.sortOrder = sortOrder
self.maxPerPage = maxPerPage
# If this search is the default one, it will be triggered by clicking
# on main link.
self.default = default
self.colspan = colspan
# If a translated name or description is already given here, we will
# use it instead of trying to translate from labels.
self.translated = translated
self.translatedDescr = translatedDescr
# Condition for showing or not this search
self.show = show
# Condition for showing or not actions on every result of this search.
# Can be: True, False or "inline". If True, actions will appear in a
# "div" tag, below the object title; if "inline", they will appear
# besides it, producing a more compact list of results.
self.showActions = showActions
# In the dict below, keys are indexed field names or names of standard
# indexes, and values are search values.
self.fields = fields
# Do we need to display checkboxes for every object of the query result?
self.checkboxes = checkboxes
# Default value for checkboxes
self.checkboxesDefault = checkboxesDefault
# Most of the time, we know what is the class whose instances must be
# searched. When it is not the case, the p_klass can be explicitly
# specified.
self.klass = klass
示例6: get_group
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import get [as 别名]
def get_group(self):
group = Group.get(self.group_id)
return group
示例7: __init__
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import get [as 别名]
def __init__(self, validator, multiplicity, default, show, page, group,
layouts, move, indexed, searchable, specificReadPermission,
specificWritePermission, width, height, maxChars, colspan,
master, masterValue, focus, historized, mapping, label,
sdefault, scolspan, swidth, sheight, persist):
# The validator restricts which values may be defined. It can be an
# interval (1,None), a list of string values ['choice1', 'choice2'],
# a regular expression, a custom function, a Selection instance, etc.
self.validator = validator
# Multiplicity is a 2-tuple indicating the minimum and maximum
# occurrences of values.
self.multiplicity = multiplicity
# Is the field required or not ? (derived from multiplicity)
self.required = self.multiplicity[0] > 0
# Default value
self.default = default
# Must the field be visible or not?
self.show = show
# When displaying/editing the whole object, on what page and phase must
# this field value appear?
self.page = Page.get(page)
self.pageName = self.page.name
# Within self.page, in what group of fields must this one appear?
self.group = Group.get(group)
# The following attribute allows to move a field back to a previous
# position (useful for moving fields above predefined ones).
self.move = move
# If indexed is True, a database index will be set on the field for
# fast access.
self.indexed = indexed
# If specified "searchable", the field will be added to some global
# index allowing to perform application-wide, keyword searches.
self.searchable = searchable
# Normally, permissions to read or write every attribute in a type are
# granted if the user has the global permission to read or
# edit instances of the whole type. If you want a given attribute
# to be protected by specific permissions, set one or the 2 next boolean
# values to "True". In this case, you will create a new "field-only"
# read and/or write permission. If you need to protect several fields
# with the same read/write permission, you can avoid defining one
# specific permission for every field by specifying a "named"
# permission (string) instead of assigning "True" to the following
# arg(s). A named permission will be global to your whole Zope site, so
# take care to the naming convention. Typically, a named permission is
# of the form: "<yourAppName>: Write|Read ---". If, for example, I want
# to define, for my application "MedicalFolder" a specific permission
# for a bunch of fields that can only be modified by a doctor, I can
# define a permission "MedicalFolder: Write medical information" and
# assign it to the "specificWritePermission" of every impacted field.
self.specificReadPermission = specificReadPermission
self.specificWritePermission = specificWritePermission
# Widget width and height
self.width = width
self.height = height
# While width and height refer to widget dimensions, maxChars hereafter
# represents the maximum number of chars that a given input field may
# accept (corresponds to HTML "maxlength" property). "None" means
# "unlimited".
self.maxChars = maxChars or ''
# If the widget is in a group with multiple columns, the following
# attribute specifies on how many columns to span the widget.
self.colspan = colspan or 1
# The list of slaves of this field, if it is a master
self.slaves = []
# The behaviour of this field may depend on another, "master" field
self.master = master
if master: self.master.slaves.append(self)
# The semantics of attribute "masterValue" below is as follows:
# - if "masterValue" is anything but a method, the field will be shown
# only when the master has this value, or one of it if multivalued;
# - if "masterValue" is a method, the value(s) of the slave field will
# be returned by this method, depending on the master value(s) that
# are given to it, as its unique parameter.
self.masterValue = gutils.initMasterValue(masterValue)
# If a field must retain attention in a particular way, set focus=True.
# It will be rendered in a special way.
self.focus = focus
# If we must keep track of changes performed on a field, "historized"
# must be set to True.
self.historized = historized
# Mapping is a dict of contexts that, if specified, are given when
# translating the label, descr or help related to this field.
self.mapping = self.formatMapping(mapping)
self.id = id(self)
self.type = self.__class__.__name__
self.pythonType = None # The True corresponding Python type
# Get the layouts. Consult layout.py for more info about layouts.
self.layouts = self.formatLayouts(layouts)
# Can we filter this field?
self.filterable = False
# Can this field have values that can be edited and validated?
self.validable = True
# The base label for translations is normally generated automatically.
# It is made of 2 parts: the prefix, based on class name, and the name,
# which is the field name by default. You can change this by specifying
# a value for param "label". If this value is a string, it will be
# understood as a new prefix. If it is a tuple, it will represent the
# prefix and another name. If you want to specify a new name only, and
# not a prefix, write (None, newName).
self.label = label
#.........这里部分代码省略.........