##// END OF EJS Templates
MAINT: Move `update` from FileContentsManager to ContentsManager....
Scott Sanderson -
Show More
@@ -512,19 +512,6 b' class FileContentsManager(ContentsManager):'
512
512
513 return model
513 return model
514
514
515 def update(self, model, path):
516 """Update the file's path
517
518 For use in PATCH requests, to enable renaming a file without
519 re-uploading its contents. Only used for renaming at the moment.
520 """
521 path = path.strip('/')
522 new_path = model.get('path', path).strip('/')
523 if path != new_path:
524 self.rename(path, new_path)
525 model = self.get(new_path, content=False)
526 return model
527
528 def delete(self, path):
515 def delete(self, path):
529 """Delete file at path."""
516 """Delete file at path."""
530 path = path.strip('/')
517 path = path.strip('/')
@@ -186,14 +186,6 b' class ContentsManager(LoggingConfigurable):'
186 """
186 """
187 raise NotImplementedError('must be implemented in a subclass')
187 raise NotImplementedError('must be implemented in a subclass')
188
188
189 def update(self, model, path):
190 """Update the file or directory and return the model with no content.
191
192 For use in PATCH requests, to enable renaming a file without
193 re-uploading its contents. Only used for renaming at the moment.
194 """
195 raise NotImplementedError('must be implemented in a subclass')
196
197 def delete(self, path):
189 def delete(self, path):
198 """Delete file or directory by path."""
190 """Delete file or directory by path."""
199 raise NotImplementedError('must be implemented in a subclass')
191 raise NotImplementedError('must be implemented in a subclass')
@@ -220,6 +212,19 b' class ContentsManager(LoggingConfigurable):'
220 # ContentsManager API part 2: methods that have useable default
212 # ContentsManager API part 2: methods that have useable default
221 # implementations, but can be overridden in subclasses.
213 # implementations, but can be overridden in subclasses.
222
214
215 def update(self, model, path):
216 """Update the file's path
217
218 For use in PATCH requests, to enable renaming a file without
219 re-uploading its contents. Only used for renaming at the moment.
220 """
221 path = path.strip('/')
222 new_path = model.get('path', path).strip('/')
223 if path != new_path:
224 self.rename(path, new_path)
225 model = self.get(new_path, content=False)
226 return model
227
223 def info_string(self):
228 def info_string(self):
224 return "Serving contents"
229 return "Serving contents"
225
230
General Comments 0
You need to be logged in to leave comments. Login now