Example #1
0
    def changepathpage(filepathz):
	from txclib import get_version
	txc_version = get_version()

	filepathz = filepathz.replace("-","/")
		
	prj = project.Project(filepathz)
       
	res_list = []
        prev_proj = ''
        for idx, res in enumerate(prj.get_resource_list()):
            hostname = prj.get_resource_host(res)
            p, r = res.split('.')
            p_url = '%s/projects/p/%s' % (hostname, p)
            r_url = '%s/resource/%s' % (p_url, r)
            sfile = prj.get_resource_option(res, 'source_file') or "N/A"
            expr = prj.config.get(res, "file_filter")
            expr_highlight = expr.replace('<lang>', '<span class="lang">&lt;lang&gt;</span>')
            res_list.append({'id': res,
                             'p_name': p,
                             'p_url': p_url,
                             'r_name': r,
                             'r_url': r_url,
                             'source_file': sfile,
                             'expr': expr,
                             'expr_highlight': expr_highlight})
        res_list = sorted(res_list, key=lambda k: k['id'])
	username,password = prj.getset_host_credentials(hostname)

	return render_template("index.html",res_list=res_list, txc_version=txc_version, username=username, password=password)
    def home(name=None):
        "Print status of current project"
        from txclib import get_version
        txc_version = get_version()

        prj = project.Project(path_to_tx)

        # Let's create a resource list from our config file
        res_list = []
        prev_proj = ''
        for idx, res in enumerate(prj.get_resource_list()):
            hostname = prj.get_resource_host(res)
            p, r = res.split('.')
            p_url = '%s/projects/p/%s' % (hostname, p)
            r_url = '%s/resource/%s' % (p_url, r)
            sfile = prj.get_resource_option(res, 'source_file') or "N/A"
            expr = prj.config.get(res, "file_filter")
            expr_highlight = expr.replace('<lang>', '<span class="lang">&lt;lang&gt;</span>')
            res_list.append({'id': res,
                             'p_name': p,
                             'p_url': p_url,
                             'r_name': r,
                             'r_url': r_url,
                             'source_file': sfile,
                             'expr': expr,
                             'expr_highlight': expr_highlight})
        res_list = sorted(res_list, key=lambda k: k['id'])
        username, password = prj.getset_host_credentials(hostname)
        return render_template('index.html', res_list=res_list, txc_version=txc_version, username=username, password=password)
def home(name=None):
    "Print status of current project"
    from txclib import get_version
    txc_version = get_version()

    prj = project.Project(path_to_tx)

    # Let's create a resource list from our config file
    res_list = []
    prev_proj = ''
    for idx, res in enumerate(prj.get_resource_list()):
        hostname = prj.get_resource_host(res)
        p, r = res.split('.')
        p_url = '%s/projects/p/%s' % (hostname, p)
        r_url = '%s/resource/%s' % (p_url, r)
        sfile = prj.get_resource_option(res, 'source_file') or "N/A"
        expr = prj.config.get(res, "file_filter").replace('<lang>', '<span class="lang">&lt;lang&gt;</span>')
        expr_highlight = expr.replace('<lang>', '<span class="lang">&lt;lang&gt;</span>')
        res_list.append({'id': res,
                         'p_name': p,
                         'p_changed': (res_list and p != res_list[-1]['p_name']),
                         'p_url': p_url,
                         'r_name': r,
                         'r_url': r_url,
                         'source_file': sfile,
                         'expr': expr,
                         'expr_highlight': expr_highlight})
    res_list = sorted(res_list)

    return render_template('home.html',
        res_list=res_list, txc_version=txc_version)
    def resource(resouce_data):
	from txclib import get_version
	txc_version = get_version()
	data = resouce_data.split("***")
	resource_name = data[0]
	username = data[1]
	password = data[2]

	return render_template('resource.html', txc_version=txc_version, username=username, password=password, resource_name=resource_name)
Example #5
0
    def resource(resouce_data):
        from txclib import get_version
        txc_version = get_version()
        data = resouce_data.split("***")
        resource_name = data[0]
        username = data[1]
        password = data[2]

        return render_template('resource.html',
                               txc_version=txc_version,
                               username=username,
                               password=password,
                               resource_name=resource_name)
Example #6
0
    def checkme(filepathz):
	from txclib import get_version
	txc_version = get_version()

	prj = project.Project(path_to_tx)
	#  filepathz = request.args.get('filepathz')
	res_list =[]
	prv_proj = ''
	for idx, res in enumerate(prj.get_resource_list()):
		hostname = prj.get_resource_host(res)
	username, password = prj.getset_host_credentials(hostname)
	filepathz = filepathz.replace("-","/")
	return render_template('init.html', txc_version=txc_version, username=username)
Example #7
0
    def index():
	"""Load start page where you select your project folder
	or load history projects from local db"""
	from txclib import get_version
	txc_version = get_version()     

	prj = project.Project(path_to_tx)
	current_path = os.getcwd()
	# Let's create a resource list from our config file
	res_list = []
	prev_proj = ''
	for idx, res in enumerate(prj.get_resource_list()):
		hostname = prj.get_resource_host(res)
	username, password = prj.getset_host_credentials(hostname)
   	return render_template('init.html', txc_version=txc_version, username=username, current_path=current_path)
Example #8
0
package_data = {
    '': ['LICENSE', 'README.rst'],
}

scripts = ['tx']

install_requires = []
try:
    import json
except ImportError:
    install_requires.append('simplejson')

