Exemple #1
0
 def test_tuplize(self):
     assert (tuplize('string', 'one two three') == ('one', 'two', 'three'))
     assert (tuplize('string', 'one,two,three',
                     comma_split) == ('one', 'two', 'three'))
     assert (tuplize('list', ['one', ' two', 'three ']) == ('one', ' two',
                                                            'three '))
     assert (tuplize('tuple',
                     ('one', 'two', 'three')) == ('one', 'two', 'three'))
Exemple #2
0
    def test_tuplize(self):
        wanted = ('one', 'two', 'three')

        self.assertEqual(tuplize('string', 'one two three'), wanted)
        self.assertEqual(tuplize('unicode', u'one two three'), wanted)
        self.assertEqual(tuplize('string', 'one,two,three', comma_split),
                         wanted)
        self.assertEqual(tuplize('list', ['one', ' two', 'three ']), wanted)
        self.assertEqual(tuplize('tuple', ('one', 'two', 'three')), wanted)
Exemple #3
0
    def test_tuplize(self):
        wanted = ('one','two','three')

        self.assertEqual( tuplize('string', 'one two three'), wanted )
        self.assertEqual( tuplize('unicode', u'one two three'), wanted )
        self.assertEqual( tuplize('string', 'one,two,three', comma_split),
                          wanted )
        self.assertEqual( tuplize('list', ['one',' two','three ']), wanted )
        self.assertEqual( tuplize('tuple', ('one','two','three')), wanted )
Exemple #4
0
    def test_tuplize(self):
        from Products.CMFDefault.utils import comma_split
        from Products.CMFDefault.utils import tuplize
        wanted = ('one', 'two', 'three')

        self.assertEqual(tuplize('string', 'one two three'), wanted)
        self.assertEqual(tuplize('unicode', u'one two three'), wanted)
        self.assertEqual(tuplize('string', 'one,two,three', comma_split),
                         wanted)
        self.assertEqual(tuplize('list', ['one', ' two', 'three ']), wanted)
        self.assertEqual(tuplize('tuple', ('one', 'two', 'three')), wanted)
Exemple #5
0
    def test_tuplize(self):
        from Products.CMFDefault.utils import comma_split
        from Products.CMFDefault.utils import tuplize
        wanted = ('one','two','three')

        self.assertEqual( tuplize('string', 'one two three'), wanted )
        self.assertEqual( tuplize('unicode', u'one two three'), wanted )
        self.assertEqual( tuplize('string', 'one,two,three', comma_split),
                          wanted )
        self.assertEqual( tuplize('list', ['one',' two','three ']), wanted )
        self.assertEqual( tuplize('tuple', ('one','two','three')), wanted )
Exemple #6
0
 def setSubject(self, subject):
     subject = tuplize('subject', subject)
     s = []
     for part in subject:
         if isinstance(part, str):
             part = part.decode('utf-8')
         s.append(part)
     self.subject = tuple(s)
Exemple #7
0
 def setCreators(self, creators):
     creators = tuplize('creators', creators)
     s = []
     for part in creators:
         if isinstance(part, str):
             part = part.decode('utf-8')
         s.append(part)
     self.creators = tuple(s)
Exemple #8
0
 def setSubject(self, subject):
     subject = tuplize('subject', subject)
     s = []
     for part in subject:
         if isinstance(part, str):
             part = part.decode('utf-8')
         s.append(part)
     self.subject = tuple(s)
Exemple #9
0
 def setSubject( self, subject ):
     """ Set Dublin Core Subject element - resource keywords.
     """
     self.subject = tuplize( 'subject', subject )
Exemple #10
0
 def setCreators(self, creators):
     """ Set Dublin Core Creator elements - resource authors.
     """
     self.creators = tuplize('creators', creators)
Exemple #11
0
 def test_tuplize( self ):
     assert( tuplize('string', 'one two three') == ('one','two','three'))
     assert( tuplize('string', 'one,two,three', comma_split) == ('one','two','three'))
     assert( tuplize('list', ['one',' two','three ']) == ('one',' two','three '))
     assert( tuplize('tuple', ('one','two','three')) == ('one','two','three'))
Exemple #12
0
 def setVersions(self, versions):
     """OMF version elements."""
     self.versions = tuplize('versions', versions, semi_split)
Exemple #13
0
 def setCoverages(self, coverages):
     """OMF coverage elements."""
     self.coverages = tuplize('coverages', coverages, semi_split)
Exemple #14
0
 def setAuthors(self, authors):
     """OMF creator elements."""
     self.authors = tuplize('authors', authors, semi_split)
Exemple #15
0
 def setSources(self, sources):
     """OMF source elements."""
     self.sources = tuplize('sources', sources, semi_split)
Exemple #16
0
 def setIdentifiers(self, identifiers):
     """OMF identifier elements."""
     self.identifiers = tuplize('identifiers', identifiers, semi_split)
Exemple #17
0
 def setFormats(self, formats):
     """OMF format elements."""
     self.formats = tuplize('formats', formats, semi_split)
Exemple #18
0
 def setTypes(self, types):
     """OMF type elements."""
     self.types = tuplize('types', types, semi_split)
Exemple #19
0
 def setContributors( self, contributors ):
     """ Set Dublin Core Contributor elements - resource collaborators.
     """
     # XXX: fixme
     self.contributors = tuplize('contributors', contributors, semi_split)
Exemple #20
0
 def setRelations(self, relations):
     """OMF relation elements."""
     self.relations = tuplize('relations', relations, semi_split)
Exemple #21
0
 def setMaintainers(self, maintainers):
     """OMF maintainer elements."""
     self.maintainers = tuplize('maintainers', maintainers, semi_split)