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'], )
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'], )
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'] )
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'], )
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'] )
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'], )
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'] )
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'] )
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)
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'], )
def test_contributorsplitter_single(self): from Products.CMFCore.utils import contributorsplitter for x in ['foo', ' foo ', 'foo;', 'foo ;;']: self.assertEqual(contributorsplitter({'Contributors': x}), ['foo'])
def test_contributorsplitter_emtpy(self): from Products.CMFCore.utils import contributorsplitter for x in ['', ' ', ';', ';;']: self.assertEqual(contributorsplitter({'Contributors': x}), [])
def test_contributorsplitter_single(self): for x in [ 'foo', ' foo ', 'foo;', 'foo ;;' ]: self.assertEqual( contributorsplitter({'Contributors': x}), ['foo'] )
def test_contributorsplitter_emtpy(self): for x in [ '', ' ', ';', ';;' ]: self.assertEqual( contributorsplitter({'Contributors': x}), [] )
def test_contributorsplitter_single(self): from Products.CMFCore.utils import contributorsplitter for x in [ 'foo', ' foo ', 'foo;', 'foo ;;' ]: self.assertEqual( contributorsplitter({'Contributors': x}), ['foo'] )
def test_contributorsplitter_emtpy(self): from Products.CMFCore.utils import contributorsplitter for x in [ '', ' ', ';', ';;' ]: self.assertEqual( contributorsplitter({'Contributors': x}), [] )
def test_contributorsplitter_emtpy(self): for x in [ '', ' ', ';', ';;' ]: self.assertEqual( contributorsplitter({'Contributors': x}), [] )
def test_contributorsplitter_single(self): for x in [ 'foo', ' foo ', 'foo;', 'foo ;;' ]: self.assertEqual( contributorsplitter({'Contributors': x}), ['foo'] )