Skip to content
This repository has been archived by the owner on Feb 20, 2022. It is now read-only.

Commit

Permalink
disallow attempts to overwrite files
Browse files Browse the repository at this point in the history
  • Loading branch information
dankrause committed Nov 8, 2014
1 parent ed89d69 commit 65e78e7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions parse_rest/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from parse_rest.connection import API_ROOT, ParseBase
from parse_rest.query import QueryManager
from parse_rest.core import ParseError


def complex_type(name=None):
Expand Down Expand Up @@ -214,6 +215,8 @@ def _to_native(self):
}

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])
headers = {'Content-type': self.mimetype}
response = self.__class__.POST(uri, extra_headers=headers, batch=batch, body=self._content)
Expand Down

0 comments on commit 65e78e7

Please sign in to comment.