X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/39e235fcc4bffec8893cf9a2f8924303c7b3a859..4419f93a01685b9864a6e78cb905c803ec0970b0:/apps/explorer/views.py?ds=inline diff --git a/apps/explorer/views.py b/apps/explorer/views.py index 18f79b3e..b3cc09bc 100644 --- a/apps/explorer/views.py +++ b/apps/explorer/views.py @@ -1,7 +1,10 @@ # -*- coding: utf-8 -*- import urllib2 import hg -from librarian import html, parser, dcparser, ParseError, ValidationError +from datetime import date + +from librarian import html, parser, dcparser, wrap_text +from librarian import ParseError, ValidationError from django.conf import settings from django.contrib.auth.decorators import login_required, permission_required @@ -65,9 +68,12 @@ def file_upload(request, repo): f = request.FILES['file'] decoded = f.read().decode('utf-8') path = form.cleaned_data['bookname'] + + if form.cleaned_data['autoxml']: + decoded = wrap_text(decoded, unicode(date.today()) ) def upload_action(): - repo._add_file(path ,decoded.encode('utf-8') ) + repo._add_file(path, decoded.encode('utf-8') ) repo._commit(message="File %s uploaded by user %s" % \ (path, request.user.username), user=request.user.username)