当前位置: 首页>>代码示例>>Python>>正文


Python Page.get方法代码示例

本文整理汇总了Python中page.Page.get方法的典型用法代码示例。如果您正苦于以下问题:Python Page.get方法的具体用法?Python Page.get怎么用?Python Page.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在page.Page的用法示例。


在下文中一共展示了Page.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testAddData

# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import get [as 别名]
    def testAddData(self):
        page = Page(12)
        entry = page.add(b"123")
        self.assertEqual(entry.page, 12)
        self.assertEqual(entry.offset, 2)
        self.assertEqual(page.offsetEmpty, 7)

        entry = page.add(b"one two three")
        self.assertEqual(entry.page, 12)
        self.assertEqual(entry.offset, 7)
        self.assertEqual(page.offsetEmpty, 22)

        data = page.get(2)
        self.assertEqual(data, b"123")

        data = page.get(7)
        self.assertEqual(data, b"one two three")
开发者ID:Alexey-N-Chernyshov,项目名称:DMD_project,代码行数:19,代码来源:test_page.py

示例2: __init__

# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page 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
#.........这里部分代码省略.........
开发者ID:Alejoss,项目名称:django-sis,代码行数:103,代码来源:__init__.py


注:本文中的page.Page.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。