コード例 #1
0
def publish_post(path):

    config = get_config()
    full_path = os.path.join(config['path'], path)

    if not os.path.exists(full_path):
        raise PostNotFoundError()

    if full_path.endswith('.md'):
        full_path = full_path[:-3] + '.meta.json'
    elif full_path.endswith('.meta.json'):
        pass  #Dont worry, it is correct that way!
    else:
        raise PostNotFoundError()

    meta = json.load(open(full_path))
    meta['published'] = True
    json.dump(meta, open(full_path, 'w'))

    rebuild_blog()
コード例 #2
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def publish_post(path):

    config = get_config()
    full_path = os.path.join(config['path'],path)

    if not os.path.exists(full_path):
        raise PostNotFoundError()

    if full_path.endswith('.md'):
        full_path = full_path[:-3] + '.meta.json'
    elif full_path.endswith('.meta.json'):
        pass #Dont worry, it is correct that way!
    else:
        raise PostNotFoundError()

    meta = json.load(open(full_path))
    meta['published'] = True
    json.dump(meta,open(full_path,'w'))

    rebuild_blog()
コード例 #3
0
def main():

    if len(sys.argv) < 2:
        print USAGE
        return

    command = sys.argv[1]
    args = sys.argv[2:]

    if command == 'create-blog':
        create_new_blog(args)
    elif command == 'admin':
        admin_blog(args)
    elif command == 'new-post':
        create_new_post(args)
    elif command == 'manage':
        manage_blog(args)
    elif command == 'rebuild':
        rebuild_blog(args)
    else:
        print USAGE
        return
コード例 #4
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
def main():

    if len(sys.argv) < 2:
        print USAGE
        return

    command = sys.argv[1]
    args = sys.argv[2:]

    if command == 'create-blog':
        create_new_blog(args)
    elif command == 'admin':
        admin_blog(args)
    elif command == 'new-post':
        create_new_post(args)
    elif command == 'manage':
        manage_blog(args)
    elif command == 'rebuild':
        rebuild_blog(args)
    else:
        print USAGE
        return