Permalink
Browse files

bug fix: cleaning tmpstore when wrong file like object is loaded

  • Loading branch information...
1 parent 710d4e9 commit c67efba7bc360b4137efa33b458e4acd92d268cf @alvesjnr alvesjnr committed Jun 10, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 isis/model/mapper.py
View
@@ -191,6 +191,21 @@ def _pystruct(self, instance, value):
def _colander_schema(self, instance, value):
class MemoryTmpStore(dict):
+
+ def __getitem__(self, name):
+ return self.get(name)
+
+ def get(self, name):
+ item = super(MemoryTmpStore,self).get(name)
+
+ if item is not None and item['fp'] is not None:
+ if not item['fp'].read(100):
+ item['fp'] = None
+ else:
+ item['fp'].seek(0)
+
+ return item
+
def preview_url(self, name):
return None
tmpstore = MemoryTmpStore()

0 comments on commit c67efba

Please sign in to comment.