title: Django - writing a PDF created with xhtml2pdf to server's disk
body: <p>I'm trying to write a script that will save a pdf created by xhtml2pdf directly to the server, without doing the usual route of prompting the user to download it to their computer.  Documents() is the Model I am trying to save to, and the new_project and output_filename variables are set elsewhere.</p>
  
  <pre><code>            html = render_to_string(template, RequestContext(request, context)).encode('utf8')
              result = open(output_filename, "wb")
              pdf = CreatePDF(src=html, dest=results, path = "", encoding = 'UTF-8', link_callback=link_callback) #link callback was originally set to link_callback, defined below
              result.close()
              if not pdf.err:
  
                  new_doc=Documents()
                  new_doc.project=new_project
                  new_doc.posted_by=old_mess[0].from_user_fk.username
                  new_doc.documents = result
                  new_doc.save()
  </code></pre>
  
  <p>With this configuration when it reaches new_doc.save() I get the error:  'file' object has no attribute '_committed'</p>
  
  <p>Does anyone know how I can fix this?  Thanks!</p>