本文整理汇总了Python中Products.Archetypes.atapi.Schema类的典型用法代码示例。如果您正苦于以下问题:Python Schema类的具体用法?Python Schema怎么用?Python Schema使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Schema类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Schema
from AccessControl import ClassSecurityInfo
from Products.Archetypes.atapi import Schema, BaseSchema, BaseContent, DisplayList, registerType
#from Products.Archetypes.utils import shasattr
from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin
from Products.CMFCore.utils import UniqueObject
from Products.DCWorkflow.Transitions import TRIGGER_USER_ACTION
#from zLOG import LOG, INFO, ERROR
from Products.ECAssignmentBox.tool.Statistics import Statistics
from Products.ECAssignmentBox.tool.interfaces import IECABTool
from Products.ECAssignmentBox import config
from Products.ECAssignmentBox import LOG
schema = Schema((
),
)
ECABTool_schema = BaseSchema.copy() + schema.copy()
class ECABTool(UniqueObject, BaseContent, BrowserDefaultMixin):
"""
"""
security = ClassSecurityInfo()
implements(IECABTool)
meta_type = 'ECABTool'
plone_tool = True
_at_rename_after_creation = True
schema = ECABTool_schema
示例2: Schema
""" Requestor folder
"""
from AccessControl import ClassSecurityInfo
from Products.Archetypes.atapi import registerType, Schema
from Products.ATContentTypes.content.folder import ATBTreeFolder
from Products.EEAEnquiry.config import PROJECTNAME
from Products.CMFCore.permissions import ModifyPortalContent
schema = Schema((
),
)
EnquiryRequestorFolder_schema = getattr(
ATBTreeFolder, 'schema', Schema(())).copy() + schema.copy()
class EnquiryRequestorFolder(ATBTreeFolder):
""" Enquiry Requestor Folder
"""
security = ClassSecurityInfo()
# This name appears in the 'add' box
archetype_name = 'EnquiryRequestorFolder'
meta_type = 'EnquiryRequestorFolder'
portal_type = 'EnquiryRequestorFolder'
allowed_content_types = ['EnquiryRequestor'] + list(
getattr(ATBTreeFolder, 'allowed_content_types', []))
filter_content_types = 1
global_allow = 0
immediate_view = 'base_view'
default_view = 'base_view'
示例3: Schema
schema = Schema((
TextField(
name='text',
allowable_content_types=('text/plain', 'text/structured', 'text/html', 'application/msword'),
widget=RichWidget(
label='Text',
label_msgid='GitesContent_label_text',
i18n_domain='gites',
),
default_output_type='text/html',
required=1
),
ImageField(
name='photo',
widget=ImageWidget(
label='Photo',
label_msgid='GitesContent_label_photo',
i18n_domain='gites',
),
required=1,
storage=AttributeStorage()
),
),
)
##code-section after-local-schema #fill in your manual code here
示例4: Schema
schema = Schema(
(
StringField(
name="id",
widget=StringWidget(
visible={"view": "invisible", "edit": "visible"},
modes=("view",),
label=_(u"Poi_label_issue_id", default=u"Id"),
),
mode="r",
),
StringField(
name="title",
widget=StringWidget(
label=_(u"Poi_label_issue_title", default=u"Title"),
description=_(
u"Poi_help_issue_title",
default=(
u"Enter a short, descriptive title for the issue. "
u"A good title will make it easier for project "
u"managers to identify and respond to the issue."
),
),
),
required=True,
accessor="Title",
searchable=True,
),
StringField(
name="release",
default="(UNASSIGNED)",
widget=SelectionWidget(
label=_(u"Poi_label_release", default=u"Version"),
description=_(u"Poi_help_release", default=(u"Select the version the issue was found in.")),
condition="object/isUsingReleases",
),
required=True,
vocabulary="getReleasesVocab",
),
TextField(
name="details",
allowable_content_types=ISSUE_MIME_TYPES,
widget=RichWidget(
label=_(u"Poi_label_details", default=u"Details"),
description=_(u"Poi_help_details", default=u"Please provide further details"),
rows=15,
allow_file_upload=False,
),
required=True,
default_content_type=DEFAULT_ISSUE_MIME_TYPE,
searchable=True,
default_output_type="text/html",
),
TextField(
name="steps",
allowable_content_types=ISSUE_MIME_TYPES,
widget=RichWidget(
label=_(u"Poi_label_steps", default=u"Steps to reproduce"),
description=_(
u"Poi_help_steps",
default=(
u"If applicable, please provide the steps to "
u"reproduce the error or identify the issue, one per "
u"line."
),
),
rows=6,
allow_file_upload=False,
),
default_output_type="text/html",
default_content_type=DEFAULT_ISSUE_MIME_TYPE,
searchable=True,
),
FileField(
name="attachment",
widget=FileWidget(
label=_(u"Poi_label_attachment", default=u"Attachment"),
description=_(
u"Poi_help_attachment",
default=(
u"You may optionally upload a file attachment. Please "
u"do not upload unnecessarily large files."
),
),
),
storage=AttributeStorage(),
write_permission=permissions.UploadAttachment,
),
StringField(
name="area",
widget=SelectionWidget(
label=_(u"Poi_label_area", default=u"Area"),
description=_(u"Poi_help_area", default=u"Select the area this issue is relevant to."),
),
enforceVocabulary=True,
default_method="getDefaultArea",
vocabulary="getAreasVocab",
required=True,
),
StringField(
#.........这里部分代码省略.........
示例5: Schema
SCHEMA = Schema((
DavizReferenceField('relatedItems',
schemata="data input",
relationship='relatesTo',
multiValued=True,
widget=EEAReferenceBrowserWidget(
label=_("Find and reuse existing data"),
description=_(u"Look for compatible datasets in catalogue"
" (e.g. visualization data, .tsv, .csv, SPARQL, etc)"
),
i18n_domain="eea",
visible={'edit': 'visible', 'view': 'invisible'}
)),
StringField('quickUpload',
schemata='data input',
widget=QuickUploadWidget(
label=_('Upload CSV/TSV data files from your computer'),
description=_(u"upload-csv-description", default=(
"Drag and drop '.tsv, .csv files' in the area below, see "
'<a target="_blank" href="http://www.eea.europa.eu/'
'data-and-maps/daviz/learn-more/examples">data examples</a> '
'or read '
'<a target="_blank" href="http://www.eea.europa.eu/'
'data-and-maps/daviz/learn-more/prepare-data">'
'how to prepare data</a> '
#temporarily hide the link to tutorials
'<div style="display:none">'
'or watch the '
'<a target="_blank" href="daviz-tutorials.html#create">'
'<span class="eea-icon eea-icon-youtube-square"></span>'
'video tutorials</a>'
'</div>'
)
),
i18n_domain="eea",
visible={'edit': 'visible', 'view': 'invisible'}
)
),
DavizStringField('spreadsheet',
schemata='data input',
validators=('csvfile',),
widget=TextAreaWidget(
label=_('Copy and paste a data table from a file/webpage'),
description=_(u"copy-paste-description", default=(
"<div style='float:left'>Check these "
'<a target="_blank" href="http://www.eea.europa.eu/'
'data-and-maps/daviz/learn-more/examples">data examples</a> '
'or read '
'<a target="_blank" href="http://www.eea.europa.eu/'
'data-and-maps/daviz/learn-more/prepare-data">'
'how to prepare data</a> '
'or '
'</div>'
'<span class="eea-tutorial" tutorial="create"></span>'
"<div style='clear:both'></div>"
)
),
i18n_domain="eea",
helper_js=(
'++resource++eea.daviz.common.js',
'++resource++eea.daviz.spreadsheet.js',),
helper_css=(
'++resource++eea.daviz.common.css',
'++resource++eea.daviz.spreadsheet.css',),
visible={'edit': 'visible', 'view': 'invisible'}
)
),
DavizUrlField('external',
schemata="data input",
validators=('externalURL',),
widget=StringWidget(
label=_(u"Add data from URL"),
description=_(u"Add a data URL which returns CSV/TSV, "
"standard JSON, Exhibit JSON or Google Spreadsheet")
),
i18n_domain="eea",
visible={'edit': 'visible', 'view': 'invisible'}
),
StringField('dataWarning',
schemata='data input',
widget=LabelWidget(
label=_('Warning'),
description=_(u"<b>Changing data sources may break existing "
"visualizations.</b><br/>"
"If you want to upload new data you "
"must make sure that the data columns are exactly the same "
"and in the same order, otherwise the existing charts will "
"break. Changing settings here requires data knowledge "
"skills. <br/>"
"If you want to know more contact your web admin."
),
i18n_domain="eea",
helper_js=('++resource++eea.daviz.warnings.js',),
visible={'edit': 'visible', 'view': 'invisible'}
)
),
DavizDataField('dataTitle', alias="title",
schemata='default',
widget=StringWidget(
label=_("Data source title"),
#.........这里部分代码省略.........
示例6: Schema
schema = Schema((
StringField('courseType',
required = False,
widget = StringWidget(
label = "Course type",
description = "Enter the type of this course (e.g., Lecture or Lab Exercise)",
label_msgid = 'label_course_type',
description_msgid = 'help_course_type',
i18n_domain = config.I18N_DOMAIN,
),
),
LinesField('instructors',
required = True,
languageIndependent = True,
searchable = True,
widget = LinesWidget(
label = "Instructors",
description = "User names or names of instructors, one per line",
label_msgid = 'label_instructors',
description_msgid = 'help_instructors',
i18n_domain = config.I18N_DOMAIN,
),
),
TimePeriodField('timePeriod',
accessor = 'getTimePeriod',
edit_accessor = 'getTimePeriodForEdit',
required = True,
default = ['11:00', '13:00'],
widget = StringWidget(
macro = 'time_period',
size = 5,
maxlength = 5,
label = "Time period",
description = "Start and end times of this course",
label_msgid = 'label_time_period',
description_msgid = 'help_time_period',
i18n_domain = config.I18N_DOMAIN,
),
),
DateTimeField('startDate',
required = True,
widget = CalendarWidget(
label = "Start date",
description = "First regular date",
label_msgid = 'label_start_date',
description_msgid = 'help_start_date',
show_hm = False,
#show_ymd = True,
i18n_domain = config.I18N_DOMAIN,
),
),
DateTimeField('endDate',
required = True,
widget = CalendarWidget(
label = "End date",
description = "Last regular date",
label_msgid = 'label_end_date',
description_msgid = 'help_end_date',
show_hm = False,
#show_ymd = True,
i18n_domain = config.I18N_DOMAIN,
),
),
StringField('recurrence',
required = True,
vocabulary = 'getRecurrenceDisplayList',
default = WEEKLY,
widget = SelectionWidget(
format = "radio", # possible values: flex, select, radio
label = "Recurrence",
description = "How often this course takes place",
label_msgid = 'label_recurrence',
description_msgid = 'help_recurrence',
i18n_domain = config.I18N_DOMAIN,
),
),
DateTimeField('firstSession',
widget = CalendarWidget(
label = "First session",
description = "Date for the first session for this course",
label_msgid = 'label_first_session',
description_msgid = 'help_first_session',
#show_hm = False,
i18n_domain = config.I18N_DOMAIN,
),
),
StringField('location',
required = True,
widget = StringWidget(
label = "Location",
description = "Location for this course",
label_msgid = 'label_location',
#.........这里部分代码省略.........
示例7: Schema
schema = Schema(
(
StringField(
name="id",
widget=StringWidget(
visible={"edit": "invisible", "view": "invisible"},
modes=("view",),
label="Id",
label_msgid="Poi_label_id",
i18n_domain="Poi",
),
mode="r",
),
StringField(
name="title",
widget=StringWidget(
label="Subject",
description="""Enter a brief subject for this response, e.g. "Fixed" or "Will be fixed in next release".""",
visible={"edit": "invisible", "view": "invisible"},
modes=("view",),
label_msgid="Poi_label_response_title",
description_msgid="Poi_help_response_title",
i18n_domain="Poi",
),
accessor="Title",
mode="r",
searchable=True,
),
TextField(
name="response",
allowable_content_types=ISSUE_MIME_TYPES,
widget=RichWidget(
label="Response",
description="Please enter your response below",
rows=15,
allow_file_upload=False,
label_msgid="Poi_label_response",
description_msgid="Poi_help_response",
i18n_domain="Poi",
),
required=False,
default_content_type=DEFAULT_ISSUE_MIME_TYPE,
searchable=True,
default_output_type="text/html",
),
FileField(
name="attachment",
widget=FileWidget(
label="Attachment",
description="You may optionally upload a file attachment. Please do not upload unnecessarily large files.",
label_msgid="Poi_label_attachment",
description_msgid="Poi_help_attachment",
i18n_domain="Poi",
),
storage=AttributeStorage(),
write_permission=permissions.UploadAttachment,
),
StringField(
name="issueTransition",
mutator="setNewIssueState",
widget=SelectionWidget(
label="Change issue state",
description="Select a change of state in the issue this response is for, if applicable",
format="radio",
label_msgid="Poi_label_issueTransition",
description_msgid="Poi_help_issueTransition",
i18n_domain="Poi",
),
vocabulary="getAvailableIssueTransitions",
default="",
enforceVocabulary=False,
accessor="getIssueTransition",
write_permission=permissions.ModifyIssueState,
),
StringField(
name="newSeverity",
mutator="setNewSeverity",
widget=SelectionWidget(
label="Change issue severity",
description="Select the severity for this issue",
format="radio",
label_msgid="Poi_label_newSeverity",
description_msgid="Poi_help_newSeverity",
i18n_domain="Poi",
),
vocabulary="getAvailableSeverities",
default_method="getCurrentIssueSeverity",
enforceVocabulary=True,
accessor="getNewSeverity",
write_permission=permissions.ModifyIssueSeverity,
),
StringField(
name="newTargetRelease",
mutator="setNewTargetRelease",
widget=SelectionWidget(
label="Change target release",
description="Set the target release for this issue",
format="flex",
condition="object/isUsingReleases",
label_msgid="Poi_label_newTargetRelease",
#.........这里部分代码省略.........
示例8: Schema
schema = Schema((
TextField(
'directions',
allowable_content_types = config.ALLOWED_CONTENT_TYPES,
default_content_type = config.DEFAULT_CONTENT_TYPE,
default_output_type = config.DEFAULT_OUTPUT_TYPE,
widget = RichWidget(
label = 'Directions',
label_msgid = 'label_directions',
description = 'Instructions/directions that all assignment boxes in this folder refer to',
description_msgid = 'help_directions',
i18n_domain = config.I18N_DOMAIN,
allow_file_upload = False,
rows = 8,
),
),
LinesField(
'completedStates',
searchable = False,
vocabulary = 'getCompletedStatesVocab',
multiValued = True,
widget = MultiSelectionWidget(
label = "Completed States",
label_msgid = "label_completed_states",
description = "States considered as completed",
description_msgid = "help_completed_states",
i18n_domain = config.I18N_DOMAIN,
),
),
IntegerField(
'projectedAssignments',
searchable = False,
required = True,
default = 0,
validators = ('isInt', validators.POSITIVE_NUMBER_VALIDATOR_NAME),
widget = IntegerWidget(
label = "Projected Number of Assignments",
label_msgid = "label_projected_assignments",
description = "Projected number of assignments, 0 means undefined",
description_msgid = "help_projected_assignments",
i18n_domain = config.I18N_DOMAIN,
),
),
),
)
示例9: Schema
from Products.Poi import permissions
from Products.Poi.config import PROJECTNAME
from Products.Poi.config import PSC_TRACKER_ID
from Products.Poi.content.PoiTracker import PoiTracker
from Products.Poi.content.PoiTracker import PoiTracker_schema
from Products.Poi.interfaces import ITracker
schema = Schema((
StringField(
name='id',
widget=StringWidget(
label="Short name",
description=("Short name for the tracker - should be 'issues' "
"to comply with the standards."),
label_msgid="Poi_label_psctracker_title",
description_msgid="Poi_description_psctracker_title",
i18n_domain='Poi',
),
required=False,
mode="r"
),
),
)
PoiPscTracker_schema = PoiTracker_schema.copy() + schema.copy()
PoiPscTracker_schema['title'].required = False
PoiPscTracker_schema['title'].widget.visible = {'edit': 'invisible',
'view': 'visible'}
del PoiPscTracker_schema['availableReleases']
示例10: Schema
from Products.ATContentTypes.lib.constraintypes \
import ConstrainTypesMixinSchema
schema = Schema((
ImageField(
name='categoryimage',
widget=ImageField._properties['widget'](
label="Category image",
description="Image which represents the category",
label_msgid="classifieds_classifiedscategory_categoryimage",
description_msgid=\
"classifieds_classifiedscategory_categoryimage_description",
i18n_domain='classifieds',
),
storage=AttributeStorage(),
max_size=(768, 768),
sizes={'large': (768, 768),
'preview': (400, 400),
'mini': (200, 200),
'thumb': (128, 128),
'tile': (64, 64),
'icon': (32, 32),
'listing': (16, 16),
},
),
),
)
OrderedClassifiedsCategory_schema = document.ATDocumentSchema.copy()
OrderedClassifiedsCategory_schema += ConstrainTypesMixinSchema
OrderedClassifiedsCategory_schema += schemata.NextPreviousAwareSchema
示例11: Schema
DefaultSchema = Schema((
FloatField(
name='budgetHours',
write_permission="eXtremeManagement: Edit budgetHours",
validators=('isDecimal', ),
widget=DecimalWidget(
description="Enter the budget of the project in hours.",
label='Budget (hours)',
label_msgid='label_budgetHours',
description_msgid='help_budgetHours',
i18n_domain='eXtremeManagement'),
),
BooleanField('includeGlobalMembers',
default=True,
languageIndependent=True,
widget=BooleanWidget(
description="If selected, Members with a global role 'Employee' "
" will appear in the assignees list of a Task.",
description_msgid="help_include_global_members",
label="Include global Employees",
label_msgid="label_include_global_members",
i18n_domain="eXtremeManagement"),
),
BooleanField(
name='billableProject',
default="True",
widget=BooleanWidget(
label='Billable',
label_msgid='eXtremeManagement_label_billable',
i18n_domain='eXtremeManagement')
),
), )
示例12: Schema
schema = Schema((
TextField(
name='assessment',
widget=RichWidget(
label='Assessment',
description='Assessment',
label_msgid='indicators_label_assessment',
i18n_domain='indicators',
),
default_content_type="text/html",
searchable=True,
required=True,
required_for_published=True,
allowable_content_types=('text/html',),
default_output_type="text/x-html-safe",
),
StringField(
name='title',
widget=StringField._properties['widget'](
visible={'view': 'invisible', 'edit': 'invisible'},
label='Title',
description='Title',
label_msgid='indicators_label_title',
i18n_domain='indicators',
),
required=False,
accessor="Title",
),
TextField(
name='description',
default="",
widget=TextAreaWidget(
visible={'edit': 'invisible', 'view': 'invisible'},
label='Description',
description='Description',
label_msgid='indicators_label_description',
i18n_domain='indicators',
),
accessor="Description",
searchable=True,
),
EEAReferenceField(
name="relatedItems",
multiValued=True,
relationship='relatesTo',
required=True,
validators=('one_assessment_per_question',),
# referencesSortable=True,
keepReferencesOnCopy=True,
accessor="get_related_items",
edit_accessor="get_raw_related_items",
mutator="set_related_items",
widget=EEAReferenceBrowserWidget(
label="Answers to policy question and related EEAFigures",
description='Answers to policy question and related EEAFigures',
label_msgid='indicators_label_question_answered',
i18n_domain='indicators',
macro="assessmentpart_relationwidget",
)
),
))