# HG changeset patch # User Marcin Kuzminski # Date 1324441168 -7200 # Node ID b6d23aa3754c5883320714a3ab6364326b71c7c1 # Parent 6c86c987cf93db69eac3ed375ce5c21ab808fd1d fixed problem with uploading files into rhodecode that wasn't detected as streams diff -r 6c86c987cf93 -r b6d23aa3754c rhodecode/model/scm.py --- a/rhodecode/model/scm.py Wed Dec 21 02:56:39 2011 +0200 +++ b/rhodecode/model/scm.py Wed Dec 21 06:19:28 2011 +0200 @@ -26,6 +26,7 @@ import time import traceback import logging +import cStringIO from vcs import get_backend from vcs.exceptions import RepositoryError @@ -60,6 +61,7 @@ def __repr__(self): return "<%s('id:%s')>" % (self.__class__.__name__, self.repo_id) + class CachedRepoList(object): def __init__(self, db_repo_list, repos_path, order_by=None): @@ -112,6 +114,7 @@ tmp_d['dbrepo_fork'] = dbr.fork.get_dict() if dbr.fork else {} yield tmp_d + class ScmModel(BaseModel): """ Generic Scm Model @@ -359,8 +362,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)