search pass three
This commit is contained in:
parent
13d4be8937
commit
08a4c71c10
9 changed files with 132 additions and 44 deletions
|
@ -5,32 +5,11 @@ import gittle.utils
|
|||
import yaml
|
||||
from gittle import Gittle
|
||||
from dulwich.repo import NotGitRepository
|
||||
from realms.lib.util import to_canonical
|
||||
from realms.lib.util import to_canonical, cname_to_filename, filename_to_cname
|
||||
from realms import cache
|
||||
from realms.lib.hook import HookMixin
|
||||
|
||||
|
||||
def cname_to_filename(cname):
|
||||
""" Convert canonical name to filename
|
||||
|
||||
:param cname: Canonical name
|
||||
:return: str -- Filename
|
||||
|
||||
"""
|
||||
return cname + ".md"
|
||||
|
||||
|
||||
def filename_to_cname(filename):
|
||||
"""Convert filename to canonical name.
|
||||
|
||||
.. note::
|
||||
|
||||
It's assumed filename is already canonical format
|
||||
|
||||
"""
|
||||
return os.path.splitext(filename)[0]
|
||||
|
||||
|
||||
class PageNotFound(Exception):
|
||||
pass
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import json
|
||||
from nose.tools import *
|
||||
from flask import url_for
|
||||
from realms.modules.wiki.models import cname_to_filename, filename_to_cname
|
||||
from realms.lib.util import cname_to_filename, filename_to_cname
|
||||
from realms.lib.test import BaseTest
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue