示例#1
0
def send_log(kwargs):

    log_d = log_dict
    # log_d['time'] = get_now_time()
    log_d['time'] = get_timestamp_13()
    log_d['log']['log_info'] = kwargs['log_info']
    log_d['log']['userid'] = kwargs['user_name']

    log_msg_str = json.dumps(log_d)

    send_msg_to_es(log_info=log_msg_str, labels_logs=kwargs['labels_logs'])
示例#2
0
def setRepoLogo(repositoryname):
    username, reponame = repositoryname.split('/')

    tt = str(get_timestamp_13()) + reponame

    savename = CONFPATH + os.path.sep + tt + '.png'
    remoteName = RepositoryObject + os.path.sep + tt + '.png'

    print 'logo setRepoLogo savename:' + savename
    print 'logo setRepoLogo remoteName:' + remoteName

    if CreateImagePut(reponame[0], reponame[1], savename, remoteName):
        if os.path.exists(savename):
            os.remove(savename)
        return remoteName

    print 'ser iserror'
    return False
示例#3
0
def get_logo(user_name, uid):
    file = request.files['file']
    if file and allowed_file(file.filename):
        filename = secure_filename(file.filename)

        image_suffix = file_suffix(filename)

        image_name = 'logo' + str(get_timestamp_13()) + '.' + image_suffix

        user_log_path = os.path.join(UPLOAD_FOLDER, user_name)

        if os.path.exists(user_log_path) is False:
            os.mkdir(user_log_path)

        file.save(os.path.join(user_log_path, image_name))
        UserBhandle = UserBaseHandle(user_name=user_name)
        return UserBhandle.change_logo(image_name)
    else:
        return request_result(100, ret='file name is error')
示例#4
0
def CreatePutRetUrl(src_str):
    if isinstance(src_str, str) is False:
        return request_result(706, ret='not is str')

    if len(src_str) <= 2:
        return request_result(706, ret='The string is too short')

    tt = str(get_timestamp_13()) + src_str

    savename = CONFPATH + os.path.sep + tt + '.png'
    remoteName = RepositoryObject + os.path.sep + tt + '.png'

    print 'logo setRepoLogo savename:' + savename
    print 'logo setRepoLogo remoteName:' + remoteName

    if CreateImagePut(src_str[0], src_str[1], savename, remoteName):
        if os.path.exists(savename):

            os.remove(savename)
        return remoteName

    return False