Exemplo n.º 1
0
    def __get_statuses(self):
        try: #If we are properly configured, try to get statuses
            self.token()
        except cfg.IdliMissingConfigException:
            pass

        try:
            if float(cfg.get_config_value(self.config_section, "last_status_list_time")) + self.STATUS_CHECK_INTERVAL > time.time():
                idli.set_status_mapping(json.loads(cfg.get_config_value(self.config_section, "last_status_list")))
                return
        except cfg.IdliMissingConfigException:
            pass
        try:
            result = json.loads(self.__url_request("/issue_statuses.json"))
            statuses_list = result['issue_statuses']
            statuses = {}
            for s in statuses_list:
                statuses[s['name'].lower()] = not ('is_closed' in s and s['is_closed'])
            cfg.set_config_value(self.config_section, "last_status_list", json.dumps(statuses), global_val=False)
            cfg.set_config_value(self.config_section, "last_status_list_time", str(time.time()))
            idli.set_status_mapping(statuses)
        except HttpRequestException as e:
            mapping = { 'New' : True, 'Closed' : False, 'In Progress' : True, 'Rejected' : False, 'Resolved' : False, 'Feedback' : True }
            cfg.set_config_value(self.config_section, "last_status_list", json.dumps(mapping), global_val=False)
            cfg.set_config_value(self.config_section, "last_status_list_time", float(time.time()), global_val=False)
            idli.set_status_mapping(mapping)
        except cfg.IdliMissingConfigException:
            pass
Exemplo n.º 2
0
def get_backend_or_fail(backend_name = None):
    try:
        backend_name = backend_name or cfg.get_config_value("project", "type").lower()
        return backend_list[backend_name]
    except cfg.IdliMissingConfigException as e:
        print("Could not find idli configuration file. Run 'idli init' in the project root directory.")
        sys.exit(0)
    except KeyError as e:
        print("No such backend '" + cfg.get_config_value("project", "type") + ". Check the configuration file " + cfg.local_config_filename() + " for errors.")
        sys.exit(0)
    except Exception as e:
        print("Failed: " + str(e))
        sys.exit(0)
Exemplo n.º 3
0
def get_backend_or_fail(backend_name = None):
    try:
        backend_name = backend_name or cfg.get_config_value("project", "type").lower()
        return backend_list[backend_name]
    except cfg.IdliMissingConfigException as e:
        print("Could not find idli configuration file. Run 'idli init' in the project root directory.")
        sys.exit(0)
    except KeyError as e:
        print("No such backend '" + cfg.get_config_value("project", "type") + ". Check the configuration file " + cfg.local_config_filename() + " for errors.")
        sys.exit(0)
    except Exception as e:
        print("Failed: " + str(e))
        sys.exit(0)
Exemplo n.º 4
0
def get_backend_or_fail(backend_name = None):
    try:
        backend_name = backend_name or cfg.get_config_value("project", "type").lower()
        return backend_list[backend_name]
    except cfg.IdliMissingConfigException, e:
        print "Could not find idli configuration file. Run 'idli init' in the project root directory."
        sys.exit(0)
Exemplo n.º 5
0
def get_backend_or_fail(backend_name=None):
    try:
        backend_name = backend_name or cfg.get_config_value("project",
                                                            "type").lower()
        return backend_list[backend_name]
    except cfg.IdliMissingConfigException, e:
        print "Could not find idli configuration file. Run 'idli init' in the project root directory."
        sys.exit(0)
Exemplo n.º 6
0
Arquivo: trac.py Projeto: dionimf/Idli
def __http_protocol():
    try:
        use_https = cfg.get_config_value(CONFIG_SECTION, "use_https")
        if (use_https.lower() == "true"):
            return "https://"
        else:
            return "http://"
    except IdliMissingConfigException, e:
        return "http://"
Exemplo n.º 7
0
def __http_protocol():
    try:
        use_https = cfg.get_config_value(CONFIG_SECTION, "use_https")
        if (use_https.lower() == "true"):
            return "https://"
        else:
            return "http://"
    except IdliMissingConfigException as e:
        return "http://"
