Mercurial > kallithea
changeset 1962:1ce36a5f2305
backported fix for issue with uploading files from web interface
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 28 Jan 2012 07:14:01 +0200 |
parents | a1b8bd86c488 |
children | 2ba965341189 |
files | rhodecode/model/scm.py |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/model/scm.py Tue Jan 24 20:01:09 2012 +0200 +++ b/rhodecode/model/scm.py Sat Jan 28 07:14:01 2012 +0200 @@ -7,7 +7,7 @@ :created_on: Apr 9, 2010 :author: marcink - :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> + :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com> :license: GPLv3, see COPYING for more details. """ # This program is free software: you can redistribute it and/or modify @@ -26,6 +26,7 @@ import time import traceback import logging +import cStringIO from sqlalchemy.exc import DatabaseError @@ -370,8 +371,12 @@ if isinstance(content, (basestring,)): content = safe_str(content) - elif isinstance(content, file): + elif isinstance(content, (file, cStringIO.OutputType,)): content = content.read() + else: + raise Exception('Content is of unrecognized type %s' % ( + type(content) + )) message = safe_str(message) path = safe_str(f_path)