コード例 #1
0
class I2(_I1):
    "I2 doc"

    a1 = Attribute('a1')
    a2 = Attribute('a2', 'a2 doc')

    def f21(): "f21 doc"
    def f22(): pass
    def f23(): "f23 doc"
コード例 #2
0
ファイル: interfaces.py プロジェクト: chadwhitacre/public
class ITALExpressionErrorInfo(Interface):

    type = Attribute("type",
                     "The exception class.")

    value = Attribute("value",
                      "The exception instance.")

    lineno = Attribute("lineno",
                       "The line number the error occurred on in the source.")

    offset = Attribute("offset",
                       "The character offset at which the error occurred.")
コード例 #3
0
ファイル: interfaces.py プロジェクト: chadwhitacre/public
class IPageTemplateSubclassing(IPageTemplate):
    """Behavior that may be overridden or used by subclasses
    """

    
    def pt_getContext(**kw):
        """Compute a dictionary of top-level template names
        
        Responsible for returning the set of
        top-level names supported in path expressions
        
        """

    def pt_getEngine():
        """Returns the TALES expression evaluator.
        """

    def pt_getEngineContext(namespace):
        """Return an execution context from the expression engine."""

    def __call__(*args, **kw):
        """Render a page template

        This is sometimes overridden to provide additional argument
        binding.
        """
        
    def pt_source_file():
        """return some text describing where a bit of ZPT code came from.

        This could be a file path, a object path, etc.
        """

    def _cook():
        """Compile the source

        Results are saved in the variables: _v_errors, _v_warnings,
        _v_program, and _v_macros, and the flag _v_cooked is set.
        """
    def _cook_check():
        """Compiles the source if necessary

        Subclasses might override this to influence the decision about
        whether compilation is necessary.
        """
        
    content_type = Attribute("The content-type of the generated output")

    expand = Attribute(
        "Flag indicating whether the read method should expand macros")
コード例 #4
0
ファイル: interfaces.py プロジェクト: chadwhitacre/public
class IDict(IMinMaxLen, IIterable, IContainer):
    u"""Field containing a conventional dict.

    The key_type and value_type fields allow specification
    of restrictions for keys and values contained in the dict.
    """

    key_type = Attribute(
        "key_type",
        _(u"""Field keys must conform to the given type, expressed
           via a Field.
        """))

    value_type = Attribute(
        "value_type",
        _(u"""Field values must conform to the given type, expressed
           via a Field.
        """))
コード例 #5
0
ファイル: test_interface.py プロジェクト: chadwhitacre/public
class _I1(Interface):

    a1 = Attribute("This is an attribute")

    def f11():
        pass

    def f12():
        pass

    f12.optional = 1
コード例 #6
0
ファイル: interfaces.py プロジェクト: chadwhitacre/public
class ITokenizedTerm(ITerm):
    """Object representing a single value in a tokenized vocabulary.
    """

    # TODO: There should be a more specialized field type for this.
    token = Attribute(
        "token", """Token which can be used to represent the value on a stream.

        The value of this attribute must be a non-empty 7-bit string.
        Control characters are not allowed.
        """)
コード例 #7
0
ファイル: interfaces.py プロジェクト: chadwhitacre/public
class IChoice(IField):
    u"""Field whose value is contained in a predefined set

    Only one, values or vocabulary, may be specified for a given choice.
    """
    vocabulary = Attribute(
        "vocabulary",
        ("IBaseVocabulary to be used, or vocabulary name, or None.\n"
         "\n"
         "If a string, the vocabulary name should be used by an\n"
         "IVocabularyRegistry to locate an appropriate\n"
         "IBaseVocabulary object."))
コード例 #8
0
ファイル: interfaces.py プロジェクト: chadwhitacre/public
class IContextDependent(Interface):
    """Components implementing this interface must have a context component.

    Usually the context must be one of the arguments of the
    constructor. Adapters and views are a primary example of context-dependent
    components.
    """

    context = Attribute("""The context of the object

        This is the object being adapted, viewed, extended, etc.
        """)
コード例 #9
0
ファイル: interfaces.py プロジェクト: chadwhitacre/public
class IPresentation(Interface):
    """Presentation components provide interfaces to external actors

    The are created for requests, which encapsulate external actors,
    connections, etc.
    """

    request = Attribute("""The request

        The request is a surrogate for the user. It also provides the
        presentation type and skin. It is of type
        IPresentationRequest.
        """)
