def post(self): script = self.request.get('script', '') if not script: self.abort(400, 'No script uploaded') bot_code.store_bootstrap(script.encode('utf-8')) self.get()
def post(self): script = self.request.get('script', '') if not script: self.abort(400, 'No script uploaded') # Make sure the script is valid utf-8. For some odd reason, the script # instead may or may not be an unicode instance. This depends if it is on # AppEngine production or not. if isinstance(script, str): script = script.decode('utf-8', 'replace') script = script.encode('utf-8') bot_code.store_bootstrap(script) self.get()
def put_bootstrap(self, request): """Stores a new version of bootstrap.py.""" key = bot_code.store_bootstrap(request.content.encode('utf-8')) obj = key.get() return swarming_rpcs.FileContent( who=obj.who.to_bytes() if obj.who else None, when=obj.created_ts, version=obj.version)