예제 #1
0
    def testFieldOrdering(self):
        schema=Schema()
        schema.addField(MockField("one"))
        schema.addField(MockField("two"))
        order=get_schema_order(schema)
        self.assertEqual(order, {"default": ["one", "two"]})

        schema.moveField("one", 1)
        order=get_schema_order(schema)
        self.assertEqual(order, {"default": ["two", "one"]})
예제 #2
0
 def testSwapTwoFields(self):
     schema=Schema()
     schema.addField(MockField("one"))
     schema.addField(MockField("two"))
     set_schema_order(schema, {"default": ["two", "one"]})
     self.assertEqual(schema._names, ["two", "one"])
예제 #3
0
 def testIdentityFieldReorder(self):
     schema=Schema()
     schema.addField(MockField("one"))
     schema.addField(MockField("two"))
     set_schema_order(schema, {"default": ["one", "two"]})
     self.assertEqual(schema._names, ["one", "two"])
예제 #4
0
 def testNopReorderErrors(self):
     schema=Schema()
     schema.addField(MockField("one"))
     schema.addField(MockField("two"))
     self.assertRaises(ValueError, set_schema_order, schema, {})
예제 #5
0
 def testEmptySchema(self):
     schema=Schema()
     before=schema.signature()
     set_schema_order(schema, {})
     self.assertEqual(schema.signature(), before)
from eduintelligent.trainingcenter import TCMessageFactory as _

schema = Schema((
    UserField(name='administators', 
            schemata='Administradores', 
            localrole='Manager',
            #cumulative=True, 
            multiValued=True),
    UserField(name='instuctors', 
            schemata='Instructores', 
            localrole='Administrator', 
            #cumulative=True, 
            multiValued=True),
    LinesField(
        # not 'roles' b/c 'validate_roles' exists; stoopid Archetypes
        name="roles_",
        accessor='getRoles',
        languageIndependent=1,
        vocabulary='getRoleSet',
        multiValued=1,
        widget=MultiSelectionWidget(
            label=_(u"Roles"),
            description=_(u"Roles that members of this group should receive."),
            visible = False
            ),
        ),

),)

SimpleSchema = getattr(ATBTreeFolder, 'schema', Schema(())).copy() + schema.copy()
예제 #7
0
파일: SOERReport.py 프로젝트: eea/eea.soer
schema = Schema((
    TextField('keyMessage',
        required=False,
        searchable=True,
        primary=False,
        storage=AnnotationStorage(migrate=True),
        validators=('isTidyHtmlWithCleanup',),
        default_content_type=zconf.ATNewsItem.default_content_type,
        default_output_type='text/x-html-safe',
        allowable_content_types=('text/html',),
        widget=RichWidget(
            description="Optional",
            description_msgid="help_body_text",
            label="Key message",
            label_msgid="label_body_text",
            rows=5,
            i18n_domain="plone",
            allow_file_upload=False,
        ),
    ),

    TextField('text',
        required=True,
        searchable=True,
        primary=True,
        storage=AnnotationStorage(migrate=True),
        validators=('isTidyHtmlWithCleanup',),
        default_content_type=zconf.ATNewsItem.default_content_type,
        default_output_type='text/x-html-safe',
        allowable_content_types=('text/html',),
        widget=RichWidget(
            description="",
            description_msgid="help_body_text",
            label="Assessment",
            label_msgid="label_body_text",
            rows=25,
            i18n_domain="plone",
            allow_file_upload=zconf.ATDocument.allow_document_upload
        ),
    ),

    StringField(
        name='soerCountry',
        required=False,
        mode='r',
        widget=SelectionWidget(
            label='Country',
            label_msgid='eea.soer_label_country',
            i18n_domain='eea.soer',
            format='select',
        ),
        vocabulary=NamedVocabulary('eea.soer.vocab.european_countries'),
        enforceVocabulary=False,
    ),

    StringField(
        name='geoCoverage',
        required=True,
        widget=SelectionWidget(
            label='Geographic coverage',
            label_msgid='eea.soer_label_geocoverage',
            description='Required',
            i18n_domain='eea.soer',
            format='select',
        ),
        vocabulary="getGeoCoverageVocabulary",
        enforceVocabulary=False,
    ),

    StringField(
        name='topic',
        required=True,
        widget=SelectionWidget(
            label='Topics',
            label_msgid='eea.soer_label_topics',
            i18n_domain='eea.soer',
            format='select',
        ),
        vocabulary=NamedVocabulary('eea.soer.vocab.topics'),
        enforceVocabulary=True,
    ),

    StringField(
        name='question',
        required=True,
        widget=SelectionWidget(
            label='Question',
            label_msgid='eea.soer_label_questions',
            i18n_domain='eea.soer',
            format='select',
        ),
        vocabulary=NamedVocabulary('eea.soer.vocab.questions'),
        enforceVocabulary=True,
    ),

    StringField(
        name='evaluation',
        required=0,
        searchable=0,
        default=u'http://www.eea.europa.eu/soer/evaluations#XX',
        widget=SelectionWidget(
            label='Evaluation',
            label_msgid='label_evaluation',
            description='This is a two letter value which indicates quickly '
                        'what the evaluation and trend is.',
            visible={'view' : 'invisible',
                     'edit' : 'invisible'},
            format='select',
        ),
        vocabulary='getEvaluationVocabulary',
    ),
),
)
예제 #8
0
파일: FSSItem.py 프로젝트: LEAMgroup/iw.fss
# Products imports
from iw.fss.config import PROJECTNAME
from iw.fss.FileSystemStorage import FileSystemStorage

