mirror of
https://github.com/dolphin-emu/www.git
synced 2025-02-12 21:28:13 +00:00
Port to Python 3.x and Django 1.7.
Requires a patched Zinnia and django-tagging for the time being since they are still broken with 1.7. Some tools are still missing: glue and fabric. The application itself starts but is probably still buggy - not tried with an actual database and real data.
This commit is contained in:
parent
df8299c014
commit
63b963dec7
@ -1,8 +1,8 @@
|
||||
from django.db import models
|
||||
from zinnia.models.entry import EntryAbstractClass
|
||||
from zinnia.models_bases.entry import AbstractEntry
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from models import BlogSerie
|
||||
from dolweb.blog.models import BlogSerie
|
||||
|
||||
# Why this file?
|
||||
# "Do not put your abstract model in a file named models.py, it will not work
|
||||
@ -10,7 +10,7 @@ from models import BlogSerie
|
||||
# http://django-blog-zinnia.readthedocs.org/en/v0.12.3/how-to/extending_entry_model.html#writing-model-extension
|
||||
|
||||
|
||||
class BlogEntry(EntryAbstractClass):
|
||||
class BlogEntry(AbstractEntry):
|
||||
"""
|
||||
Represents a blog entry. Adds an optional `serie` field to the default
|
||||
Zinnia model.
|
||||
@ -51,5 +51,5 @@ class BlogEntry(EntryAbstractClass):
|
||||
def previous_entry_in_serie(self):
|
||||
return self.relative_entry_in_serie(-1)
|
||||
|
||||
class Meta(EntryAbstractClass.Meta):
|
||||
class Meta(AbstractEntry.Meta):
|
||||
abstract = True
|
||||
|
@ -3,7 +3,7 @@ from django.core.urlresolvers import reverse
|
||||
from django.http import Http404
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.translation import ugettext as _
|
||||
from models import BlogSerie
|
||||
from dolweb.blog.models import BlogSerie
|
||||
from zinnia.feeds import EntryFeed
|
||||
|
||||
|
||||
|
@ -13,8 +13,8 @@ class BlogSerie(models.Model):
|
||||
name = models.CharField(max_length=255, db_index=True)
|
||||
visible = models.BooleanField(default=True)
|
||||
image = models.ImageField(
|
||||
_('image'), blank=True, upload_to=UPLOAD_TO,
|
||||
help_text=_('Used for illustration.'))
|
||||
'image', blank=True, upload_to=UPLOAD_TO,
|
||||
help_text='Used for illustration.')
|
||||
|
||||
@property
|
||||
def entries_reversed(self):
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% load i18n zinnia_tags blog_tags %}
|
||||
{% load url from future %}
|
||||
<div style="margin-bottom: 1em">
|
||||
<form method="get" action="{% url 'zinnia_entry_search' %}" role="search">
|
||||
<form method="get" action="{% url 'zinnia:entry_search' %}" role="search">
|
||||
<div class="input-group">
|
||||
<input type="text" placeholder="{% trans "Search articles" %}" name="pattern" class="form-control" />
|
||||
<span class="input-group-btn">
|
||||
|
@ -2,7 +2,7 @@ from django.conf.urls import patterns, url, include
|
||||
from dolweb.blog.feeds import SerieFeed
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^', include('zinnia.urls')),
|
||||
url(r'^', include('zinnia.urls', namespace='zinnia')),
|
||||
# url(r'^comments/', include('django.contrib.comments.urls')),
|
||||
url(r'^feeds/serie/(?P<pk>[0-9]+)$', SerieFeed(), name='dolweb_blog_serie_feed'),
|
||||
)
|
||||
|
@ -73,6 +73,6 @@ def list_compat(request, first_char=NOT_ALPHA_CHAR, filter_by=None):
|
||||
ts = max(rating.latest.timestamp, cat_dict[title].page.latest.timestamp)
|
||||
games.append((rating, CATEGORIES[cat_dict[title].cat], ts, hash))
|
||||
|
||||
return { 'games': games, 'pages': [NOT_ALPHA_CHAR] + list(string.uppercase),
|
||||
return { 'games': games, 'pages': [NOT_ALPHA_CHAR] + list(string.ascii_uppercase),
|
||||
'page': first_char, 'all_ratings': (5, 4, 3, 2, 1),
|
||||
'filter_by': filter_by }
|
||||
|
3
dolweb/docs/templates/docs-faq.html
vendored
3
dolweb/docs/templates/docs-faq.html
vendored
@ -2,7 +2,6 @@
|
||||
|
||||
{% load docs %}
|
||||
{% load i18n %}
|
||||
{% load markup %}
|
||||
{% block "metadescr" %}{% trans "The Official Dolphin FAQ answers all the questions that people often ask about Dolphin." %}{% endblock %}
|
||||
|
||||
{% block "title" %}{% trans "Frequently Asked Questions" %}{% endblock %}
|
||||
@ -46,7 +45,7 @@
|
||||
<a class="anchor" href="#{{ question.slug }}">¶</a></h3>
|
||||
|
||||
<div class="faq-answer {% if not question.text|faq_can_translate %}always-ltr{% endif %}">
|
||||
{{ question.text|faq_translate|markdown:"safe" }}
|
||||
{{ question.text|faq_translate|markdown }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</section>
|
||||
|
2
dolweb/docs/templates/docs-guide.html
vendored
2
dolweb/docs/templates/docs-guide.html
vendored
@ -9,7 +9,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block "body" %}
|
||||
<p><a class="back-link" href="{% url docs-guides-index %}">« {% trans "Go back to the guides list" %}</a></p>
|
||||
<p><a class="back-link" href="{% url 'docs-guides-index' %}">« {% trans "Go back to the guides list" %}</a></p>
|
||||
|
||||
<div style="text-align: center;">
|
||||
<script type="text/javascript"><!--
|
||||
|
@ -1,6 +1,10 @@
|
||||
from django import template
|
||||
from django.template.defaultfilters import stringfilter
|
||||
from django.utils.safestring import mark_safe
|
||||
from dolweb.utils.dyni18n import translate, has_translation
|
||||
|
||||
import markdown
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@register.filter
|
||||
@ -10,3 +14,8 @@ def faq_translate(text):
|
||||
@register.filter
|
||||
def faq_can_translate(text):
|
||||
return has_translation('dolweb.docs.faq', text)
|
||||
|
||||
@register.filter
|
||||
@stringfilter
|
||||
def markdown(text):
|
||||
return mark_safe(markdown.markdown(text, safe_mode=True))
|
||||
|
@ -1,6 +1,7 @@
|
||||
from django.core.paginator import Paginator, QuerySetPaginator, Page, InvalidPage
|
||||
from functools import reduce
|
||||
|
||||
import math
|
||||
from django.core.paginator import \
|
||||
Paginator, QuerySetPaginator, Page, InvalidPage
|
||||
|
||||
__all__ = (
|
||||
'InvalidPage',
|
||||
@ -42,7 +43,7 @@ class ExPaginator(Paginator):
|
||||
def page(self, number, softlimit=False):
|
||||
try:
|
||||
return super(ExPaginator, self).page(number)
|
||||
except InvalidPage, e:
|
||||
except InvalidPage as e:
|
||||
number = self._ensure_int(number, e)
|
||||
if number > self.num_pages and softlimit:
|
||||
return self.page(self.num_pages, softlimit=False)
|
||||
@ -201,14 +202,14 @@ class DiggPaginator(ExPaginator):
|
||||
self.num_pages, self.body, self.tail, self.padding, self.margin
|
||||
|
||||
# put active page in middle of main range
|
||||
main_range = map(int, [
|
||||
main_range = list(map(int, [
|
||||
math.floor(number-body/2.0)+1, # +1 = shift odd body to right
|
||||
math.floor(number+body/2.0)])
|
||||
math.floor(number+body/2.0)]))
|
||||
# adjust bounds
|
||||
if main_range[0] < 1:
|
||||
main_range = map(abs(main_range[0]-1).__add__, main_range)
|
||||
main_range = list(map(abs(main_range[0]-1).__add__, main_range))
|
||||
if main_range[1] > num_pages:
|
||||
main_range = map((num_pages-main_range[1]).__add__, main_range)
|
||||
main_range = list(map((num_pages-main_range[1]).__add__, main_range))
|
||||
|
||||
# Determine leading and trailing ranges; if possible and appropriate,
|
||||
# combine them with the main range, in which case the resulting main
|
||||
@ -230,7 +231,7 @@ class DiggPaginator(ExPaginator):
|
||||
main_range = [1, max(body, min(number+padding, main_range[1]))]
|
||||
main_range[0] = 1
|
||||
else:
|
||||
leading = range(1, tail+1)
|
||||
leading = list(range(1, tail+1))
|
||||
# basically same for trailing range, but not in ``left_align`` mode
|
||||
if self.align_left:
|
||||
trailing = []
|
||||
@ -246,7 +247,7 @@ class DiggPaginator(ExPaginator):
|
||||
else:
|
||||
main_range = [min(num_pages-body+1, max(number-padding, main_range[0])), num_pages]
|
||||
else:
|
||||
trailing = range(num_pages-tail+1, num_pages+1)
|
||||
trailing = list(range(num_pages-tail+1, num_pages+1))
|
||||
|
||||
# finally, normalize values that are out of bound; this basically
|
||||
# fixes all the things the above code screwed up in the simple case
|
||||
@ -255,7 +256,7 @@ class DiggPaginator(ExPaginator):
|
||||
|
||||
# make the result of our calculations available as custom ranges
|
||||
# on the ``Page`` instance.
|
||||
page.main_range = range(main_range[0], main_range[1]+1)
|
||||
page.main_range = list(range(main_range[0], main_range[1]+1))
|
||||
page.leading_range = leading
|
||||
page.trailing_range = trailing
|
||||
page.page_range = reduce(lambda x, y: x+((x and y) and [False])+y,
|
||||
|
@ -18,7 +18,7 @@
|
||||
<h1>{% blocktrans %}<tt>{{ branch }}</tt> branch{% endblocktrans %}</h1>
|
||||
{% include "downloads-devrel.html" %}
|
||||
|
||||
<p><a class="btn" href="{% url downloads-list branch 1 %}">{% trans "View older versions »" %}</a></p>
|
||||
<p><a class="btn" href="{% url 'downloads-list' branch 1 %}">{% trans "View older versions »" %}</a></p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -38,12 +38,12 @@ src="//pagead2.googlesyndication.com/pagead/show_ads.js">
|
||||
{% endblocktrans %}</div>
|
||||
|
||||
<p>{% trans "Only displaying the <tt>master</tt> branch versions." %}
|
||||
<a class="all-branches" href="{% url downloads-branches %}">{% trans "Show all available branches" %}</a>.
|
||||
<a class="all-branches" href="{% url 'downloads-branches' %}">{% trans "Show all available branches" %}</a>.
|
||||
</p>
|
||||
|
||||
{% include "downloads-devrel.html" with builds=master_builds primclass='btn-info' %}
|
||||
|
||||
<p><a class="btn" href="{% url downloads-list "master" 1 %}">{% trans "View older versions »" %}</a></p>
|
||||
<p><a class="btn" href="{% url 'downloads-list' "master" 1 %}">{% trans "View older versions »" %}</a></p>
|
||||
</div>
|
||||
|
||||
<div style="text-align: center;">
|
||||
|
@ -1,13 +1,13 @@
|
||||
<div class="text-center">
|
||||
<ul class="pagination">
|
||||
{% if page_obj.has_previous %}
|
||||
<li><a href="{% url downloads-list branch page_obj.previous_page_number %}">←</a></li>
|
||||
<li><a href="{% url 'downloads-list' branch page_obj.previous_page_number %}">←</a></li>
|
||||
{% else %}
|
||||
<li class="disabled"><a href="#">←</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% for page in page_obj.leading_range %}
|
||||
<li><a href="{% url downloads-list branch page %}">{{ page }}</a></li>
|
||||
<li><a href="{% url 'downloads-list' branch page %}">{{ page }}</a></li>
|
||||
{% endfor %}
|
||||
|
||||
{% if page_obj.leading_range %}
|
||||
@ -18,7 +18,7 @@
|
||||
{% if page == page_obj.number %}
|
||||
<li class="active"><a href="#">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="{% url downloads-list branch page %}">{{ page }}</a></li>
|
||||
<li><a href="{% url 'downloads-list' branch page %}">{{ page }}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
@ -27,11 +27,11 @@
|
||||
{% endif %}
|
||||
|
||||
{% for page in page_obj.trailing_range %}
|
||||
<li><a href="{% url downloads-list branch page %}">{{ page }}</a></li>
|
||||
<li><a href="{% url 'downloads-list' branch page %}">{{ page }}</a></li>
|
||||
{% endfor %}
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<li><a href="{% url downloads-list branch page_obj.next_page_number %}">→</a></li>
|
||||
<li><a href="{% url 'downloads-list' branch page_obj.next_page_number %}">→</a></li>
|
||||
{% else %}
|
||||
<li class="disabled"><a href="#">→</a></li>
|
||||
{% endif %}
|
||||
|
@ -40,7 +40,7 @@
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
|
||||
<p class="download-btn"><a class="btn btn-primary btn-lg" href="{% url downloads-index %}?ref=btn"><i class="icon-download-alt"></i> {% blocktrans %}Download {{ last_release }} for Windows, Mac and Linux »{% endblocktrans %}</a></p>
|
||||
<p class="download-btn"><a class="btn btn-primary btn-lg" href="{% url 'downloads-index' %}?ref=btn"><i class="icon-download-alt"></i> {% blocktrans %}Download {{ last_release }} for Windows, Mac and Linux »{% endblocktrans %}</a></p>
|
||||
{% if FB_LIKE_PAGE %}
|
||||
<div class="fb-like" data-href="{{ FB_LIKE_PAGE }}" data-send="false" data-layout="button_count" data-width="100" data-show-faces="true"></div>
|
||||
{% endif %}
|
||||
@ -83,7 +83,7 @@
|
||||
<div class="row" style="margin-top: 1em">
|
||||
<div class="col-md-3">
|
||||
<div class="realign ratings-stats well">
|
||||
<h4><a href="{% url compat-index %}">{% trans "Compatibility" %} »</a></h4>
|
||||
<h4><a href="{% url 'compat-index' %}">{% trans "Compatibility" %} »</a></h4>
|
||||
|
||||
<dl>
|
||||
{% for rating in all_ratings %}
|
||||
@ -96,7 +96,7 @@
|
||||
{% include "blog_sidebar.html" %}
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<a href="{% url zinnia_entry_latest_feed %}" class="rss-tag pull-right" title="{% trans "RSS feed of the latest articles" %}"><i class="icon-rss"></i></a>
|
||||
<a href="{% url 'zinnia:entry_latest_feed' %}" class="rss-tag pull-right" title="{% trans "RSS feed of the latest articles" %}"><i class="icon-rss"></i></a>
|
||||
<h2 class="latest-articles">{% trans "Latest articles" %}</h2>
|
||||
{% for article in home_articles %}
|
||||
<div class="well">
|
||||
@ -123,7 +123,7 @@
|
||||
{% endwith %}
|
||||
<abbr class="published" title="{{ article.creation_date|date:"c" }}">{{ article.creation_date|date:"DATE_FORMAT" }}</abbr>
|
||||
{% if article.within_serie %}
|
||||
{% url dolweb.blog.views.serie_view uid=article.within_serie.pk as serie_url %}
|
||||
{% url 'dolweb.blog.views.serie_view' uid=article.within_serie.pk as serie_url %}
|
||||
{% blocktrans with url=serie_url name=article.within_serie.name %}/ Part of serie <a href="{{ url }}">{{ name}}</a>{% endblocktrans %}
|
||||
{% endif %}
|
||||
{% if article.forum_thread %}/ <i class="icon-comments"></i> <a href="{{ article.forum_thread.get_absolute_url }}" title="{% trans "Visit forum thread for this article" %}">{% trans "Forum thread" %}</a>{% endif %}
|
||||
|
@ -2,7 +2,7 @@ from django.conf import settings
|
||||
from django.http import Http404, HttpResponse
|
||||
|
||||
import base64
|
||||
import commands
|
||||
import subprocess
|
||||
|
||||
def make_401_response():
|
||||
response = HttpResponse()
|
||||
@ -25,4 +25,4 @@ def run_command(request, cmd):
|
||||
if tuple(authenticator) not in settings.MGMT_AUTHORIZED_USERS:
|
||||
return make_401_response()
|
||||
|
||||
return HttpResponse(commands.getoutput(cmd), 'text/plain')
|
||||
return HttpResponse(subprocess.check_output(cmd, shell=True), 'text/plain')
|
||||
|
@ -197,7 +197,6 @@ INSTALLED_APPS = (
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.humanize',
|
||||
'django.contrib.markup',
|
||||
|
||||
# External
|
||||
'bootstrapform',
|
||||
@ -319,6 +318,8 @@ MGMT_AUTHORIZED_USERS = []
|
||||
local_settings_file = os.path.join(PROJECT_ROOT, 'dolweb', 'local_settings.py')
|
||||
if os.path.exists(local_settings_file):
|
||||
try:
|
||||
execfile(os.path.join(local_settings_file), globals(), locals())
|
||||
except IOError, ImportError:
|
||||
print 'Warning: could not import dolweb.local_settings'
|
||||
with open(local_settings_file) as fp:
|
||||
code = compile(fp.read(), local_settings_file, 'exec')
|
||||
exec(code, globals(), locals())
|
||||
except (IOError, ImportError):
|
||||
print('Warning: could not import dolweb.local_settings')
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
<link rel="shortcut icon" href="{% static "img/favicon.ico" %}" />
|
||||
|
||||
<link rel="alternate" type="application/rss+xml" title="{% trans "Latest blog articles" %}" href="{% url zinnia_entry_latest_feed %}" />
|
||||
<link rel="alternate" type="application/rss+xml" title="{% trans "Latest blog articles" %}" href="{% url 'zinnia:entry_latest_feed' %}" />
|
||||
|
||||
{% for langshort, langname in LANGUAGES %}
|
||||
{% if langshort != LANGUAGE_CODE|short %}
|
||||
@ -65,16 +65,16 @@
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-logo" href="{% url home %}"><img src="{% static "img/logo.png" %}" height="32" alt="{% trans "Dolphin Emulator" %}"></a>
|
||||
<a class="navbar-logo" href="{% url 'home' %}"><img src="{% static "img/logo.png" %}" height="32" alt="{% trans "Dolphin Emulator" %}"></a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav pull-left">
|
||||
<li><a href="{% url downloads-index %}">{% trans "Download" %}</a></li>
|
||||
<li><a href="{% url zinnia_entry_archive_index %}">{% trans "Articles" %}</a></li>
|
||||
<li><a href="{% url media-all %}">{% trans "Screenshots" %}</a></li>
|
||||
<li><a href="{% url docs-faq %}">{% trans "FAQ" %}</a></li>
|
||||
<li><a href="{% url docs-guides-index %}">{% trans "Guides" %}</a></li>
|
||||
<li><a href="{% url compat-index %}">{% trans "Compatibility" %}</a></li>
|
||||
<li><a href="{% url 'downloads-index' %}">{% trans "Download" %}</a></li>
|
||||
<li><a href="{% url 'zinnia:entry_archive_index' %}">{% trans "Articles" %}</a></li>
|
||||
<li><a href="{% url 'media-all' %}">{% trans "Screenshots" %}</a></li>
|
||||
<li><a href="{% url 'docs-faq' %}">{% trans "FAQ" %}</a></li>
|
||||
<li><a href="{% url 'docs-guides-index' %}">{% trans "Guides" %}</a></li>
|
||||
<li><a href="{% url 'compat-index' %}">{% trans "Compatibility" %}</a></li>
|
||||
<li><a href="{{ FORUM_URL }}">{% trans "Forum" %}</a></li>
|
||||
<li><a href="{{ WIKI_URL }}">{% trans "Wiki" %}</a></li>
|
||||
<li><a href="{{ GIT_BROWSE_URL }}">{% trans "Code" %}</a></li>
|
||||
|
@ -6,7 +6,7 @@ TO_FULL = {
|
||||
'cn': 'zh_CN',
|
||||
'ms': 'ms_MY',
|
||||
}
|
||||
TO_FULL_INVERTED = dict((v.lower(), k) for (k, v) in TO_FULL.iteritems())
|
||||
TO_FULL_INVERTED = dict((v.lower(), k) for (k, v) in TO_FULL.items())
|
||||
|
||||
_accepted = {}
|
||||
def get_language_from_request(request, check_path=False):
|
||||
|
@ -1,21 +1,26 @@
|
||||
Django==1.4
|
||||
Fabric==1.5.3
|
||||
Markdown==2.2.0
|
||||
MySQL-python==1.2.4
|
||||
PIL==1.1.7
|
||||
Pillow==1.7.8
|
||||
beautifulsoup4==4.3.1
|
||||
distribute==0.6.34
|
||||
django-annoying==0.7.6
|
||||
django-bootstrap-form==2.0.3
|
||||
django-debug-toolbar==0.9.4
|
||||
django-sslify==0.2
|
||||
glue==0.3
|
||||
paramiko==1.9.0
|
||||
polib==1.0.3
|
||||
pycrypto==2.6
|
||||
pymongo==2.4.2
|
||||
requests==1.1.0
|
||||
sorl-thumbnail==11.12
|
||||
wsgiref==0.1.2
|
||||
django-blog-zinnia==0.12.3
|
||||
Django==1.7b1
|
||||
Fabric==1.8.3
|
||||
Jinja2==2.7.2
|
||||
Markdown==2.4
|
||||
MarkupSafe==0.21
|
||||
Pillow==2.4.0
|
||||
beautifulsoup4==4.3.2
|
||||
django-annoying==0.7.9
|
||||
-e git+git@github.com:delroth/django-blog-zinnia.git@f078cfe0a594477d2fc66db29a58cb24736a12f2#egg=django_blog_zinnia-develop
|
||||
django-bootstrap-form==3.1
|
||||
django-debug-toolbar==1.1
|
||||
django-mptt==0.6.0
|
||||
django-sslify==0.2.3
|
||||
django-tagging==0.3.2
|
||||
django-xmlrpc==0.1.5
|
||||
ecdsa==0.11
|
||||
glue==0.9.4
|
||||
paramiko==1.12.3
|
||||
polib==1.0.4
|
||||
pycrypto==2.6.1
|
||||
pymongo==2.7
|
||||
pyparsing==2.0.2
|
||||
pytz==2014.2
|
||||
requests==2.2.1
|
||||
sorl-thumbnail==11.12.1b
|
||||
sqlparse==0.1.11
|
||||
|
Loading…
x
Reference in New Issue
Block a user