comparison tests/mock.py @ 82:9afe4a1dbd1e

Refactoring of core wiki classes: - Use proper classes instead of dictionaries more often. - Simplified `Page`'s public API. - Page meta property values are now always stored in an array, even if there's only one occurence for the given key. - Updated unit-tests.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 19 Mar 2013 19:54:11 -0700
parents 2733871775cd
children fd6eccb24882
comparison
equal deleted inserted replaced
81:05d0a7cd85e8 82:9afe4a1dbd1e
3 import types 3 import types
4 import codecs 4 import codecs
5 import logging 5 import logging
6 import StringIO 6 import StringIO
7 from wikked.page import Page 7 from wikked.page import Page
8 from wikked.fs import PageNotFoundError 8 from wikked.fs import PageInfo, PageNotFoundError
9 from wikked.db import Database 9 from wikked.db import Database
10 from wikked.indexer import WikiIndex 10 from wikked.indexer import WikiIndex
11 from wikked.scm import SourceControl 11 from wikked.scm import SourceControl
12 12
13 13
130 raise NotImplementedError() 130 raise NotImplementedError()
131 131
132 def _getPageInfo(self, node, with_content=False): 132 def _getPageInfo(self, node, with_content=False):
133 path_split = os.path.splitext(node['path']) 133 path_split = os.path.splitext(node['path'])
134 url = self.slugify(path_split[0]) 134 url = self.slugify(path_split[0])
135 info = { 135 info = PageInfo(url, node['path'])
136 'url': url,
137 'path': node['path']
138 }
139 if with_content: 136 if with_content:
140 info['content'] = node['content'] 137 info.content = node['content']
141 return info 138 return info
142 139
143 def _getNode(self, path): 140 def _getNode(self, path):
144 node = self.structure 141 node = self.structure
145 if path: 142 if path: