Mercurial > wikked
view manage.py @ 35:2b35d719f342
Handle wiki and page permissions for read/write access.
Refactored code to only have one place where page title "slugification" happens.
Made that "slugification" better by replacing diacritics with their ANSI
character equivalent (on both server and client).
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 06 Jan 2013 20:22:36 -0800 |
parents | 420ff74c2e28 |
children | f63a2062fb99 |
line wrap: on
line source
import os.path import logging from flask.ext.script import Manager, Command, prompt, prompt_pass from wikked import app, wiki manager = Manager(app) @manager.command def users(): """Lists users of this wiki.""" print "Users:" for user in wiki.auth.getUsers(): print " - " + user.username print "" @manager.command def new_user(): """Generates the entry for a new user so you can copy/paste it in your `.wikirc`. """ username = prompt('Username: ') password = prompt_pass('Password: ') password = app.bcrypt.generate_password_hash(password) print "[users]" print "%s = %s" % (username, password) @manager.command def reset_index(): """ Re-generates the index, if search is broken somehow in your wiki. """ wiki.index.reset(wiki.getPages()) @manager.command def list(): """ Lists page names in the wiki. """ for url in wiki.getPageUrls(): print url if __name__ == "__main__": manager.run()