def setUp(self):
        super(TestGeverRenderWidget, self).setUp()
        textfield = TextLine()
        textfield.description = u"A d\xfcscription"

        self.widget = TextWidget(self.request)
        self.widget.field = textfield

        alsoProvides(self.request, IPloneFormLayer)
示例#2
0
    def setUp(self):
        super(TestGeverRenderWidget, self).setUp()
        textfield = TextLine()
        textfield.description = u"A d\xfcscription"

        self.widget = TextWidget(self.request)
        self.widget.field = textfield

        alsoProvides(self.request, IPloneFormLayer)
示例#3
0
class IChoice(IField):
    """Field whose value is contained in a predefined set

    Only one, values or vocabulary, may be specified for a given choice.
    """
    vocabulary = Field(
        title=_("Vocabulary or source providing values"),
        description=_("The ISource, IContextSourceBinder or IBaseVocabulary "
                      "object that provides values for this field."),
        required=False,
        default=None)

    vocabularyName = TextLine(
        title=_("Vocabulary name"),
        description=_("Vocabulary name to lookup in the vocabulary registry"),
        required=False,
        default=None)
示例#4
0
class IAdmUtilUserManagement(IAuthentication):
    """
    major component for user registration and management
    """
    useLdap = Bool(
        title = _("Usersearch by LDAP"),
        description = _("uses same LDAP connects"),
        default = False,
        required = False)
    serverURL = URI(
        max_length = 200,
        title = _("LDAP Server URL"),
        default = "ldap://127.0.0.1:389",
        required = False)
    baseDN = TextLine(
        max_length = 200,
        title = _("LDAP search base"),
        default = u"ou=staff,o=ict-ok,c=org",
        required = False)
    bindDN = TextLine(
        max_length = 200,
        title = _("LDAP bindDN"),
        default = u"",
        required = False)
    bindPassword = TextLine(
        max_length = 200,
        title = _("Bind Password"),
        default = u"",
        required = False)
    useSSL = Bool(
        title = _("Use SSL on LDAP connect"),
        description = _("Use SSL on LDAP connect"),
        default = False,
        required = False)

    searchBase = TextLine(
        max_length = 200,
        title = _("Search Base"),
        default = u'ou=staff,o=ikom-online,c=de,o=ifdd',
        required = False)
    searchScope = Choice(
        title = _("Search Scope"),
        default = u'sub',
        values = [u'sub', u'one', u'base'],
        required = False)
    groupsSearchBase = TextLine(
        max_length = 200,
        title = _("Groups Search Base"),
        default = u'cn=testIKOMtrol,o=ikom-online,c=de,o=ifdd',
        required = False)
    groupsSearchScope = TextLine(
        max_length = 200,
        title = _("Groups Search Scope"),
        default = u'one',
        required = False)
    loginAttribute = TextLine(
        max_length = 200,
        title = _("Login Attribute"),
        default = u'uid',
        required = False)
    idAttribute = TextLine(
        max_length = 200,
        title = _("Id Attribute"),
        default = u'uid',
        required = False)
    titleAttribute = TextLine(
        max_length = 200,
        title = _("Title Attribute"),
        default = u'cn',
        required = False)
    groupIdAttribute = TextLine(
        max_length = 200,
        title = _("Group Id Attribute"),
        default = u'cn',
        required = False)
示例#5
0
class IField(Interface):
    """Basic Schema Field Interface.

    Fields are used for Interface specifications.  They at least provide
    a title, description and a default value.  You can also
    specify if they are required and/or readonly.

    The Field Interface is also used for validation and specifying
    constraints.

    We want to make it possible for a IField to not only work
    on its value but also on the object this value is bound to.
    This enables a Field implementation to perform validation
    against an object which also marks a certain place.

    Note that many fields need information about the object
    containing a field. For example, when validating a value to be
    set as an object attribute, it may be necessary for the field to
    introspect the object's state. This means that the field needs to
    have access to the object when performing validation::

         bound = field.bind(object)
         bound.validate(value)

    """

    def bind(object):
        """Return a copy of this field which is bound to context.

        The copy of the Field will have the 'context' attribute set
        to 'object'.  This way a Field can implement more complex
        checks involving the object's location/environment.

        Many fields don't need to be bound. Only fields that condition
        validation or properties on an object containing the field
        need to be bound.
        """

    title = TextLine(
        title=_("Title"),
        description=_("A short summary or label"),
        default=u"",
        required=False,
        )

    description = Text(
        title=_("Description"),
        description=_("A description of the field"),
        default=u"",
        required=False,
        )

    required = Bool(
        title=_("Required"),
        description=(_("Tells whether a field requires its value to exist.")),
        default=True)

    readonly = Bool(
        title=_("Read Only"),
        description=_("If true, the field's value cannot be changed."),
        required=False,
        default=False)

    default = Field(
        title=_("Default Value"),
        description=_("""The field default value may be None or a legal
                        field value""")
        )

    missing_value = Field(
        title=_("Missing Value"),
        description=_("""If input for this Field is missing, and that's ok,
                          then this is the value to use""")
        )

    order = Int(
        title=_("Field Order"),
        description=_("""
        The order attribute can be used to determine the order in
        which fields in a schema were defined. If one field is created
        after another (in the same thread), its order will be
        greater.

        (Fields in separate threads could have the same order.)
        """),
        required=True,
        readonly=True,
        )

    def constraint(value):
        """Check a customized constraint on the value.

        You can implement this method with your Field to
        require a certain constraint.  This relaxes the need
        to inherit/subclass a Field you to add a simple constraint.
        Returns true if the given value is within the Field's constraint.
        """

    def validate(value):
        """Validate that the given value is a valid field value.

        Returns nothing but raises an error if the value is invalid.
        It checks everything specific to a Field and also checks
        with the additional constraint.
        """

    def get(object):
        """Get the value of the field for the given object."""

    def query(object, default=None):
        """Query the value of the field for the given object.

        Return the default if the value hasn't been set.
        """

    def set(object, value):
        """Set the value of the field for the object
示例#6
0
class ITitledTokenizedTerm(ITokenizedTerm):
    """A tokenized term that includes a title."""

    title = TextLine(title=_("Title"))