Ejemplo n.º 1
0
    def setMetadata(self, headers):
        """ Set an Event's metadata

        o headers is a mapping containing keys corresponding to
        Dublin Core metadata fields
        o Only those attributes that are passed in with the mapping are
        manipulated
        """
        headers['Format'] = self.Format()
        new_subject = keywordsplitter(headers)
        headers['Subject'] = new_subject or self.Subject()
        new_contrib = contributorsplitter(headers)
        headers['Contributors'] = new_contrib or self.Contributors()
        haveheader = headers.has_key
        for key, value in self.getMetadataHeaders():
            if not haveheader(key):
                headers[key] = value
        self._editMetadata(title=headers['Title'],
                          subject=headers['Subject'],
                          contributors=headers['Contributors'],
                          effective_date=headers['Effective_date'],
                          expiration_date=headers['Expiration_date'],
                          format=headers['Format'],
                          language=headers['Language'],
                          rights=headers['Rights'],
                          )
Ejemplo n.º 2
0
    def setMetadata(self, headers):
        """ Set an Event's metadata

        o headers is a mapping containing keys corresponding to
        Dublin Core metadata fields
        o Only those attributes that are passed in with the mapping are
        manipulated
        """
        headers['Format'] = self.Format()
        new_subject = keywordsplitter(headers)
        headers['Subject'] = new_subject or self.Subject()
        new_contrib = contributorsplitter(headers)
        headers['Contributors'] = new_contrib or self.Contributors()
        haveheader = headers.has_key
        for key, value in self.getMetadataHeaders():
            if not haveheader(key):
                headers[key] = value
        self._editMetadata(
            title=headers['Title'],
            subject=headers['Subject'],
            description=headers['Description'],
            contributors=headers['Contributors'],
            effective_date=headers['Effective_date'],
            expiration_date=headers['Expiration_date'],
            format=headers['Format'],
            language=headers['Language'],
            rights=headers['Rights'],
        )
Ejemplo n.º 3
0
 def test_contributorsplitter_multi(self):
     for x in [ 'foo; bar; baz'
              , 'foo; bar ; baz'
              , 'foo; bar;; baz'
              ]:
         self.assertEqual( contributorsplitter({'Contributors': x}), 
                           ['foo', 'bar', 'baz'] )
Ejemplo n.º 4
0
    def _writeFromPUT(self, body):
        headers = {}
        headers, body = parseHeadersBody(body, headers)
        lines = body.split('\n')
        self.edit(lines[0])
        headers['Format'] = self.URL_FORMAT
        new_subject = keywordsplitter(headers)
        headers['Subject'] = new_subject or self.Subject()
        new_contrib = contributorsplitter(headers)
        headers['Contributors'] = new_contrib or self.Contributors()
        haveheader = headers.has_key
        for key, value in self.getMetadataHeaders():
            if not haveheader(key):
                headers[key] = value

        self._editMetadata(
            title=headers['Title'],
            subject=headers['Subject'],
            description=headers['Description'],
            contributors=headers['Contributors'],
            effective_date=headers['Effective_date'],
            expiration_date=headers['Expiration_date'],
            format=headers['Format'],
            language=headers['Language'],
            rights=headers['Rights'],
        )
Ejemplo n.º 5
0
 def test_contributorsplitter_multi(self):
     for x in [ 'foo; bar; baz'
              , 'foo; bar ; baz'
              , 'foo; bar;; baz'
              ]:
         self.assertEqual( contributorsplitter({'Contributors': x}), 
                           ['foo', 'bar', 'baz'] )
Ejemplo n.º 6
0
Archivo: Link.py Proyecto: goschtl/zope
    def _writeFromPUT( self, body ):
        headers = {}
        headers, body = parseHeadersBody(body, headers)
        lines = body.split('\n')
        self.edit( lines[0] )
        headers['Format'] = self.URL_FORMAT
        new_subject = keywordsplitter(headers)
        headers['Subject'] = new_subject or self.Subject()
        new_contrib = contributorsplitter(headers)
        headers['Contributors'] = new_contrib or self.Contributors()
        haveheader = headers.has_key
        for key, value in self.getMetadataHeaders():
            if not haveheader(key):
                headers[key] = value

        self._editMetadata(title=headers['Title'],
                          subject=headers['Subject'],
                          description=headers['Description'],
                          contributors=headers['Contributors'],
                          effective_date=headers['Effective_date'],
                          expiration_date=headers['Expiration_date'],
                          format=headers['Format'],
                          language=headers['Language'],
                          rights=headers['Rights'],
                          )
