コード例 #1
0
def remove(file, language='en', **kwargs):
    '''Remove master file from a remote project. This will remove the master file (and related translations). Local file is not removed.'''
    repo = Repository()

    if repo.master_exists(file):
        username = kwargs.get('username')
        password = kwargs.get('password')

        if username == '' or password == '':
            username, password = prompt_userpw()

        mf = GLMasterFile(
            GLProject(repo.get_project_name(), username, password),
            repo.relative_to_root(file), file, None)

        try:
            mf.remove()
            repo.rm_master(file)
            print "File %s removed successfully." % repo.relative_path(
                repo.file_path(file))
        except GLException as e:
            print "Unable to remove file from server: " + str(e)
    else:
        print "Couldn't find a file %s" % repo.relative_path(
            repo.file_path(file))
コード例 #2
0
def remove(file, language='en', **kwargs):
    '''Remove master file from a remote project. This will remove the master file (and related translations). Local file is not removed.'''
    repo = Repository()

    if repo.master_exists(file):
        username = kwargs.get('username')
        password = kwargs.get('password')
      
        if username == '' or password == '':
            username, password = prompt_userpw()
       
        mf = GLMasterFile(GLProject(repo.get_project_name(), username, password), repo.relative_to_root(file), file, None)
        
        try:
            mf.remove()
            repo.rm_master(file)
            print "File %s removed successfully." % repo.relative_path(repo.file_path(file))
        except GLException as e:
            print "Unable to remove file from server: " + str(e)
    else:
        print "Couldn't find a file %s" % repo.relative_path(repo.file_path(file))