def post_queue_add_page(request, addpagerequest_id, html, url): """Called by the server-side renderer to finish adding a page.""" addPageRequest = models.AddPageRequest.objects.get(id=addpagerequest_id) # If this page was already completed, don't add it again -- there's a possibility that multiple # threads are working on the same page at once. if addPageRequest.status_code == models.StatusCode.DONE: log.error("Multiple threads processed APR %s" % addPageRequest.id) return flowgram = addPageRequest.flowgram user = flowgram.owner title = helpers.get_title(request) # Modify the HTML to add base tag etc. (html, url) = fix.process_page(html, url) # Create and save the page: page = addPageRequest.page page.title = title page.save() html = helpers.cache_css_files(page, html) page = controller.create_page_to_flowgram(flowgram, page, html, do_make_thumbnail=False, set_position=False) # Updating the status code and page addPageRequest.status_code = models.StatusCode.DONE controller.set_page_hl_contents(page, html) addPageRequest.save() log.action('post_queue_add_page %s to %s for %s' % (page.id, flowgram.id, user.username))
def set_page(request, page, html): """Sets the highlighted HTML version of a Page.""" controller.set_page_hl_contents(page, html) log.action('set_page on %s for %s' % (page.id, request.user.username))