Skip to content
Browse files

Fix the reStructuredText access point.

  • Loading branch information...
1 parent 14965d5 commit 3860730b2df120f47296bdb456edb9f7a5bfa923 @SimonSapin SimonSapin committed Aug 13, 2012
Showing with 9 additions and 5 deletions.
  1. +1 −0 .gitignore
  2. +3 −3 python/multicorn/fsfdw/__init__.py
  3. +5 −2 python/multicorn/fsfdw/test.py
View
1 .gitignore
@@ -5,3 +5,4 @@ tags
sql/multicorn--0.0.2.sql
*.pyc
/build
+/dist
View
6 python/multicorn/fsfdw/__init__.py
@@ -86,7 +86,7 @@ def get_items(self, quals, columns):
if qual.operator == '=' and qual.field_name in properties))
- def items_to_dicts(self, columns, items):
+ def items_to_dicts(self, items, columns):
content_column = self.content_column
filename_column = self.filename_column
has_content = content_column and content_column in columns
@@ -114,11 +114,11 @@ def __init__(self, options, columns):
self.extract_meta = mtime_lru_cache(extract_meta, max_size=1000)
columns = dict((name, column) for name, column in columns.items()
if not name.startswith('rest_'))
- super(RestructuredText, self).__init__(options, columns)
+ super(ReStructuredTextFdw, self).__init__(options, columns)
def execute(self, quals, columns):
items = self.get_items(quals, columns)
- keys = [(name, name[:5]) # len('rest_') == 5
+ keys = [(name, name[5:]) # len('rest_') == 5
for name in columns if name.startswith('rest_')]
if keys:
items = self.add_meta(items, keys)
View
7 python/multicorn/fsfdw/test.py
@@ -331,14 +331,17 @@ def extract(filename):
===========
:Author: Myself
-:foo: bar
+:Summary:
+ Lorem ipsum
+ dolor sit amet
Not a subtitle
--------------
Content
'''
- meta_2 = {'title': 'First title', 'author': 'Myself', 'foo': 'bar'}
+ meta_2 = {'title': 'First title', 'author': 'Myself',
+ 'summary': 'Lorem ipsum\ndolor sit amet'}
def write(filename, content):
with open(os.path.join(tempdir, filename), 'w') as file_obj:
file_obj.write(content)

0 comments on commit 3860730

Please sign in to comment.
Something went wrong with that request. Please try again.