Esempio n. 1
0
 def __wrapped(*args, **kwargs):
     try:
         return func(*args, **kwargs)
     except socket.gaierror as e:
         raise idli.IdliException(
             "Error connecting to trac server " + trac_server_url() +
             ".\nCheck your config file and make sure the path is correct: "
             + cfg.local_config_filename() + ".\n\n" + str(e))
     except socket.error as e:
         raise idli.IdliException(
             "Error connecting to trac server " + trac_server_url() +
             ".\nCheck your config file and make sure the path is correct: "
             + cfg.local_config_filename() + ".\n\n" + str(e))
     except xmlrpc.client.Fault as e:
         if e.faultCode == 403:
             raise idli.IdliException(
                 "Trac's permissions are not set correctly. Run\n $ trac-admin TRACDIR permission add authenticated XML_RPC\nto enable XML_RPC permissions (which are required by idli)."
             )
         else:
             raise idli.IdliException(
                 "Error connecting to trac server " + trac_server_url() +
                 ".\nCheck your config file and make sure the path is correct: "
                 + cfg.local_config_filename() + ".\n\n" + str(e))
     except xmlrpc.client.ProtocolError as e:
         raise idli.IdliException(
             "Protocol error. This probably means that the XmlRpc plugin for trac is not enabled. Follow the inunicodeuctions here to install it:\nhttp://trac-hacks.org/wiki/XmlRpcPlugin\n\n"
             + str(e))
Esempio n. 2
0
 def wrapped_func(self, *args, **kwargs):
     try:
         return func(self, *args, **kwargs)
     except HttpRequestException as e:
         if (e.status_code == 401):
             raise idli.IdliException(
                 "Authentication failed.\n\nCheck your idli configuration. The most likely cause is incorrect values for 'user' or 'password' variables in the [Bitbucket] section of the configuration files:\n    "
                 + cfg.local_config_filename() + "\n    " +
                 cfg.global_config_filename() +
                 ".\n\nMake sure you check both files - the values in " +
                 cfg.local_config_filename() +
                 " will override the values in " +
                 cfg.global_config_filename() + "." + "\n\n" + str(e))
         if (e.status_code == 404):
             self.validate()
         raise e
Esempio n. 3
0
 def initialize(self):
     section_name = self.config_section or self.name
     print "Initializing " + self.name + " project."
     import idli.config as cfg
     for (name, help) in self.init_names:
         cfg.set_config_value(section_name, name, self.args.__dict__[name], global_val=False)
     cfg.set_config_value("project", "type", self.name, global_val=False)
     print "Wrote configuration to " + cfg.local_config_filename()
Esempio n. 4
0
 def __wrapped(*args, **kwargs):
     try:
         return func(*args, **kwargs)
     except socket.gaierror, e:
         raise idli.IdliException(
             "Error connecting to trac server " + trac_server_url() +
             ".\nCheck your config file and make sure the path is correct: "
             + cfg.local_config_filename() + ".\n\n" + unicode(e))
Esempio n. 5
0
 def initialize(self):
     section_name = self.config_section or self.name
     print "Initializing " + self.name + " project."
     import idli.config as cfg
     for (name, help) in self.init_names:
         cfg.set_config_value(section_name,
                              name,
                              self.args.__dict__[name],
                              global_val=False)
     cfg.set_config_value("project", "type", self.name, global_val=False)
     print "Wrote configuration to " + cfg.local_config_filename()
Esempio n. 6
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)
Esempio n. 7
0
 def run(self):
     self.backend.initialize()
     print "Configuration written to " + config.local_config_filename()
Esempio n. 8
0
 def wrapped_func(self, *args, **kwargs):
     try:
         return func(self, *args, **kwargs)
     except HttpRequestException as e:
         if (e.status_code == 401):
             raise idli.IdliException("Authentication failed.\n\nCheck your idli configuration. The most likely cause is incorrect values for 'user' or 'password' variables in the [Bitbucket] section of the configuration files:\n    " + cfg.local_config_filename() + "\n    " + cfg.global_config_filename() + ".\n\nMake sure you check both files - the values in " + cfg.local_config_filename() + " will override the values in " + cfg.global_config_filename() + "." + "\n\n" + str(e))
         if (e.status_code == 404):
             self.validate()
         raise e
Esempio n. 9
0
File: trac.py Progetto: dionimf/Idli
 def __wrapped(*args, **kwargs):
     try:
         return func(*args, **kwargs)
     except socket.gaierror, e:
         raise idli.IdliException("Error connecting to trac server " + trac_server_url() + ".\nCheck your config file and make sure the path is correct: " + cfg.local_config_filename() + ".\n\n" + unicode(e))
Esempio n. 10
0
File: trac.py Progetto: dionimf/Idli
CONFIG_SECTION = "Trac"

def catch_socket_errors(func):
    def __wrapped(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except socket.gaierror, e:
            raise idli.IdliException("Error connecting to trac server " + trac_server_url() + ".\nCheck your config file and make sure the path is correct: " + cfg.local_config_filename() + ".\n\n" + unicode(e))
        except socket.error, e:
            raise idli.IdliException("Error connecting to trac server " + trac_server_url() + ".\nCheck your config file and make sure the path is correct: " + cfg.local_config_filename() + ".\n\n" + unicode(e))
        except xmlrpclib.Fault, e:
            if e.faultCode == 403:
                raise idli.IdliException("Trac's permissions are not set correctly. Run\n $ trac-admin TRACDIR permission add authenticated XML_RPC\nto enable XML_RPC permissions (which are required by idli).")
            else:
                raise idli.IdliException("Error connecting to trac server " + trac_server_url() + ".\nCheck your config file and make sure the path is correct: " + cfg.local_config_filename() + ".\n\n" + unicode(e))
        except xmlrpclib.ProtocolError, e:
            raise idli.IdliException("Protocol error. This probably means that the XmlRpc plugin for trac is not enabled. Follow the inunicodeuctions here to install it:\nhttp://trac-hacks.org/wiki/XmlRpcPlugin\n\n"+unicode(e))
    return __wrapped

class TracBackend(idli.Backend):
    config_section = CONFIG_SECTION
    name = "trac"
    init_names = [ ("server", "URL of trac server."),
                   ("path", "Name of repository")
                   ]
    config_names = [("user", "Trac username"),
                    ("password", "Trac login password.")
                    ]

    def __init__(self, args):
Esempio n. 11
0
 def run(self):
     self.backend.initialize()
     print("Configuration written to " + config.local_config_filename())
Esempio n. 12
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)
Esempio n. 13
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)
Esempio n. 14
0
                + cfg.local_config_filename() + ".\n\n" + unicode(e))
        except socket.error, e:
            raise idli.IdliException(
                "Error connecting to trac server " + trac_server_url() +
                ".\nCheck your config file and make sure the path is correct: "
                + cfg.local_config_filename() + ".\n\n" + unicode(e))
        except xmlrpclib.Fault, e:
            if e.faultCode == 403:
                raise idli.IdliException(
                    "Trac's permissions are not set correctly. Run\n $ trac-admin TRACDIR permission add authenticated XML_RPC\nto enable XML_RPC permissions (which are required by idli)."
                )
            else:
                raise idli.IdliException(
                    "Error connecting to trac server " + trac_server_url() +
                    ".\nCheck your config file and make sure the path is correct: "
                    + cfg.local_config_filename() + ".\n\n" + unicode(e))
        except xmlrpclib.ProtocolError, e:
            raise idli.IdliException(
                "Protocol error. This probably means that the XmlRpc plugin for trac is not enabled. Follow the inunicodeuctions here to install it:\nhttp://trac-hacks.org/wiki/XmlRpcPlugin\n\n"
                + unicode(e))

    return __wrapped


class TracBackend(idli.Backend):
    config_section = CONFIG_SECTION
    name = "trac"
    init_names = [("server", "URL of trac server."),
                  ("path", "Name of repository")]
    config_names = [("user", "Trac username"),
                    ("password", "Trac login password.")]
Esempio n. 15
0
File: trac.py Progetto: abeyer/Idli
 def __wrapped(*args, **kwargs):
     try:
         return func(*args, **kwargs)
     except socket.gaierror as e:
         raise idli.IdliException("Error connecting to trac server " + trac_server_url() + ".\nCheck your config file and make sure the path is correct: " + cfg.local_config_filename() + ".\n\n" + str(e))
     except socket.error as e:
         raise idli.IdliException("Error connecting to trac server " + trac_server_url() + ".\nCheck your config file and make sure the path is correct: " + cfg.local_config_filename() + ".\n\n" + str(e))
     except xmlrpc.client.Fault as e:
         if e.faultCode == 403:
             raise idli.IdliException("Trac's permissions are not set correctly. Run\n $ trac-admin TRACDIR permission add authenticated XML_RPC\nto enable XML_RPC permissions (which are required by idli).")
         else:
             raise idli.IdliException("Error connecting to trac server " + trac_server_url() + ".\nCheck your config file and make sure the path is correct: " + cfg.local_config_filename() + ".\n\n" + str(e))
     except xmlrpc.client.ProtocolError as e:
         raise idli.IdliException("Protocol error. This probably means that the XmlRpc plugin for trac is not enabled. Follow the instructions here to install it:\nhttp://trac-hacks.org/wiki/XmlRpcPlugin\n\n"+str(e))
Esempio n. 16
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)