Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(18)  |  Call(16)  |  Derive(0)  |  Import(2)

src/a/r/archetypes.uploadreferencewidget-0.2.1/archetypes/uploadreferencewidget/demo.py   archetypes.uploadreferencewidget(Download)
from Products.Archetypes.public import BaseContent
from Products.Archetypes.public import ReferenceField
from archetypes.uploadreferencewidget.widget import UploadReferenceWidget
from archetypes.uploadreferencewidget import config
 
        required=True,
        widget=UploadReferenceWidget(
            label='Single Reference',
            description='This is the first field. It can reference a '
                        'single item. This field uses the site root as '
        relationship='rel2',
        widget=UploadReferenceWidget(
            label='Multiple References',
            description='This is the second field. It can reference '
                        'multiple items. This field uses the current '
        schemata='invalid',
        widget=UploadReferenceWidget(
            label='Invalid Path',
            description='This is the third field. It can reference a '
                        'single item. This field uses an invalid path '

src/a/r/archetypes.uploadreferencewidget-0.2.1/archetypes/uploadreferencewidget/tests/test_widget.py   archetypes.uploadreferencewidget(Download)
from Products.PloneTestCase import PloneTestCase
from archetypes.uploadreferencewidget.tests import URWTestCase
from archetypes.uploadreferencewidget.widget import UploadReferenceWidget
 
from archetypes.uploadreferencewidget.tests.utils import FakeRequest
    def uploadContentToPath(self, obj, path, destination):
        field = obj.getField('relatedItems')
        fileupload = FakeFileUpload(filename='enfold.pdf', file=self.PDF)
        field.widget = UploadReferenceWidget(startup_directory=path)
        form = {
    def testSelectExistingContentProcessWidget(self):
        self.field.widget = UploadReferenceWidget()
        form = {
            'relatedItems': [self.image.UID()],
            'relatedItems_option': 'select',
    def testValidateUploadWithoutSelectAFileInARequiredField(self):
        fileupload = FakeFileUpload(filename='', file=StringIO())
        self.field.widget = UploadReferenceWidget()
        self.field.required = True
        self.field.multiValued = False
    def testSelectMultipleExistingContentProcessWidget(self):
        video = _createObjectByType('File', self.portal, id='video')
        self.field.widget = UploadReferenceWidget()
        form = {
            'relatedItems': [self.image.UID(), video.UID()],