예제 #1
0
파일: __init__.py 프로젝트: zmtmei/dumbo
 def configure(self):
     mrbase_class = loadclassname(os.environ['dumbo_mrbase_class'])
     mapper = self.mapper
     if type(mapper) in (types.ClassType, type):
         mappercls = type('DumboMapper', (mapper, mrbase_class), {})
         mapper = mappercls()
         if hasattr(mapper, 'map'):
             mapper = mapper.map
     if hasattr(mapper, 'configure'):
         mapper.configure()
     if hasattr(mapper, 'close'):
         self.closefunc = mapper.close
     self.mapper = mapper
예제 #2
0
파일: lib.py 프로젝트: dgleich/dumbo
 def configure(self):
     mrbase_class = loadclassname(os.environ['dumbo_mrbase_class'])
     mapper = self.mapper
     if type(mapper) in (types.ClassType, type):
         mappercls = type('DumboMapper', (mapper, mrbase_class), {})
         mapper = mappercls()
         if hasattr(mapper, 'map'):
             mapper = mapper.map
     if hasattr(mapper, 'configure'):
         mapper.configure()
     if hasattr(mapper, 'close'):
         self.closefunc = mapper.close
     self.mapper = mapper
예제 #3
0
 def configure(self):
     mrbase_class = loadclassname(os.environ['dumbo_mrbase_class'])
     mappers, closefuncs = [], []
     for pattern, mapper in self.mappers:
         if type(mapper) in (types.ClassType, type):
             mappercls = type('DumboMapper', (mapper, mrbase_class), {})
             mapper = mappercls()
             if hasattr(mappercls, 'map'):
                 mapper = mapper.map
         if hasattr(mapper, 'configure'):
             mapper.configure()
         if hasattr(mapper, 'close'):
             closefuncs.append(mapper.close)
         mappers.append((pattern, mapper))
     self.mappers = mappers
     self.closefuncs = closefuncs
예제 #4
0
파일: __init__.py 프로젝트: a4tunado/dumbo
 def configure(self):
     mrbase_class = loadclassname(os.environ['dumbo_mrbase_class'])
     mappers, closefuncs = [], []
     for pattern, mapper in self.mappers:
         if type(mapper) in (types.ClassType, type):
             mappercls = type('DumboMapper', (mapper, mrbase_class), {})
             mapper = mappercls()
             if hasattr(mappercls, 'map'):
                 mapper = mapper.map
         if hasattr(mapper, 'configure'):
             mapper.configure()
         if hasattr(mapper, 'close'):
             closefuncs.append(mapper.close)
         mappers.append((pattern, mapper))
     self.mappers = mappers
     self.closefuncs = closefuncs
예제 #5
0
 def configure(self):
     mrbase_class = loadclassname(os.environ['dumbo_mrbase_class'])
     mapper = self.mapper
     if type(mapper) in (types.ClassType, type):
         mappercls = type('DumboMapper', (mapper, mrbase_class), {})
         mapper = mappercls()
         if hasattr(mapper, 'map'):
             mapper = mapper.map
     if hasattr(mapper, 'configure'):
         mapper.configure()
     if hasattr(mapper, 'close'):
         self.closefunc = mapper.close
     mapper_call = mapper
     if isinstance(mapper_call, mrbase_class):
         mapper_call = mapper.__call__
     self.mapper = mapper
     if not inspect.getargspec(mapper_call).keywords:
         self.mapper = lambda key, value, **kwargs: mapper(key, value)
예제 #6
0
파일: __init__.py 프로젝트: a4tunado/dumbo
 def configure(self):
     mrbase_class = loadclassname(os.environ['dumbo_mrbase_class'])
     mapper = self.mapper
     if type(mapper) in (types.ClassType, type):
         mappercls = type('DumboMapper', (mapper, mrbase_class), {})
         mapper = mappercls()
         if hasattr(mapper, 'map'):
             mapper = mapper.map
     if hasattr(mapper, 'configure'):
         mapper.configure()
     if hasattr(mapper, 'close'):
         self.closefunc = mapper.close
     mapper_call = mapper
     if isinstance(mapper_call, mrbase_class):
         mapper_call = mapper.__call__
     self.mapper = mapper
     if not inspect.getargspec(mapper_call).keywords:
         self.mapper = lambda key, value, **kwargs: mapper(key, value)