publisher/management/commands/publish_model.py
def get_model(self, model_name):
        """
        TODO: Need to validate model name has 2x '.' chars
        """
        klass = None
        try:
            module_name, class_name = model_name.rsplit('.', 1)
            mod = __import__(module_name, fromlist=[class_name])
            klass = getattr(mod, class_name)
        except ImportError, e:
            self.error('Cannot find app %s %s' % (model_name, e))

        return klass
def get_model(self, model_name):
        """
        TODO: Need to validate model name has 2x '.' chars
        """
        klass = None
        try:
            module_name, class_name = model_name.rsplit('.', 1)
            mod = __import__(module_name, fromlist=[class_name])
            klass = getattr(mod, class_name)
        except ImportError, e:
            self.error('Cannot find app %s %s' % (model_name, e))

        return klass
def get_model ( self , model_name ) : klass = None try : module_name , class_name = model_name . rsplit ( '.' , 1 ) mod = __import__ ( module_name , fromlist = [ class_name ] ) klass = getattr ( mod , class_name ) except ImportError , e : self . error ( 'Cannot find app %s %s' % ( model_name , e ) ) return klass
TODO: Need to validate model name has 2x '.' chars
TODO : Need to validate model name has 2x . chars