setup(
    name="transifex-client",
    version=get_version(),
    scripts=scripts,
    description="A command line interface for Transifex",
    long_description=long_description,
    author="Indifex Ltd.",
    author_email="*****@*****.**",
    url="http://www.indifex.com",
    license="GPLv2",
    dependency_links = [
    ],
    setup_requires = [
    ],
    install_requires = install_requires,
    tests_require = ["mock", ],
    data_files=[
    ],
Example #9
0
def user_agent_identifier():
    """Return the user agent for the client."""
    client_info = (get_version(), platform.system(), platform.machine())
    return "txclient/%s (%s %s)" % client_info
Example #10
0
def user_agent_identifier():
    """Return the user agent for the client."""
    client_info = (get_version(), platform.system(), platform.machine())
    return "txclient/%s (%s %s)" % client_info
Example #11
0
def main():
    """
    Here we parse the flags (short, long) and we instantiate the classes.
    """
    usage = "usage: %prog [options] command [cmd_options]"
    description = "This is the Transifex command line client which"\
                  " allows you to manage your translations locally and sync"\
                  " them with the master Transifex server.\nIf you'd like to"\
                  " check the available commands issue `%prog help` or if you"\
                  " just want help with a specific command issue `%prog help"\
                  " command`"
    argv = sys.argv[1:]
    parser = OptionParser(
        usage=usage, version=get_version(), description=description
    )
    parser.disable_interspersed_args()
    parser.add_option(
        "-d", "--debug", action="store_true", dest="debug",
        default=False, help=("enable debug messages")
    )
    parser.add_option(
        "-q", "--quiet", action="store_true", dest="quiet",
        default=False, help="don't print status messages to stdout"
    )
    parser.add_option(
        "-r", "--root", action="store", dest="root_dir", type="string",
        default=None, help="change root directory (default is cwd)"
    )
    parser.add_option(
        "--traceback", action="store_true", dest="trace", default=False,
        help="print full traceback on exceptions"
    )
    parser.add_option(
        "--disable-colors", action="store_true", dest="color_disable",
        default=(os.name == 'nt' or not sys.stdout.isatty()),
        help="disable colors in the output of commands"
    )
    (options, args) = parser.parse_args()

    if len(args) < 1:
        parser.error("No command was given")

    utils.DISABLE_COLORS = options.color_disable

    # set log level
    if options.quiet:
        set_log_level('WARNING')
    elif options.debug:
        set_log_level('DEBUG')

    # find .tx
    path_to_tx = options.root_dir or utils.find_dot_tx()


    cmd = args[0]
    try:
        utils.exec_command(cmd, args[1:], path_to_tx)
    except utils.UnknownCommandError:
        logger.error("tx: Command %s not found" % cmd)
    except SystemExit:
        sys.exit()
    except:
        import traceback
        if options.trace:
            traceback.print_exc()
        else:
            formatted_lines = traceback.format_exc().splitlines()
            logger.error(formatted_lines[-1])
        sys.exit(1)
Example #12
0
package_data = {
    '': ['LICENSE', 'README.rst'],
}

scripts = ['tx']

install_requires = []
try:
    import json
except ImportError:
    install_requires.append('simplejson')

setup(
    name="transifex-client",
    version=get_version(),
    scripts=scripts,
    description="A command line interface for Transifex",
    long_description=long_description,
    author="Transifex",
    author_email="*****@*****.**",
    url="https://www.transifex.com",
    license="GPLv2",
    dependency_links=[],
    setup_requires=[],
    install_requires=install_requires,
    tests_require=[
        "mock",
    ],
    data_files=[],
    test_suite="tests",
Example #13
0
def main(argv):
    """
    Here we parse the flags (short, long) and we instantiate the classes.
    """
    usage = "usage: %prog [options] command [cmd_options]"
    description = "This is the Transifex command line client which"\
  " allows you to manage your translations locally and sync"\
    " them with the master Transifex server.\nIf you'd like to"\
  " check the available commands issue `%prog help` or if you"\
  " just want help with a specific command issue `%prog help"\
  " command`"

    parser = OptionParser(usage=usage,
                          version=get_version(),
                          description=description)
    parser.disable_interspersed_args()
    parser.add_option("-d",
                      "--debug",
                      action="store_true",
                      dest="debug",
                      default=False,
                      help=("enable debug messages"))
    parser.add_option("-q",
                      "--quiet",
                      action="store_true",
                      dest="quiet",
                      default=False,
                      help="don't print status messages to stdout")
    parser.add_option("-r",
                      "--root",
                      action="store",
                      dest="root_dir",
                      type="string",
                      default=None,
                      help="change root directory (default is cwd)")
    parser.add_option("--traceback",
                      action="store_true",
                      dest="trace",
                      default=False,
                      help="print full traceback on exceptions")
    parser.add_option("--disable-colors",
                      action="store_true",
                      dest="color_disable",
                      default=(os.name == 'nt' or not sys.stdout.isatty()),
                      help="disable colors in the output of commands")
    (options, args) = parser.parse_args()

    if len(args) < 1:
        parser.error("No command was given")

    utils.DISABLE_COLORS = options.color_disable

    # set log level
    if options.quiet:
        set_log_level('WARNING')
    elif options.debug:
        set_log_level('DEBUG')

    # find .tx
    path_to_tx = options.root_dir or utils.find_dot_tx()

    cmd = args[0]
    try:
        utils.exec_command(cmd, args[1:], path_to_tx)
    except ssl.SSLError as e:
        if 'certificate verify failed' in e.strerror:
            logger.error(
                'Error: Could not verify the SSL certificate of the remote host'
            )
        else:
            logger.error(errno.errorcode[e.errno])
        sys.exit(1)
    except utils.UnknownCommandError:
        logger.error("tx: Command %s not found" % cmd)
    except SystemExit:
        sys.exit()
    except:
        import traceback
        if options.trace:
            traceback.print_exc()
        else:
            formatted_lines = traceback.format_exc().splitlines()
            logger.error(formatted_lines[-1])
        sys.exit(1)