Exemplo n.º 8
0
Arquivo: trac.py Projeto: dionimf/Idli
def trac_server_url():
    return __http_protocol() + cfg.get_config_value(CONFIG_SECTION, "server")+"/"+cfg.get_config_value(CONFIG_SECTION, "path")
Exemplo n.º 9
0
def trac_xml_url():
    return __http_protocol() + cfg.get_config_value(
        CONFIG_SECTION, "user") + ":" + cfg.get_config_value(
            CONFIG_SECTION, "password") + "@" + cfg.get_config_value(
                CONFIG_SECTION, "server") + "/" + cfg.get_config_value(
                    CONFIG_SECTION, "path") + trac_suffix_url
Exemplo n.º 10
0
def trac_server_url():
    return __http_protocol() + cfg.get_config_value(
        CONFIG_SECTION, "server") + "/" + cfg.get_config_value(
            CONFIG_SECTION, "path")
Exemplo n.º 11
0
def trac_server_url():
    return "http://" + cfg.get_config_value(CONFIG_SECTION, "server")+"/"+cfg.get_config_value(CONFIG_SECTION, "path")
Exemplo n.º 12
0
def trac_server_url():
    return "http://" + cfg.get_config_value(
        CONFIG_SECTION, "server") + "/" + cfg.get_config_value(
            CONFIG_SECTION, "path")
Exemplo n.º 13
0
 def get_config(self, name):
     import idli.config as cfg
     return cfg.get_config_value(self.config_section, name)
Exemplo n.º 14
0
Arquivo: trac.py Projeto: dionimf/Idli
def trac_xml_url():
    return __http_protocol()+cfg.get_config_value(CONFIG_SECTION, "user")+":"+cfg.get_config_value(CONFIG_SECTION, "password")+"@"+cfg.get_config_value(CONFIG_SECTION, "server")+"/"+cfg.get_config_value(CONFIG_SECTION, "path")+trac_suffix_url
Exemplo n.º 15
0
    __add_items_to_parser(backend.init_names, init_parser)

    backend_list[backend.name] = backend

def __add_items_to_parser(items, parser):
    if items.__class__ == dict:
        for (cmd, help) in items.iteritems():
            parser.add_argument(cmd, help=help)
    if items.__class__ == list:
        for (cmd, help) in items:
            parser.add_argument(cmd, help=help)


def get_backend_or_fail(backend_name = None):
    try:
        backend_name = backend_name or cfg.get_config_value("project", "type").lower()
        return backend_list[backend_name]
    except cfg.IdliMissingConfigException, e:
        print "Could not find idli configuration file. Run 'idli init' in the project root directory."
        sys.exit(0)
    except KeyError, e:
        print "No such backend '" + cfg.get_config_value("project", "type") + ". Check the configuration file " + cfg.local_config_filename() + " for errors."
        sys.exit(0)
    except Exception, e:
        print "Failed: " + str(e)
        sys.exit(0)

register_backend(github.GithubBackend)
register_backend(trac.TracBackend)
register_backend(redmine.RedmineBackend)
Exemplo n.º 16
0
 def get_config(self, name):
     import idli.config as cfg
     return cfg.get_config_value(self.config_section, name)
Exemplo n.º 17
0
    if items.__class__ == dict:
        for (cmd, help) in items.iteritems():
            parser.add_argument(cmd, help=help)
    if items.__class__ == list:
        for (cmd, help) in items:
            parser.add_argument(cmd, help=help)


def get_backend_or_fail(backend_name=None):
    try:
        backend_name = backend_name or cfg.get_config_value("project",
                                                            "type").lower()
        return backend_list[backend_name]
    except cfg.IdliMissingConfigException, e:
        print "Could not find idli configuration file. Run 'idli init' in the project root directory."
        sys.exit(0)
    except KeyError, e:
        print "No such backend '" + cfg.get_config_value(
            "project", "type"
        ) + ". Check the configuration file " + cfg.local_config_filename(
        ) + " for errors."
        sys.exit(0)
    except Exception, e:
        print "Failed: " + str(e)
        sys.exit(0)


register_backend(github.GithubBackend)
register_backend(trac.TracBackend)
register_backend(redmine.RedmineBackend)