Mercurial > wikked
diff manage.py @ 112:a65cedc183d6
Added more functions to the `manage` CLI tool.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 16 Nov 2013 08:35:08 -0800 |
parents | 5c24e8f8b095 |
children | 7c7f7eca51ae |
line wrap: on
line diff
--- a/manage.py Sat Nov 16 08:32:57 2013 -0800 +++ b/manage.py Sat Nov 16 08:35:08 2013 -0800 @@ -6,7 +6,6 @@ # Create the app and the wiki. from wikked.web import app, wiki -from wikked.page import FileSystemPage # Create the manager. from flask.ext.script import Manager, prompt, prompt_pass @@ -38,21 +37,15 @@ def reset(): """ Re-generates the database and the full-text-search index. """ - page_infos = wiki.fs.getPageInfos() - fs_pages = FileSystemPage.fromPageInfos(wiki, page_infos) - wiki.db.reset(fs_pages) - wiki.index.reset(wiki.getPages()) + wiki.reset() @manager.command -def update(): +def update(url=None): """ Updates the database and the full-text-search index with any changed/new files. """ - page_infos = wiki.fs.getPageInfos() - fs_pages = FileSystemPage.fromPageInfos(wiki, page_infos) - wiki.db.update(fs_pages) - wiki.index.update(wiki.getPages()) + wiki.update(url) @manager.command @@ -73,5 +66,19 @@ print page.text +@manager.command +def linksfrom(url): + page = wiki.getPage(url) + for l in page.links: + print l + + +@manager.command +def linksto(url): + page = wiki.getPage(url) + for l in page.getIncomingLinks(): + print l + + if __name__ == "__main__": manager.run()