Beispiel #1
0
    """dublin core edit (inplace)
    """
    obj.setTitle('Test title')
    obj.setDescription('Test description')
    obj.setSubject('Test subject')
    obj.setContributors(('test user a', ))
    obj.setEffectiveDate(DateTime() - 1)
    obj.setExpirationDate(DateTime() + 2)
    obj.setFormat('text/structured')
    obj.setLanguage('de')
    obj.setRights('GPL')


from Products.validation import ValidationChain
EmptyValidator = ValidationChain('isEmpty')
EmptyValidator.appendSufficient('isEmpty')
idValidator = ValidationChain('isValidId')
idValidator.appendSufficient('isEmptyNoError')
idValidator.appendRequired('isValidId')
TidyHTMLValidator = ValidationChain('isTidyHtmlChain')
TidyHTMLValidator.appendRequired('isTidyHtmlWithCleanup')
NotRequiredTidyHTMLValidator = ValidationChain('isTidyHtmlNotRequiredChain')
NotRequiredTidyHTMLValidator.appendSufficient('isEmptyNoError')
NotRequiredTidyHTMLValidator.appendRequired('isTidyHtmlWithCleanup')
URLValidator = ValidationChain('isURL')
URLValidator.appendSufficient('isEmptyNoError')
URLValidator.appendRequired('isURL')
EmailValidator = ValidationChain('isEmailChain')
EmailValidator.appendSufficient('isEmptyNoError')
EmailValidator.appendSufficient('isMailto')
EmailValidator.appendRequired('isEmail')
Beispiel #2
0
from Products.Archetypes.tests.test_classgen import Dummy

from Products.Archetypes import atapi
from Products.Archetypes.config import PKG_NAME, LANGUAGE_DEFAULT
from Products.Archetypes.interfaces.layer import ILayerContainer
from Products.CMFCore import permissions
from Products.Archetypes.ExtensibleMetadata import FLOOR_DATE
from Products.Archetypes.ExtensibleMetadata import CEILING_DATE
from Products.validation import ValidationChain

from DateTime import DateTime

Dummy.schema = atapi.BaseSchema

EmptyValidator = ValidationChain('isEmpty')
EmptyValidator.appendSufficient('isEmpty')


class BaseSchemaTest(ATSiteTestCase):
    def afterSetUp(self):
        ATSiteTestCase.afterSetUp(self)
        atapi.registerType(Dummy, 'Archetypes')
        content_types, constructors, ftis = atapi.process_types(
            atapi.listTypes(), PKG_NAME)
        portal = self.portal
        dummy = Dummy(oid='dummy')
        # put dummy in context of portal
        dummy = dummy.__of__(portal)
        portal.dummy = dummy

        dummy.initializeArchetype()
Beispiel #3
0
from Products.Archetypes.tests.test_classgen import Dummy

from Products.Archetypes import atapi
from Products.Archetypes.config import PKG_NAME, LANGUAGE_DEFAULT
from Products.Archetypes.interfaces.layer import ILayerContainer
from Products.CMFCore import permissions
from Products.Archetypes.ExtensibleMetadata import FLOOR_DATE
from Products.Archetypes.ExtensibleMetadata import CEILING_DATE
from Products.validation import ValidationChain

from DateTime import DateTime

Dummy.schema = atapi.BaseSchema

EmptyValidator = ValidationChain('isEmpty')
EmptyValidator.appendSufficient('isEmpty')


class BaseSchemaTest(ATSiteTestCase):

    def afterSetUp(self):
        ATSiteTestCase.afterSetUp(self)
        atapi.registerType(Dummy, 'Archetypes')
        content_types, constructors, ftis = atapi.process_types(atapi.listTypes(), PKG_NAME)
        portal = self.portal
        dummy = Dummy(oid='dummy')
        # put dummy in context of portal
        dummy = dummy.__of__(portal)
        portal.dummy = dummy

        dummy.initializeArchetype()
Beispiel #4
0
def dcEdit(obj):
    """dublin core edit (inplace)
    """
    obj.setTitle('Test title')
    obj.setDescription('Test description')
    obj.setSubject('Test subject')
    obj.setContributors(('test user a',))
    obj.setEffectiveDate(DateTime() - 1)
    obj.setExpirationDate(DateTime() + 2)
    obj.setFormat('text/structured')
    obj.setLanguage('de')
    obj.setRights('GPL')

from Products.validation import ValidationChain
EmptyValidator = ValidationChain('isEmpty')
EmptyValidator.appendSufficient('isEmpty')
idValidator = ValidationChain('isValidId')
idValidator.appendSufficient('isEmptyNoError')
idValidator.appendRequired('isValidId')
TidyHTMLValidator = ValidationChain('isTidyHtmlChain')
TidyHTMLValidator.appendRequired('isTidyHtmlWithCleanup')
NotRequiredTidyHTMLValidator = ValidationChain('isTidyHtmlNotRequiredChain')
NotRequiredTidyHTMLValidator.appendSufficient('isEmptyNoError')
NotRequiredTidyHTMLValidator.appendRequired('isTidyHtmlWithCleanup')
URLValidator = ValidationChain('isURL')
URLValidator.appendSufficient('isEmptyNoError')
URLValidator.appendRequired('isURL')
EmailValidator = ValidationChain('isEmailChain')
EmailValidator.appendSufficient('isEmptyNoError')
EmailValidator.appendSufficient('isMailto')
EmailValidator.appendRequired('isEmail')