def set(self, instance, value, **kwargs): """ Field mutator """ is_value = value and value != "DELETE_FILE" # Handle migration migration = kwargs.pop('_migration_', False) if is_value and not migration: notify(FileUploadedEvent(instance, value, True)) BlobField.set(self, instance, value, **kwargs)
def set(self, instance, value, **kwargs): """ Field mutator """ is_value = value and value != "DELETE_FILE" # Handle update title and description checkbox update_main = kwargs.pop('_update_main_', False) # Handle migration migration = kwargs.pop('_migration_', False) if is_value and not migration: notify(FileUploadedEvent(instance, value, update_main)) BlobField.set(self, instance, value, **kwargs)
class ATMultipleFields(atapi.BaseContent): schema = atapi.Schema(( atapi.StringField('foo'), atapi.FileField('file1'), atapi.ImageField('image1'), atapi.ImageField('image2', sizes={'mini': (50,50), 'normal' : (100,100)}), BlobField('blob1'), ))
}, { "columnName": "Title", "label": "Title" }, { "columnName": "ClientTitle", "label": "Client" }, ], ), ), RecordField( "Metadata", multiValued=True, ), BlobField( "Pdf", ), RecordsField( "Recipients", type="recipients", subfields=( "UID", "Username", "Fullname", "EmailAddress", "PublicationModes" ), ), DateTimeField( "DatePrinted", mode="rw",
default=False, required=0), TextField( name='sparql_results', widget=TextAreaWidget(label="Results", visible={ 'edit': 'invisible', 'view': 'invisible' }), required=0, ), BlobField( name='sparql_results_cached', widget=TextAreaWidget(label="Results", visible={ 'edit': 'invisible', 'view': 'invisible' }), required=0, ), BlobField( name='sparql_results_cached_json', widget=TextAreaWidget(label="Results", visible={ 'edit': 'invisible', 'view': 'invisible' }), required=0, ), BlobField( name='sparql_results_cached_xml',
from Products.Archetypes.public import ReferenceField, FileField, \ StringField, Schema, BaseFolder from plone.app.blob.field import BlobField from Products.Archetypes.references import HoldingReference from bika.lims.config import PROJECTNAME from bika.lims.content.bikaschema import BikaSchema schema = BikaSchema.copy() + Schema(( ReferenceField( 'AnalysisRequest', allowed_types=('AnalysisRequest', ), relationship='ReportAnalysisRequest', referenceClass=HoldingReference, required=1, ), BlobField('Pdf', ), StringField('Html', ), StringField('SMS', ), RecordsField( 'Recipients', type='recipients', subfields=('UID', 'Username', 'Fullname', 'EmailAddress', 'PublicationModes'), ), )) schema['id'].required = False schema['title'].required = False class ARReport(BaseFolder):
from plone.app.blob.field import BlobField from Products.Archetypes import public as atpublic from Products.ATContentTypes.content.document import ATDocumentBase, ATDocumentSchema from Products.ATContentTypes.content.base import registerATCT from Products.CMFCore.utils import getToolByName from jalon.content import contentMessageFactory as _ from jalon.content.config import PROJECTNAME from jalon.content.interfaces import IJalonFile import jalon_utils JalonFileSchema = ATDocumentSchema.copy() + atpublic.Schema(( BlobField('file', widget=atpublic.FileWidget(label='A file', description='Some file'), required=True, ), atpublic.StringField("actif", required=False, accessor="getActif", searchable=False, default="actif", widget=atpublic.StringWidget(label=_(u"Actif"), )), atpublic.TextField("correction", required=True, accessor="getCorrection", searchable=False, widget=atpublic.TextAreaWidget(label=_(u"Correction"), )),
subfields=( "actor", "actor_fullname", "email_send_date", "email_recipients", "email_responsibles", "email_subject", "email_body", "email_attachments", ), ), TextField( "Html" ), BlobField( "Pdf", default_content_type="application/pdf", ), RecordsField( "Recipients", type="recipients", subfields=( "UID", "Username", "Fullname", "EmailAddress", "PublicationModes" ), ), DateTimeField( "DatePrinted", mode="rw",
from zope.interface import implements from Products.Archetypes import atapi from Products.ATContentTypes.content import schemata from Products.ATContentTypes.content.base import ATCTFileContent, ATContentTypeSchema from observatorio.conteudo import MessageFactory as _ from observatorio.conteudo.config import PROJECTNAME from observatorio.conteudo.interfaces import IPublicacao PublicacaoSchema = ATContentTypeSchema.copy() + atapi.Schema(( BlobField( name='arquivo', widget=atapi.FileWidget( label=_(u'Arquivo'), description=_(u'Arquivo da publicacao.'), ), required=True, primary=True, ), ImageField( name='image', widget=atapi.ImageWidget( label=_(u'Imagem Capa'), description=_(u'Imagem da capa da publicacao.'), ), required=False, ), )) schemata.finalizeATCTSchema(PublicacaoSchema)
ATTestDocumentSchema = ATDocumentSchema.copy() + atapi.Schema(( atapi.StringField("testStringField"), atapi.BooleanField("testBooleanField"), atapi.IntegerField("testIntegerField"), atapi.FloatField("testFloatField"), atapi.FixedPointField("testFixedPointField"), atapi.DateTimeField("testDateTimeField"), atapi.LinesField("testLinesField"), atapi.FileField("testFileField"), atapi.TextField("testTextField"), atapi.ImageField("testImageField"), atapi.ReferenceField("testReferenceField", relationship="testrelation"), atapi.ReferenceField( "testMVReferenceField", relationship="testrelation", multiValued=True), BlobField("testBlobField"), FileField("testBlobFileField"), ImageField("testBlobImageField"), QueryField("testQueryField"), atapi.StringField("testRequiredField", required=True), atapi.StringField("testReadonlyField", mode="r"), atapi.StringField("testWriteonlyField", mode="w"), atapi.StringField("testReadPermissionField", read_permission=permissions.ManagePortal), atapi.StringField("testWritePermissionField", write_permission=permissions.ManagePortal), atapi.StringField("testURLField", validators=("isURL", )), )) class ATTestDocument(ATDocumentBase):
TextField('Remarks', ), ReferenceField( 'Instrument', required=0, allowed_types=('Instrument',), relationship='AnalysisInstrument', referenceClass=HoldingReference, ), ReferenceField('Method', required = 0, allowed_types = ('Method',), relationship = 'AnalysisMethod', referenceClass = HoldingReference, ), BlobField('RetractedAnalysesPdfReport', ), BooleanField('Retested', default = False, widget = BooleanWidget( label=_("Retested"), ), ), ComputedField('ReferenceSampleUID', expression = 'context.aq_parent.UID()', widget = ComputedWidget( visible=False, ), ), ComputedField('SupplierUID', expression = 'context.aq_parent.aq_parent.UID()', widget = ComputedWidget(
from tm.xml2table.interfaces import IXMLFile from tm.xml2table.config import PROJECTNAME from tm.xml2table import validators XMLFileSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema(( # -*- Your Archetypes field definitions here ... -*- BlobField('xmlfile', required=True, primary=True, searchable=False, accessor='getXMLFile', mutator='setXMLFile', index_method='getIndexValue', languageIndependent=True, storage=atapi.AnnotationStorage(migrate=True), default_content_type='application/octet-stream', validators=(('isNonEmptyFile', V_REQUIRED), ('checkFileMaxSize', V_REQUIRED), ('isXMLFile', V_REQUIRED)), widget=atapi.FileWidget( label=_(u'label_xmlfile', default=u'XML File'), description=_(u''), show_content_type=False, )), BlobField('xslfile', required=True, searchable=False, accessor='getXSLFile', mutator='setXSLFile', index_method='getIndexValue', languageIndependent=True,
u"line.")), rows=6, allow_file_upload=False, ), default_output_type="text/html", default_content_type=DEFAULT_ISSUE_MIME_TYPE, searchable=True ), BlobField( 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."),
from Products.CMFCore.permissions import View from plone.app.blob.field import BlobField from eea.dataservice.interfaces import IEEAFigureFile from eea.dataservice.vocabulary import CATEGORIES_DICTIONARY_ID from AccessControl import ClassSecurityInfo # Schema schema = Schema( ( BlobField('file', required=False, primary=True, validators=(('checkFileMaxSize', V_REQUIRED), ), 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, )), StringField( name='category', default='edse', vocabulary=NamedVocabulary(CATEGORIES_DICTIONARY_ID), widget=SelectionWidget( format="select", # possible values: flex, select, radio label="Category", description="Category description.", label_msgid='dataservice_label_category',
ATTestDocumentSchema = ATDocumentSchema.copy() + atapi.Schema(( atapi.StringField('testStringField'), atapi.BooleanField('testBooleanField'), atapi.IntegerField('testIntegerField'), atapi.FloatField('testFloatField'), atapi.FixedPointField('testFixedPointField'), atapi.DateTimeField('testDateTimeField'), atapi.LinesField('testLinesField'), atapi.FileField('testFileField'), atapi.TextField('testTextField'), atapi.ImageField('testImageField'), atapi.ReferenceField('testReferenceField', relationship='testrelation'), atapi.ReferenceField( 'testMVReferenceField', relationship='testrelation', multiValued=True), BlobField('testBlobField'), FileField('testBlobFileField'), ImageField('testBlobImageField'), QueryField('testQueryField'), atapi.StringField('testRequiredField', required=True), atapi.StringField('testReadonlyField', mode='r'), atapi.StringField('testWriteonlyField', mode='w'), atapi.StringField('testReadPermissionField', read_permission=permissions.ManagePortal), atapi.StringField('testWritePermissionField', write_permission=permissions.ManagePortal), atapi.StringField('testURLField', validators=('isURL', )), )) class ATTestDocument(ATDocumentBase):
from bika.lims import api from bika.lims.config import PROJECTNAME from bika.lims.config import STD_TYPES from bika.lims.content.abstractanalysis import AbstractAnalysis from bika.lims.content.abstractanalysis import schema from bika.lims.content.analysisspec import ResultsRangeDict from bika.lims.interfaces import IReferenceAnalysis schema = schema.copy() + Schema(( StringField( "ReferenceType", vocabulary=STD_TYPES, ), BlobField( "RetractedAnalysesPdfReport", ), StringField( "ReferenceAnalysesGroupID", ) )) class ReferenceAnalysis(AbstractAnalysis): """Reference Analysis Content """ implements(IReferenceAnalysis) security = ClassSecurityInfo() schema = schema @security.public
from Products.Archetypes.public import ReferenceField, \ StringField, Schema, BaseFolder from plone.app.blob.field import BlobField from Products.Archetypes.references import HoldingReference from bika.lims.config import PROJECTNAME from bika.lims.content.bikaschema import BikaSchema schema = BikaSchema.copy() + Schema(( ReferenceField( 'AnalysisRequest', allowed_types=('AnalysisRequest', ), relationship='ReportAnalysisRequest', referenceClass=HoldingReference, required=1, ), BlobField('Pdf', ), StringField('Html', ), BlobField('CSV', ), StringField('SMS', ), StringField('COANR', ), RecordsField( 'Recipients', type='recipients', subfields=('UID', 'Username', 'Fullname', 'EmailAddress', 'PublicationModes'), ), )) schema['id'].required = False schema['title'].required = False
# -*- coding: utf-8 -*- from plone.app.blob.config import packageName from plone.app.blob.field import BlobField from Products.Archetypes.atapi import StringField from Products.CMFPlone import PloneMessageFactory as _ from Products.LinguaPlone.public import BaseContent from Products.LinguaPlone.public import BaseSchema from Products.LinguaPlone.public import FileWidget from Products.LinguaPlone.public import registerType from Products.LinguaPlone.public import Schema BlobelFishSchema = BaseSchema.copy() + Schema(( BlobField(name='guide', primary=True, languageIndependent=True, widget=FileWidget( label=_(u'label_file', default=u'File'), description=_(u''), )), StringField( name='teststr', languageIndependent=True, ), )) class BlobelFish(BaseContent): """ a multilingual fish """ schema = BlobelFishSchema _at_rename_after_creation = True