BaseItemShema = Schema((
    FileField('file',
              required=False,
              primary=True,
              storage=FileSystemStorage(),
              widget=FileWidget(
                  description="Select the file to be added by clicking the 'Browse' button.",
                  description_msgid="help_file",
                  label="File",
                  label_msgid="label_file",
                  i18n_domain="plone",
                  show_content_type=False,)),
    ImageField('image',
               required=False,
               sizes={
                   'mini':(40,40),
                   'thumb':(80,80),},
               storage=FileSystemStorage(),
               widget=ImageWidget()),
    TextField('text',
              required=False,
              storage=FileSystemStorage(),
              widget=TextAreaWidget()),
    ), marshall=PrimaryFieldMarshaller())

FSSItemSchema = BaseSchema.copy() + BaseItemShema.copy()
ATFSSItemSchema = ATContentTypeSchema.copy() + BaseItemShema.copy()
예제 #9
0
    registerType
)

schema = Schema((
        StringField(
        name='topic',
        required=True,
        widget=StringWidget(
            label='Topics',
            label_msgid='eea.soer_label_topics',
            i18n_domain='eea.soer',
            description='use any environmental term, you can find all terms at'\
            ' <a href="http://glossary.eea.europa.eu/">ETDS</a>'
         ),
     ),

    StringField(
        name='question',
        required=True,
        widget=StringWidget(
            label='Title',
            label_msgid='eea.soer_label_questions',
            i18n_domain='eea.soer',
            description='Custom title for this report',
         ),
     ),
),
)
schema = getattr(SOERReport, 'schema').copy() + schema.copy()
schema['title'].required = False
예제 #10
0
from zope.interface import implementer

SimpleSchema = BaseSchema + Schema((
    StringField('userName',
                languageIndependent=1,
                widget=StringWidget(description="Username for a person.")),
    StringField('password',
                languageIndependent=1,
                widget=StringWidget(description="Password.")),
    StringField(
        'fullname',
        languageIndependent=1,
        # schemata='userinfo',
        user_property=True,
        widget=StringWidget(description="Full name.")),
    LinesField(
        # not 'roles' b/c 'validate_roles' exists; stoopid Archetypes
        name="roles_",
        accessor='getRoles',
        mutator='setRoles',
        languageIndependent=1,
        vocabulary='getRoleSet',
        multiValued=1,
        widget=MultiSelectionWidget(
            label="Roles",
            description="Roles that member has.",
        ),
    ),
))

예제 #11
0
# This file is part of SENAITE.CORE
#
# Copyright 2018 by it's authors.
# Some rights reserved. See LICENSE.rst, CONTRIBUTORS.rst.

from AccessControl import ClassSecurityInfo
from Products.Archetypes.public import Schema, registerType
from bika.lims import PROJECTNAME
from bika.lims.content.abstractroutineanalysis import AbstractRoutineAnalysis
from bika.lims.content.abstractroutineanalysis import schema
from bika.lims.interfaces import IRoutineAnalysis
from bika.lims.workflow import getCurrentState, in_state
from bika.lims.workflow.analysis import STATE_RETRACTED, STATE_REJECTED
from zope.interface import implements

schema = schema.copy() + Schema(())


class Analysis(AbstractRoutineAnalysis):
    implements(IRoutineAnalysis)
    security = ClassSecurityInfo()
    displayContentsTab = False
    schema = schema

    @security.public
    def getSiblings(self, retracted=False):
        """
        Returns the list of analyses of the Analysis Request to which this
        analysis belongs to, but with the current analysis excluded.
        :param retracted: If false, retracted/rejected siblings are dismissed
        :type retracted: bool
예제 #12
0
""" ETag widget
"""
from Products.Archetypes.public import Schema
from Products.Archetypes.public import StringField
from Products.Archetypes.public import StringWidget

from eea.facetednavigation.widgets import ViewPageTemplateFile
from eea.facetednavigation.widgets.widget import Widget as AbstractWidget
from eea.facetednavigation import EEAMessageFactory as _

EditSchema = Schema(
    (StringField('default',
                 schemata="default",
                 default='1.0',
                 widget=StringWidget(size=25,
                                     label=_(u'Default etag'),
                                     description=_(u'Etag value'),
                                     i18n_domain="eea")), ))


class Widget(AbstractWidget):
    """ Widget
    """
    widget_type = 'etag'
    widget_label = 'ETag'
    edit_js = '++resource++eea.facetednavigation.widgets.etag.edit.js'
    edit_css = '++resource++eea.facetednavigation.widgets.etag.edit.css'
    css_class = 'faceted-etag-widget'

    index = ViewPageTemplateFile('widget.pt')
    edit_schema = AbstractWidget.edit_schema.copy() + EditSchema