Commit 65e78e72 by Dan Krause

disallow attempts to overwrite files

parent ed89d69d
...@@ -19,6 +19,7 @@ import six ...@@ -19,6 +19,7 @@ import six
from parse_rest.connection import API_ROOT, ParseBase from parse_rest.connection import API_ROOT, ParseBase
from parse_rest.query import QueryManager from parse_rest.query import QueryManager
from parse_rest.core import ParseError
def complex_type(name=None): def complex_type(name=None):
...@@ -214,6 +215,8 @@ class File(ParseType, ParseBase): ...@@ -214,6 +215,8 @@ class File(ParseType, ParseBase):
} }
def save(self, batch=False): def save(self, batch=False):
if self.url is not None:
raise ParseError("Files can't be overwritten")
uri = '/'.join([self.__class__.ENDPOINT_ROOT, self.name]) uri = '/'.join([self.__class__.ENDPOINT_ROOT, self.name])
headers = {'Content-type': self.mimetype} headers = {'Content-type': self.mimetype}
response = self.__class__.POST(uri, extra_headers=headers, batch=batch, body=self._content) response = self.__class__.POST(uri, extra_headers=headers, batch=batch, body=self._content)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment