Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurk committed May 1, 2011
2 parents 8e9ebc9 + ea9e9a0 commit c7e9356
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@

packages = find_packages('src'),
package_dir = {'': 'src'},
package_data={'pyll': ['templates/default.html'],},
package_data={
'pyll': ['templates/default.html',
'quickstart.tar.gz'],
},
zip_safe = False,

test_suite = 'nose.collector',
Expand All @@ -30,6 +33,7 @@
'markdown',
'docutils',
'Jinja2',
'python-dateutil==1.5',
],
)

3 changes: 1 addition & 2 deletions src/pyll/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,7 @@ def main():
'lib_dir': join(project_dir, '_lib'),
'url_path': join(project_dir, '_lib', 'urls.py'),
'settings_path': join(project_dir, '_lib', 'settings.cfg'),
'build_time': datetime.today(),
'date_format': '%Y-%m-%d'}
'build_time': datetime.today()}

# configure logging
logging_level = LOGGING_LEVELS.get(options.logging, logging.INFO)
Expand Down
19 changes: 5 additions & 14 deletions src/pyll/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import re
from os.path import splitext

from dateutil import parser


class ParserException(Exception):
"""Exception raised for errors during the parsing."""
pass
Expand Down Expand Up @@ -51,27 +54,15 @@ def _parse_headers(self):
pass
self.text = '\n'.join(lines)

def _parse_tags_header(self, value):
"""
Parses the value from the 'tags' header into a list.
"""
return [t.strip() for t in value.split(',')]

def _parse_date_header(self, value):
"""
Parses the date header into a python datetime.datetime object.
The value must be in the format as specified by the 'date_format'
setting; otherwise a ParserException will be thrown.
Parses the date header string into a python datetime object.
"""
format = self.settings['date_format']
try:
return datetime.datetime.strptime(value, format)
return parser.parse(value)
except ValueError as error:
raise ParserException(error)

def _parse_updated_header(self, value):
return self._parse_date_header(value)

def _parse_status_header(self, value):
"""
Checks that the value of the 'status' header is 'live', 'hidden' or
Expand Down
Binary file modified src/pyll/quickstart.tar.gz
Binary file not shown.

0 comments on commit c7e9356

Please sign in to comment.