def delete(self, filename): """ Parameter: filename Errors: StaticFileNotFound """ path = os.path.join(GLSettings.static_path, filename) directory_traversal_check(GLSettings.static_path, path) if not os.path.exists(path): raise errors.StaticFileNotFound os.remove(path)
def delete(self, filename): """ Parameter: filename Errors: StaticFileNotFound """ path = os.path.join(GLSetting.static_path, filename) directory_traversal_check(GLSetting.static_path, path) if not os.path.exists(path): raise errors.StaticFileNotFound # XXX if a reserved filename is requested, need to be handled in # a safe way: eg, if is a receiver, restore the default image. os.remove(path) self.set_status(200) self.finish()