def process_class(self, cls): try: ContentModel.for_class(cls, self.repo) except ValueError, v: # for_class raises a ValueError when a class has >1 # CONTENT_MODELS. if self.verbosity > 1: print v
def process_class(self, cls): try: ContentModel.for_class(cls, self.repo) except ValueError as v: # for_class raises a ValueError when a class has >1 # CONTENT_MODELS. if self.verbosity > 1: sys.stderr.write(v) except RequestFailed as rf: if hasattr(rf, 'detail'): if 'ObjectExistsException' in rf.detail: # This shouldn't happen, since ContentModel.for_class # shouldn't attempt to ingest unless the object doesn't exist. # In some cases, Fedora seems to report that an object doesn't exist, # then complain on attempted ingest. full_name = '%s.%s' % (cls.__module__, cls.__name__) logger.warn('Fedora error (ObjectExistsException) on Content Model ingest for %s' % \ full_name) else: # if there is a detail message, display that sys.stderr.write("Error ingesting ContentModel for %s: %s" % (cls, rf.detail))
def process_class(self, cls): try: ContentModel.for_class(cls, self.repo) except ValueError as v: # for_class raises a ValueError when a class has >1 # CONTENT_MODELS. if self.verbosity > 1: sys.stderr.write(v) except RequestFailed as rf: if hasattr(rf, 'detail'): if 'ObjectExistsException' in rf.detail: # This shouldn't happen, since ContentModel.for_class # shouldn't attempt to ingest unless the object doesn't exist. # In some cases, Fedora seems to report that an object doesn't exist, # then complain on attempted ingest. full_name = '%s.%s' % (cls.__module__, cls.__name__) logger.warn('Fedora error (ObjectExistsException) on Content Model ingest for %s' % \ full_name) else: # if there is a detail message, display that sys.stderr.write( "Error ingesting ContentModel for %s: %s" % (cls, rf.detail))