예제 #1
0
파일: command.py 프로젝트: aparo/crawley
    def check_validations(self):
        """
            Checks for validations
        """

        for validation, message in self.validations():
            if not validation:
                exit_with_error(message)
예제 #2
0
파일: command.py 프로젝트: cmcc/crawley
    def check_validations(self):
        """
            Checks for validations
        """

        for validation, message in self.validations():
            if not validation:
                exit_with_error(message)
예제 #3
0
파일: __init__.py 프로젝트: wgfi110/crawley
def run_cmd(args):
    """
        Runs a crawley's command
    """

    if len(args) <= 1:
        exit_with_error("Subcommand not specified")

    cmd_name = args[1]
    cmd_args = args[2:]

    cmd = commands[cmd_name](cmd_args)
    cmd.checked_execute()
예제 #4
0
파일: command.py 프로젝트: aparo/crawley
    def _check_project_type(self):
        """
            Check for the project's type [code based project
            or dsl templates based project]
        """

        if check_for_file(self.settings, "config.ini") and check_for_file(self.settings, "template.crw"):
            self.project_type = TemplateProject()

        elif import_user_module("models", exit=False) is not None:
            self.project_type = CodeProject()

        else:
            exit_with_error("Unrecognized crawley project")
예제 #5
0
파일: shell.py 프로젝트: thebennos/crawley
    def execute(self):

        try:
            import IPython
        except ImportError:
            exit_with_error("Please install the ipython console")

        url = self.args[0]
        crawler = BaseCrawler()

        response = crawler._get_data(url)
        html = XPathExtractor().get_object(response)

        shell = IPython.Shell.IPShellEmbed(argv=[], user_ns={ 'response' : response })
        shell()
예제 #6
0
파일: shell.py 프로젝트: wgfi110/crawley
    def execute(self):

        try:
            import IPython
        except ImportError:
            exit_with_error("Please install the ipython console")

        url = self.args[0]
        crawler = BaseCrawler()

        response = crawler._get_response(url)
        html = XPathExtractor().get_object(response)

        shell = IPython.Shell.IPShellEmbed(argv=[],
                                           user_ns={'response': response})
        shell()
예제 #7
0
파일: connectors.py 프로젝트: 4iji/crawley
    def __getitem__(self, key):

        if key in self:
            return dict.__getitem__(self, key)
        else:
            exit_with_error("No recognized database Engine")
예제 #8
0
파일: __init__.py 프로젝트: 4iji/crawley
    def __getitem__(self, key):

        if key in self:
            return dict.__getitem__(self, key)
        else:
            exit_with_error("[%s] Subcommand not valid" % (key))
예제 #9
0
    def __getitem__(self, key):

        if key in self:
            return dict.__getitem__(self, key)
        else:
            exit_with_error("No recognized database Engine")
예제 #10
0
    def __getitem__(self, key):

        if key in self:
            return dict.__getitem__(self, key)
        else:
            exit_with_error("[%s] Subcommand not valid" % (key))