Ejemplo n.º 1
0
    def check_validations(self):
        """
            Checks for validations
        """

        for validation, message in self.validations():
            if not validation:
                exit_with_error(message)
Ejemplo n.º 2
0
    def check_validations(self):
        """
            Checks for validations
        """

        for validation, message in self.validations():
            if not validation:
                exit_with_error(message)
Ejemplo n.º 3
0
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()
Ejemplo n.º 4
0
    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")
Ejemplo n.º 5
0
    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()
Ejemplo n.º 6
0
    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()
Ejemplo n.º 7
0
    def __getitem__(self, key):

        if key in self:
            return dict.__getitem__(self, key)
        else:
            exit_with_error("No recognized database Engine")
Ejemplo n.º 8
0
    def __getitem__(self, key):

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

        if key in self:
            return dict.__getitem__(self, key)
        else:
            exit_with_error("No recognized database Engine")
Ejemplo n.º 10
0
    def __getitem__(self, key):

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