Ejemplo n.º 7
0
    def test_contributorsplitter_multi(self):
        from Products.CMFCore.utils import contributorsplitter

        for x in [ 'foo; bar; baz'
                 , 'foo; bar ; baz'
                 , 'foo; bar;; baz'
                 ]:
            self.assertEqual( contributorsplitter({'Contributors': x}), 
                              ['foo', 'bar', 'baz'] )
Ejemplo n.º 8
0
    def test_contributorsplitter_multi(self):
        from Products.CMFCore.utils import contributorsplitter

        for x in [ 'foo; bar; baz'
                 , 'foo; bar ; baz'
                 , 'foo; bar;; baz'
                 ]:
            self.assertEqual( contributorsplitter({'Contributors': x}), 
                              ['foo', 'bar', 'baz'] )
Ejemplo n.º 9
0
 def _writeFromPUT(self, body):
     headers, body = parseHeadersBody(body)
     lines = body.split('\n')
     self.edit(lines[0])
     headers['Format'] = self.URL_FORMAT
     new_subject = keywordsplitter(headers)
     headers['Subject'] = new_subject or self.Subject()
     new_contrib = contributorsplitter(headers)
     headers['Contributors'] = new_contrib or self.Contributors()
     headers = dict((k.lower(), v) for k, v in headers.iteritems())
     self._editMetadata(**headers)
Ejemplo n.º 10
0
 def setMetadata(self, headers):
     headers['Format'] = self.Format()
     new_subject = keywordsplitter(headers)
     headers['Subject'] = new_subject or self.Subject()
     new_contrib = contributorsplitter(headers)
     headers['Contributors'] = new_contrib or self.Contributors()
     haveheader = headers.has_key
     for key, value in self.getMetadataHeaders():
         if not haveheader(key):
             headers[key] = value
     self._editMetadata(title=headers['Title'],
                       subject=headers['Subject'],
                       contributors=headers['Contributors'],
                       effective_date=headers['Effective_date'],
                       expiration_date=headers['Expiration_date'],
                       format=headers['Format'],
                       language=headers['Language'],
                       rights=headers['Rights'],
                       )
Ejemplo n.º 11
0
    def test_contributorsplitter_single(self):
        from Products.CMFCore.utils import contributorsplitter

        for x in ['foo', ' foo ', 'foo;', 'foo ;;']:
            self.assertEqual(contributorsplitter({'Contributors': x}), ['foo'])
Ejemplo n.º 12
0
    def test_contributorsplitter_emtpy(self):
        from Products.CMFCore.utils import contributorsplitter

        for x in ['', ' ', ';', ';;']:
            self.assertEqual(contributorsplitter({'Contributors': x}), [])
Ejemplo n.º 13
0
 def test_contributorsplitter_single(self):
     for x in [ 'foo', ' foo ', 'foo;', 'foo ;;' ]:
         self.assertEqual( contributorsplitter({'Contributors': x}), 
                           ['foo'] )
Ejemplo n.º 14
0
 def test_contributorsplitter_emtpy(self):
     for x in [ '', ' ', ';', ';;' ]:
         self.assertEqual( contributorsplitter({'Contributors': x}), 
                           [] )
Ejemplo n.º 15
0
    def test_contributorsplitter_single(self):
        from Products.CMFCore.utils import contributorsplitter

        for x in [ 'foo', ' foo ', 'foo;', 'foo ;;' ]:
            self.assertEqual( contributorsplitter({'Contributors': x}), 
                              ['foo'] )
Ejemplo n.º 16
0
    def test_contributorsplitter_emtpy(self):
        from Products.CMFCore.utils import contributorsplitter

        for x in [ '', ' ', ';', ';;' ]:
            self.assertEqual( contributorsplitter({'Contributors': x}), 
                              [] )
Ejemplo n.º 17
0
 def test_contributorsplitter_emtpy(self):
     for x in [ '', ' ', ';', ';;' ]:
         self.assertEqual( contributorsplitter({'Contributors': x}), 
                           [] )
Ejemplo n.º 18
0
 def test_contributorsplitter_single(self):
     for x in [ 'foo', ' foo ', 'foo;', 'foo ;;' ]:
         self.assertEqual( contributorsplitter({'Contributors': x}), 
                           ['foo'] )