plugin_ckeditor_1.py 642 B

1234567891011121314151617181920212223
  1. def upload():
  2. (new_filename, old_filename, length,
  3. mime_type) = current.plugin_ckeditor.handle_upload()
  4. title = os.path.splitext(old_filename)[0]
  5. result = current.plugin_ckeditor.settings.table_upload.validate_and_insert(
  6. title=title,
  7. filename=old_filename,
  8. upload=new_filename,
  9. flength=length,
  10. mime_type=mime_type
  11. )
  12. text = ''
  13. url = URL(*current.plugin_ckeditor.settings.download_url,
  14. args=[new_filename])
  15. if not result.id:
  16. text = result.errors
  17. return dict(text=text, cknum=request.vars.CKEditorFuncNum, url=url)