fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d1276c7
)
Just removing old cruft.
author
Radek Czajka
<radekczajka@nowoczesnapolska.org.pl>
Fri, 27 Mar 2015 09:13:09 +0000
(10:13 +0100)
committer
Radek Czajka
<radekczajka@nowoczesnapolska.org.pl>
Fri, 27 Mar 2015 09:13:09 +0000
(10:13 +0100)
17 files changed:
apps/apiclient/__init__.py
patch
|
blob
|
history
apps/catalogue/ebook_utils.py
patch
|
blob
|
history
apps/catalogue/management/__init__.py
patch
|
blob
|
history
apps/catalogue/management/commands/assign_from_redmine.py
patch
|
blob
|
history
apps/catalogue/management/commands/import_wl.py
patch
|
blob
|
history
apps/catalogue/management/commands/merge_books.py
patch
|
blob
|
history
apps/catalogue/managers.py
patch
|
blob
|
history
apps/catalogue/models/book.py
patch
|
blob
|
history
apps/catalogue/views.py
patch
|
blob
|
history
apps/cover/views.py
patch
|
blob
|
history
apps/dvcs/models.py
patch
|
blob
|
history
apps/toolbar/admin.py
patch
|
blob
|
history
apps/toolbar/management/commands/fixbuttons.py
patch
|
blob
|
history
apps/wiki/helpers.py
patch
|
blob
|
history
apps/wiki/templates/admin/wiki/theme/change_list.html
patch
|
blob
|
history
apps/wiki_img/views.py
patch
|
blob
|
history
redakcja/settings/common.py
patch
|
blob
|
history
diff --git
a/apps/apiclient/__init__.py
b/apps/apiclient/__init__.py
index
33d2008
..
38ce26e
100644
(file)
--- a/
apps/apiclient/__init__.py
+++ b/
apps/apiclient/__init__.py
@@
-1,9
+1,8
@@
import urllib
import urllib
-
from django.utils import simple
json
+
import
json
import oauth2
import oauth2
-from apiclient.models import OAuthConnection
from apiclient.settings import WL_CONSUMER_KEY, WL_CONSUMER_SECRET, WL_API_URL
from apiclient.settings import WL_CONSUMER_KEY, WL_CONSUMER_SECRET, WL_API_URL
@@
-22,13
+21,14
@@
class NotAuthorizedError(BaseException):
def api_call(user, path, data=None):
def api_call(user, path, data=None):
+ from .models import OAuthConnection
conn = OAuthConnection.get(user)
if not conn.access:
raise NotAuthorizedError("No WL authorization for user %s." % user)
token = oauth2.Token(conn.token, conn.token_secret)
client = oauth2.Client(wl_consumer, token)
if data is not None:
conn = OAuthConnection.get(user)
if not conn.access:
raise NotAuthorizedError("No WL authorization for user %s." % user)
token = oauth2.Token(conn.token, conn.token_secret)
client = oauth2.Client(wl_consumer, token)
if data is not None:
- data =
simple
json.dumps(data)
+ data = json.dumps(data)
data = urllib.urlencode({"data": data})
resp, content = client.request(
"%s%s" % (WL_API_URL, path),
data = urllib.urlencode({"data": data})
resp, content = client.request(
"%s%s" % (WL_API_URL, path),
@@
-40,7
+40,7
@@
def api_call(user, path, data=None):
status = resp['status']
if status == '200':
status = resp['status']
if status == '200':
- return
simple
json.loads(content)
+ return json.loads(content)
elif status.startswith('2'):
return
elif status == '401':
elif status.startswith('2'):
return
elif status == '401':
diff --git
a/apps/catalogue/ebook_utils.py
b/apps/catalogue/ebook_utils.py
index
d9c9922
..
dae2e76
100644
(file)
--- a/
apps/catalogue/ebook_utils.py
+++ b/
apps/catalogue/ebook_utils.py
@@
-24,7
+24,7
@@
def serve_file(file_path, name, mime_type):
yield chunk
chunk = f.read(size)
yield chunk
chunk = f.read(size)
- response = HttpResponse(
mime
type=mime_type)
+ response = HttpResponse(
content_
type=mime_type)
response['Content-Disposition'] = 'attachment; filename=%s' % name
with open(file_path) as f:
for chunk in read_chunks(f):
response['Content-Disposition'] = 'attachment; filename=%s' % name
with open(file_path) as f:
for chunk in read_chunks(f):
diff --git
a/apps/catalogue/management/__init__.py
b/apps/catalogue/management/__init__.py
index
f7731d7
..
bc3d6c0
100644
(file)
--- a/
apps/catalogue/management/__init__.py
+++ b/
apps/catalogue/management/__init__.py
@@
-100,9
+100,7
@@
class XmlUpdater(object):
books = Book.objects.all()
# Start transaction management.
books = Book.objects.all()
# Start transaction management.
- transaction.commit_unless_managed()
transaction.enter_transaction_management()
transaction.enter_transaction_management()
- transaction.managed(True)
for book in books:
self.counters['All books'] += 1
for book in books:
self.counters['All books'] += 1
diff --git
a/apps/catalogue/management/commands/assign_from_redmine.py
b/apps/catalogue/management/commands/assign_from_redmine.py
index
31bdc14
..
491fd83
100644
(file)
--- a/
apps/catalogue/management/commands/assign_from_redmine.py
+++ b/
apps/catalogue/management/commands/assign_from_redmine.py
@@
-47,9
+47,7
@@
class Command(BaseCommand):
redmine_csv = REDMINE_CSV
# Start transaction management.
redmine_csv = REDMINE_CSV
# Start transaction management.
- transaction.commit_unless_managed()
transaction.enter_transaction_management()
transaction.enter_transaction_management()
- transaction.managed(True)
redakcja_link = re.compile(re.escape(redakcja) + r'([-_.:?&%/a-zA-Z0-9]*)')
redakcja_link = re.compile(re.escape(redakcja) + r'([-_.:?&%/a-zA-Z0-9]*)')
diff --git
a/apps/catalogue/management/commands/import_wl.py
b/apps/catalogue/management/commands/import_wl.py
index
5f60388
..
7eee897
100644
(file)
--- a/
apps/catalogue/management/commands/import_wl.py
+++ b/
apps/catalogue/management/commands/import_wl.py
@@
-31,9
+31,7
@@
class Command(BaseCommand):
verbose = options.get('verbose')
# Start transaction management.
verbose = options.get('verbose')
# Start transaction management.
- transaction.commit_unless_managed()
transaction.enter_transaction_management()
transaction.enter_transaction_management()
- transaction.managed(True)
if verbose:
print 'Reading currently managed files (skipping hidden ones).'
if verbose:
print 'Reading currently managed files (skipping hidden ones).'
diff --git
a/apps/catalogue/management/commands/merge_books.py
b/apps/catalogue/management/commands/merge_books.py
index
5499d3d
..
82bd622
100644
(file)
--- a/
apps/catalogue/management/commands/merge_books.py
+++ b/
apps/catalogue/management/commands/merge_books.py
@@
-126,9
+126,7
@@
class Command(BaseCommand):
return
# Start transaction management.
return
# Start transaction management.
- transaction.commit_unless_managed()
transaction.enter_transaction_management()
transaction.enter_transaction_management()
- transaction.managed(True)
books = [Book.objects.get(slug=slug) for slug in slugs]
common_slug = common_prefix(slugs)
books = [Book.objects.get(slug=slug) for slug in slugs]
common_slug = common_prefix(slugs)
diff --git
a/apps/catalogue/managers.py
b/apps/catalogue/managers.py
index
4f804b8
..
a131ce9
100644
(file)
--- a/
apps/catalogue/managers.py
+++ b/
apps/catalogue/managers.py
@@
-1,5
+1,5
@@
from django.db import models
class VisibleManager(models.Manager):
from django.db import models
class VisibleManager(models.Manager):
- def get_query
_
set(self):
- return super(VisibleManager, self).get_query
_
set().exclude(_hidden=True)
+ def get_queryset(self):
+ return super(VisibleManager, self).get_queryset().exclude(_hidden=True)
diff --git
a/apps/catalogue/models/book.py
b/apps/catalogue/models/book.py
index
e320af7
..
f109474
100755
(executable)
--- a/
apps/catalogue/models/book.py
+++ b/
apps/catalogue/models/book.py
@@
-94,7
+94,7
@@
class Book(models.Model):
return self.public or request.user.is_authenticated()
@classmethod
return self.public or request.user.is_authenticated()
@classmethod
- @transaction.
commit_on_success
+ @transaction.
atomic
def create(cls, creator, text, *args, **kwargs):
b = cls.objects.create(*args, **kwargs)
b.chunk_set.all().update(creator=creator)
def create(cls, creator, text, *args, **kwargs):
b = cls.objects.create(*args, **kwargs)
b.chunk_set.all().update(creator=creator)
@@
-106,7
+106,7
@@
class Book(models.Model):
return self.chunk_set.reverse()[0].split(*args, **kwargs)
@classmethod
return self.chunk_set.reverse()[0].split(*args, **kwargs)
@classmethod
- @transaction.
commit_on_success
+ @transaction.
atomic
def import_xml_text(cls, text=u'', previous_book=None,
commit_args=None, **kwargs):
"""Imports a book from XML, splitting it into chunks as necessary."""
def import_xml_text(cls, text=u'', previous_book=None,
commit_args=None, **kwargs):
"""Imports a book from XML, splitting it into chunks as necessary."""
@@
-153,7
+153,7
@@
class Book(models.Model):
i += 1
return new_slug
i += 1
return new_slug
- @transaction.
commit_on_success
+ @transaction.
atomic
def append(self, other, slugs=None, titles=None):
"""Add all chunks of another book to self."""
assert self != other
def append(self, other, slugs=None, titles=None):
"""Add all chunks of another book to self."""
assert self != other
@@
-213,7
+213,7
@@
class Book(models.Model):
other.delete()
other.delete()
- @transaction.
commit_on_success
+ @transaction.
atomic
def prepend_history(self, other):
"""Prepend history from all the other book's chunks to own."""
assert self != other
def prepend_history(self, other):
"""Prepend history from all the other book's chunks to own."""
assert self != other
diff --git
a/apps/catalogue/views.py
b/apps/catalogue/views.py
index
8a96dc6
..
af2efe2
100644
(file)
--- a/
apps/catalogue/views.py
+++ b/
apps/catalogue/views.py
@@
-210,7
+210,7
@@
def book_xml(request, slug):
return HttpResponseForbidden("Not authorized.")
xml = book.materialize()
return HttpResponseForbidden("Not authorized.")
xml = book.materialize()
- response = http.HttpResponse(xml, content_type='application/xml'
, mimetype='application/wl+xml'
)
+ response = http.HttpResponse(xml, content_type='application/xml')
response['Content-Disposition'] = 'attachment; filename=%s.xml' % slug
return response
response['Content-Disposition'] = 'attachment; filename=%s.xml' % slug
return response
@@
-223,7
+223,7
@@
def book_txt(request, slug):
doc = book.wldocument()
text = doc.as_text().get_string()
doc = book.wldocument()
text = doc.as_text().get_string()
- response = http.HttpResponse(text, content_type='text/plain'
, mimetype='text/plain'
)
+ response = http.HttpResponse(text, content_type='text/plain')
response['Content-Disposition'] = 'attachment; filename=%s.txt' % slug
return response
response['Content-Disposition'] = 'attachment; filename=%s.txt' % slug
return response
@@
-238,7
+238,7
@@
def book_html(request, slug):
html = doc.as_html()
html = html.get_string() if html is not None else ''
html = doc.as_html()
html = html.get_string() if html is not None else ''
- # response = http.HttpResponse(html, content_type='text/html'
, mimetype='text/html'
)
+ # response = http.HttpResponse(html, content_type='text/html')
# return response
# book_themes = {}
# for fragment in book.fragments.all().iterator():
# return response
# book_themes = {}
# for fragment in book.fragments.all().iterator():
@@
-275,7
+275,7
@@
def book_epub(request, slug):
doc = book.wldocument()
# TODO: error handling
epub = doc.as_epub().get_string()
doc = book.wldocument()
# TODO: error handling
epub = doc.as_epub().get_string()
- response = HttpResponse(
mime
type='application/epub+zip')
+ response = HttpResponse(
content_
type='application/epub+zip')
response['Content-Disposition'] = 'attachment; filename=%s' % book.slug + '.epub'
response.write(epub)
return response
response['Content-Disposition'] = 'attachment; filename=%s' % book.slug + '.epub'
response.write(epub)
return response
@@
-426,7
+426,7
@@
def chunk_edit(request, slug, chunk):
})
})
-@transaction.
commit_on_success
+@transaction.
atomic
@login_required
@require_POST
def chunk_mass_edit(request):
@login_required
@require_POST
def chunk_mass_edit(request):
@@
-469,7
+469,7
@@
def chunk_mass_edit(request):
return HttpResponse("", content_type="text/plain")
return HttpResponse("", content_type="text/plain")
-@transaction.
commit_on_success
+@transaction.
atomic
@login_required
@require_POST
def image_mass_edit(request):
@login_required
@require_POST
def image_mass_edit(request):
diff --git
a/apps/cover/views.py
b/apps/cover/views.py
index
6b3344b
..
4a6e575
100644
(file)
--- a/
apps/cover/views.py
+++ b/
apps/cover/views.py
@@
-46,7
+46,7
@@
def preview(request, book, chunk=None, rev=None):
except:
return HttpResponseRedirect(os.path.join(settings.STATIC_URL, "img/sample_cover.png"))
cover = DefaultEbookCover(info)
except:
return HttpResponseRedirect(os.path.join(settings.STATIC_URL, "img/sample_cover.png"))
cover = DefaultEbookCover(info)
- response = HttpResponse(
mime
type=cover.mime_type())
+ response = HttpResponse(
content_
type=cover.mime_type())
image = cover.image().resize(PREVIEW_SIZE, Image.ANTIALIAS)
image.save(response, cover.format)
return response
image = cover.image().resize(PREVIEW_SIZE, Image.ANTIALIAS)
image.save(response, cover.format)
return response
diff --git
a/apps/dvcs/models.py
b/apps/dvcs/models.py
index
ec64794
..
e82ad19
100644
(file)
--- a/
apps/dvcs/models.py
+++ b/
apps/dvcs/models.py
@@
-329,7
+329,7
@@
class Document(models.Model):
else:
return None
else:
return None
- @transaction.
commit_on_success
+ @transaction.
atomic
def prepend_history(self, other):
"""Takes over the the other document's history and prepends to own."""
def prepend_history(self, other):
"""Takes over the the other document's history and prepends to own."""
diff --git
a/apps/toolbar/admin.py
b/apps/toolbar/admin.py
index
283ab78
..
654480c
100644
(file)
--- a/
apps/toolbar/admin.py
+++ b/
apps/toolbar/admin.py
@@
-1,7
+1,7
@@
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django import forms
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django import forms
-
from django.utils import simplejson as
json
+
import
json
from toolbar import models
from toolbar import models
@@
-9,6
+9,7
@@
from toolbar import models
class ButtonAdminForm(forms.ModelForm):
class Meta:
model = models.Button
class ButtonAdminForm(forms.ModelForm):
class Meta:
model = models.Button
+ exclude = []
def clean_params(self):
value = self.cleaned_data['params']
def clean_params(self):
value = self.cleaned_data['params']
diff --git
a/apps/toolbar/management/commands/fixbuttons.py
b/apps/toolbar/management/commands/fixbuttons.py
index
ea797fc
..
de48ced
100644
(file)
--- a/
apps/toolbar/management/commands/fixbuttons.py
+++ b/
apps/toolbar/management/commands/fixbuttons.py
@@
-7,7
+7,7
@@
from django.core.management.base import NoArgsCommand
from toolbar.models import Button, ButtonGroup
from django.core.management.base import NoArgsCommand
from toolbar.models import Button, ButtonGroup
-
from django.utils import simplejson as
json
+
import
json
import re
import re
diff --git
a/apps/wiki/helpers.py
b/apps/wiki/helpers.py
index
dace3d0
..
877a9d0
100644
(file)
--- a/
apps/wiki/helpers.py
+++ b/
apps/wiki/helpers.py
@@
-2,7
+2,7
@@
from datetime import datetime
from functools import wraps
from django import http
from functools import wraps
from django import http
-
from django.utils import simplejson as
json
+
import
json
from django.utils.functional import Promise
from django.utils.functional import Promise
@@
-22,11
+22,11
@@
class ExtendedEncoder(json.JSONEncoder):
class JSONResponse(http.HttpResponse):
def __init__(self, data={}, **kwargs):
class JSONResponse(http.HttpResponse):
def __init__(self, data={}, **kwargs):
- # get rid of
mime
type
- kwargs.pop('
mime
type', None)
+ # get rid of
content_
type
+ kwargs.pop('
content_
type', None)
data = json.dumps(data, cls=ExtendedEncoder)
data = json.dumps(data, cls=ExtendedEncoder)
- super(JSONResponse, self).__init__(data,
mime
type="application/json", **kwargs)
+ super(JSONResponse, self).__init__(data,
content_
type="application/json", **kwargs)
# return errors
# return errors
@@
-45,7
+45,7
@@
def ajax_login_required(view):
@wraps(view)
def authenticated_view(request, *args, **kwargs):
if not request.user.is_authenticated():
@wraps(view)
def authenticated_view(request, *args, **kwargs):
if not request.user.is_authenticated():
- return http.HttpResponse("Login required.", status=401,
mime
type="text/plain")
+ return http.HttpResponse("Login required.", status=401,
content_
type="text/plain")
return view(request, *args, **kwargs)
return authenticated_view
return view(request, *args, **kwargs)
return authenticated_view
@@
-55,7
+55,7
@@
def ajax_require_permission(permission):
@wraps(view)
def authorized_view(request, *args, **kwargs):
if not request.user.has_perm(permission):
@wraps(view)
def authorized_view(request, *args, **kwargs):
if not request.user.has_perm(permission):
- return http.HttpResponse("Access Forbidden.", status=403,
mime
type="text/plain")
+ return http.HttpResponse("Access Forbidden.", status=403,
content_
type="text/plain")
return view(request, *args, **kwargs)
return authorized_view
return decorator
return view(request, *args, **kwargs)
return authorized_view
return decorator
diff --git
a/apps/wiki/templates/admin/wiki/theme/change_list.html
b/apps/wiki/templates/admin/wiki/theme/change_list.html
index
919b0b9
..
3e5d2ea
100755
(executable)
--- a/
apps/wiki/templates/admin/wiki/theme/change_list.html
+++ b/
apps/wiki/templates/admin/wiki/theme/change_list.html
@@
-21,7
+21,7
@@
<a id="redmine-table-switch">↓ {% trans "Table for Redmine wiki" %} ↓</a>
<div id="redmine-table" style="display:none; padding:1em; border: 1px solid #aaa;">
<a id="redmine-table-switch">↓ {% trans "Table for Redmine wiki" %} ↓</a>
<div id="redmine-table" style="display:none; padding:1em; border: 1px solid #aaa;">
- |{% for theme in cl.get_query
_
set %}[[{{ theme }}]]|{% if forloop.counter|divisibleby:7 %}<br/>
+ |{% for theme in cl.get_queryset %}[[{{ theme }}]]|{% if forloop.counter|divisibleby:7 %}<br/>
|{% endif %}{% endfor %}
</div>
|{% endif %}{% endfor %}
</div>
diff --git
a/apps/wiki_img/views.py
b/apps/wiki_img/views.py
index
08a0a03
..
2b8dd67
100644
(file)
--- a/
apps/wiki_img/views.py
+++ b/
apps/wiki_img/views.py
@@
-7,7
+7,7
@@
from django.core.urlresolvers import reverse
from wiki.helpers import (JSONResponse, JSONFormInvalid, JSONServerError,
ajax_require_permission)
from wiki.helpers import (JSONResponse, JSONFormInvalid, JSONServerError,
ajax_require_permission)
-from django
import http
+from django
.http import Http404, HttpResponse, HttpResponseForbidden
from django.shortcuts import get_object_or_404, render
from django.views.decorators.http import require_GET, require_POST
from django.conf import settings
from django.shortcuts import get_object_or_404, render
from django.views.decorators.http import require_GET, require_POST
from django.conf import settings
@@
-188,7
+188,7
@@
def diff(request, object_id):
docA = ""
docB = doc.at_revision(revB).materialize()
docA = ""
docB = doc.at_revision(revB).materialize()
- return
http.
HttpResponse(nice_diff.html_diff_table(docA.splitlines(),
+ return HttpResponse(nice_diff.html_diff_table(docA.splitlines(),
docB.splitlines(), context=3))
docB.splitlines(), context=3))
diff --git
a/redakcja/settings/common.py
b/redakcja/settings/common.py
index
0c1a009
..
5146dcd
100644
(file)
--- a/
redakcja/settings/common.py
+++ b/
redakcja/settings/common.py
@@
-79,7
+79,7
@@
MIDDLEWARE_CLASSES = (
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django_cas.middleware.CASMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django_cas.middleware.CASMiddleware',
- 'django.
middleware.doc
.XViewMiddleware',
+ 'django.
contrib.admindocs.middleware
.XViewMiddleware',
'pagination.middleware.PaginationMiddleware',
'maintenancemode.middleware.MaintenanceModeMiddleware',
)
'pagination.middleware.PaginationMiddleware',
'maintenancemode.middleware.MaintenanceModeMiddleware',
)