if typ is None:
typ, enc=guess_content_type(validId, body)
- ob = self.PUT_factory(validId, typ, body)
+ if self.checkIdAvailable(validId) :
+ ob = self.PUT_factory(validId, typ, body)
+ self._setObject(validId, ob)
+ ob = self._getOb(validId)
+ httpRespCode = 201
+ else :
+ httpRespCode = 200
+ ob = self._getOb(validId)
# We call _verifyObjectPaste with verify_src=0, to see if the
# user can create this type of object (and we don't need to
(ob.__class__, repr(self), sys.exc_info()[1],)
raise Unauthorized, sMsg
- # Delegate actual PUT handling to the new object,
- # SDS: But just *after* it has been stored.
- self._setObject(validId, ob)
- ob = self._getOb(validId)
ob.PUT(REQUEST, RESPONSE)
-
- RESPONSE.setStatus(201)
- RESPONSE.setBody('')
- return RESPONSE
+ ob.orig_name = fileName
+
+
+ ti = ob.getTypeInfo()
+ method_id = ti.queryMethodID('jsupload_snippet')
+ meth = method_id and getattr(ob, method_id) or (lambda : 'Not implemented')
+ RESPONSE.setStatus(httpRespCode)
+ RESPONSE.setHeader('Content-Type', 'text/xml;;charset=utf-8')
+ return '<fragment>%s></fragment>' % meth().strip()
# ## overload to maintain ownership if authenticated user has 'Manage portal' permission