class TestReferenceGateway(unittest.TestCase):
    def setUp(self):
        self.eg = ReferenceGateway()

    def xtest_find_by_id(self):
        reference = self.eg.find_reference_by_id(2) #@UnusedVariable
        pass
Example #2
0
class ReferenceEntryFormatter(object):
    def __init__(self, format=ReferenceFormat.BIBTEX):
        self.reference_gw = ReferenceGateway()
        self.format = format
        self.util_factory = UtilFactory()

    def format_reference(self, reference_id):
        log.debug(
            'Retrieving reference from the database')  #@UndefinedVariable
        reference = self.reference_gw.find_reference_by_id(reference_id)
        if not reference:
            log.error(
                'Reference with id %d could not be retrieved'  #@UndefinedVariable
                % reference_id)
            return None

        formatter = ReferenceFormatter()
        try:
            generator = self.util_factory.create_generator(self.format)
        except UtilCreationError as e:
            log.error('Could not create a formatter for %s: %s'
                      %  #@UndefinedVariable
                      (self.format, e.args))
            return None

        log.debug('Starting to format')  #@UndefinedVariable
        formatter.format_reference(reference, generator)

        return reference.entry
Example #3
0
class ReferenceEntryFormatter(object):
    def __init__(self, format=ReferenceFormat.BIBTEX):
        self.reference_gw = ReferenceGateway()
        self.format = format
        self.util_factory = UtilFactory()
        
    def format_reference(self, reference_id):
        log.debug('Retrieving reference from the database') #@UndefinedVariable
        reference = self.reference_gw.find_reference_by_id(reference_id)
        if not reference:
            log.error('Reference with id %d could not be retrieved'  #@UndefinedVariable
                      % reference_id)
            return None
        
        formatter = ReferenceFormatter()
        try:
            generator = self.util_factory.create_generator(self.format)
        except UtilCreationError as e:
            log.error('Could not create a formatter for %s: %s' % #@UndefinedVariable
                      (self.format, e.args))
            return None
        
        log.debug('Starting to format') #@UndefinedVariable
        formatter.format_reference(reference, generator)
        
        return reference.entry
Example #4
0
class TestReferenceGateway(unittest.TestCase):
    def setUp(self):
        self.eg = ReferenceGateway()

    def xtest_find_by_id(self):
        reference = self.eg.find_reference_by_id(2)  #@UnusedVariable
        pass