def cell_update(x, y): c = Cell.at_position(x, y) if c.is_initialized(): return make_response("Cell already initialized.") c.title = request.values.get("title", c.title) c.description = request.values.get("description", c.description) c.link = request.values.get("link", c.link) if c.link and not "://" in c.link: c.link = "http://" + c.link c.put() return make_response("Updated.")
def cell_budget(x, y): c = Cell.at_position(x, y) budget = c.get_bitcoin_budget() render_bitcoin_budget = get_template_attribute('macros.html', 'render_bitcoin_budget') logging.info(repr(str(render_bitcoin_budget(c)))) body = json.dumps({ 'budget': budget, 'html': str(render_bitcoin_budget(c)), }, indent=4) response = make_response(body) response.headers['Content-Type'] = 'text/plain' return response
def handle_cell(self, blob_info): from models import Cell x = int(self.request.params['x']) y = int(self.request.params['y']) cell = Cell.at_position(x, y) if cell.is_initialized(): raise Exception("Cell (%s,%s) already initialized." % (x, y)) old_image = cell.image cell.image = blob_info.key() cell.image_url = images.get_serving_url(str(blob_info.key())) cell.put() if old_image: old_image.delete() taskqueue.add(url="/macro/update_row_cache", params={'y': y}, method="GET") self.redirect('/')
def cell(x, y): c = Cell.at_position(x, y) return redirect(c.get_image_url())