Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ tcrudge.egg-info/

# Pypi
.pypirc
.pkg
23 changes: 11 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@

from setuptools import setup

try:
import pypandoc
except ImportError:
print("pypandoc not installed.\nUse `pip install pypandoc`.\nExiting.")
sys.exit(1)


def read_md(f):
"""
Converts md file to rst text
"""
def get_long_description(f):
try:
import pypandoc
except ImportError:
return 'No description'
return pypandoc.convert(f, 'rst')

install_requires = [
Expand Down Expand Up @@ -82,6 +76,11 @@ def get_package_data(package):
version = get_version('tcrudge')

if sys.argv[-1] == 'publish':
try:
import pypandoc
except ImportError:
print("pypandoc not installed.\nUse `pip install pypandoc`.\nExiting.")
sys.exit(1)
pypandoc.download_pandoc()
if os.system("pip freeze | grep twine"):
print("twine not installed.\nUse `pip install twine`.\nExiting.")
Expand All @@ -99,7 +98,7 @@ def get_package_data(package):
url='https://github.com/CodeTeam/tcrudge',
license='MIT',
description='Tornado RESTful API with Peewee',
long_description=read_md('readme.md'),
long_description=get_long_description('readme.md'),
author='Code Team',
author_email='saborisov@sberned.ru',
packages=get_packages('tcrudge'),
Expand Down
2 changes: 1 addition & 1 deletion tcrudge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
Supports JSON and MessagePack responses.
"""

__version__ = '0.9.1'
__version__ = '0.9.3'
7 changes: 3 additions & 4 deletions tcrudge/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,9 @@ def write_error(self, status_code, **kwargs):
self.set_header('Content-Type', 'text/plain')
for line in traceback.format_exception(*exc_info):
self.write(line)
else:
# exc_info[1] - HTTPError instance
# Finish request with exception body or exception reason
self.write(getattr(exc_info[1], 'body', self._reason))
# exc_info[1] - HTTPError instance
# Finish request with exception body or exception reason
self.write(getattr(exc_info[1], 'body', self._reason))
self.finish()

async def validate(self, data, schema, **kwargs):
Expand Down