コード例 #10
0
ファイル: __init__.py プロジェクト: chadwhitacre/public
class IDateTimeFormat(IFormat):
    """DateTime formatting and parsing interface. Here is a list of
    possible characters and their meaning:

      Symbol Meaning               Presentation      Example

      G      era designator        (Text)            AD
      y      year                  (Number)          1996
      M      month in year         (Text and Number) July and 07
      d      day in month          (Number)          10
      h      hour in am/pm (1-12)  (Number)          12
      H      hour in day (0-23)    (Number)          0
      m      minute in hour        (Number)          30
      s      second in minute      (Number)          55
      S      millisecond           (Number)          978
      E      day in week           (Text and Number) Tuesday
      D      day in year           (Number)          189
      F      day of week in month  (Number)          2 (2nd Wed in July)
      w      week in year          (Number)          27
      W      week in month         (Number)          2
      a      am/pm marker          (Text)            pm
      k      hour in day (1-24)    (Number)          24
      K      hour in am/pm (0-11)  (Number)          0
      z      time zone             (Text)            Pacific Standard Time
      '      escape for text
      ''     single quote                            '

    Meaning of the amount of characters:

      Text

        Four or more, use full form, <4, use short or abbreviated form if it
        exists. (for example, "EEEE" produces "Monday", "EEE" produces "Mon")

      Number

        The minimum number of digits. Shorter numbers are zero-padded to this
        amount (for example, if "m" produces "6", "mm" produces "06"). Year is
        handled specially; that is, if the count of 'y' is 2, the Year will be
        truncated to 2 digits. (for example, if "yyyy" produces "1997", "yy"
        produces "97".)

      Text and Number

        Three or over, use text, otherwise use number. (for example, "M"
        produces "1", "MM" produces "01", "MMM" produces "Jan", and "MMMM"
        produces "January".)  """

    calendar = Attribute("""This object must implement ILocaleCalendar. See
                            this interface's documentation for details.""")
コード例 #11
0
class ITestSchema(Interface):
    """A test schema"""
    
    foo = TextLine(
        title=_(u"Foo"),
        description=_(u"Foo description"),
        default=u"",
        required=True)
        
    bar = TextLine(
        title=_(u"Bar"),
        description=_(u"Bar description"),
        default=u"",
        required=False)
        
    attribute = Attribute("Test attribute, an attribute can't be validated.")
コード例 #12
0
ファイル: locales.py プロジェクト: chadwhitacre/public
class ILocaleInheritance(Interface):
    """Locale inheritance support.

    Locale-related objects implementing this interface are able to ask for its
    inherited self. For example, 'en_US.dates.monthNames' can call on itself
    'getInheritedSelf()' and get the value for 'en.dates.monthNames'. 
    """

    __parent__ = Attribute("The parent in the location hierarchy")

    __name__ = TextLine(
        title=u"The name within the parent",
        description=u"""The parent can be traversed with this name to get
                      the object.""")

    def getInheritedSelf():
        """Return itself but in the next higher up Locale."""
コード例 #13
0
ファイル: interfaces.py プロジェクト: chadwhitacre/public
class IPageTemplate(Interface):
    """Objects that can render page templates
    """

    def __call__(*args, **kw):
        """Render a page template

        The argument handling is specific to particular
        implementations.  Normally, however, positional arguments are
        bound to the top-level `args` variable and keyword arguments
        are bound to the top-level `options` variable.
        """

    def pt_edit(source, content_type):
        """Set the source and content type
        """

    def pt_errors(namespace):
        """Return a sequence of strings that describe errors in the template.

        The errors may occur when the template is compiled or
        rendered.

        `namespace` is the set of names passed to the TALES expression
        evaluator, similar to what's returned by pt_getContext().

        This can be used to let a template author know what went wrong
        when an attempt was made to render the template.
        """

    def pt_warnings():
        """Return a sequence of warnings from the parser.

        This can be useful to present to the template author to
        indication forward compatibility problems with the template.
        """

    def read():
        """Get the template source
        """

    macros = Attribute("An object that implements the __getitem__ "
                       "protocol, containing page template macros.")
コード例 #14
0
class IApp(Interface):
    a = Attribute('test attribute')
    def f(): "test func"
コード例 #15
0
ファイル: interfaces.py プロジェクト: chadwhitacre/public
class ISet(IUnorderedCollection):
    u"""Field containing a value that implements the API of a conventional 
    Python standard library sets.Set."""

    unique = Attribute(u"This ICollection interface attribute must be True")
コード例 #16
0
ファイル: interfaces.py プロジェクト: chadwhitacre/public
class IObject(IField):
    u"""Field containing an Object value."""

    schema = Attribute(
        "schema",
        _(u"The Interface that defines the Fields comprising the Object."))
コード例 #17
0
ファイル: test_interface.py プロジェクト: chadwhitacre/public
        class I(Interface):
            "xxx"

            __doc__ = Attribute('the doc')
コード例 #18
0
ファイル: interfaces.py プロジェクト: chadwhitacre/public
class ITerm(Interface):
    """Object representing a single value in a vocabulary."""

    value = Attribute(
        "value", "The value used to represent vocabulary term in a field.")
コード例 #19
0
ファイル: test_verify.py プロジェクト: chadwhitacre/public
 class IFoo(Interface):
      foo = Attribute("The foo Attribute")