Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sun, 15 Dec 2013 18:58:51 UTC
Commit: 81da2cfa60769dd89d0bdddba64ed3112cd275c6
https://github.com/geany/www.geany.org/commit/81da2cfa60769dd89d0bdddba64ed…
Log Message:
-----------
Delete old about page (was renamed to help.html)
Modified Paths:
--------------
pastebin/templates/pastebin/about.html
Modified: pastebin/templates/pastebin/about.html
30 files changed, 0 insertions(+), 30 deletions(-)
===================================================================
@@ -1,30 +0,0 @@
-{% extends "pastebin/base.html" %}
-
-{% block meta_title %}
- About | {{ block.super }}
-{% endblock %}
-
-{% block main %}
-<div class="well">
-
-<h3>What is pastebin?</h3>
-<p>pastebin is here to help you collaborate on debugging code snippets. If you're not familiar with the idea,
-most people use it like this:</p>
-<ul>
-<li><a href="{% url 'home' %}">submit</a> a code fragment to pastebin,
-getting a url like http://{{ request.site.domain }}/abc1234</li>
-<li>paste the url into an IRC or IM conversation</li>
-<li>someone responds by reading and perhaps submitting a modification of your code</li>
-</ul>
-
-<h3>How can I delete a post?</h3>
-<p>Your posted snippets are remembered in your session, you will be able to delete the snippet from the same browser you posted from -
-simply view the post and click the "delete" link.</p>
-<p>In other cases, contact us and we will delete it for you.</p>
-
-<h3>Can I get the source?</h3>
-<p>The source code to this site is available under a BSD licence.
-You can get the source code from <a href="https://github.com/geany/www.geany.org">https://github.com/geany/www.geany.org</a>.</p>
-
-</div>
-{% endblock %}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sun, 15 Dec 2013 18:14:28 UTC
Commit: ae77c6958ca40570f9a3cafe453342ae90c46bb6
https://github.com/geany/www.geany.org/commit/ae77c6958ca40570f9a3cafe45334…
Log Message:
-----------
Rename Pastebin About page to Help
Modified Paths:
--------------
pastebin/templates/pastebin/base.html
pastebin/templates/pastebin/help.html
pastebin/urls.py
Modified: pastebin/templates/pastebin/base.html
6 files changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -9,7 +9,7 @@
{% block top_menu %}
{% url 'home' as url_home %}
-{% url 'about' as url_about %}
+{% url 'help' as url_help %}
{% url 'api' as url_api %}
{% url 'snippet_list' as url_snippet_list %}
@@ -23,8 +23,8 @@
<li class="{% if request.path = url_home %} active{% endif %}">
<a href="{{ url_home }}">New snippet</a>
</li>
- <li class="{% if request.path = url_about %} active{% endif %}">
- <a href="{{ url_about }}">About</a>
+ <li class="{% if request.path = url_help %} active{% endif %}">
+ <a href="{{ url_help }}">Help</a>
</li>
<li class="{% if request.path = url_api %} active{% endif %}">
<a href="{{ url_api }}">API</a>
Modified: pastebin/templates/pastebin/help.html
26 files changed, 26 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,26 @@
+{% extends "pastebin/base.html" %}
+
+{% block meta_title %}
+ About | {{ block.super }}
+{% endblock %}
+
+{% block main %}
+<div class="well">
+
+<h3>What is pastebin?</h3>
+<p>This pastebin is here to help you collaborate on debugging code snippets. If you're not familiar with the idea,
+most people use it like this:</p>
+<ul>
+<li><a href="{% url 'home' %}">submit</a> a code fragment to pastebin,
+getting a url like http://{{ request.site.domain }}/abc1234</li>
+<li>paste the url into an IRC or IM conversation</li>
+<li>someone responds by reading and perhaps submitting a modification of your code</li>
+</ul>
+
+<h3>How can I delete a post?</h3>
+<p>Your posted snippets are remembered in your session, you will be able to delete the snippet from the same browser you posted from -
+simply view the post and click the "delete" link.</p>
+<p>In other cases, contact us and we will delete it for you.</p>
+
+</div>
+{% endblock %}
Modified: pastebin/urls.py
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -22,8 +22,8 @@
# no admin on this site
url(r'^admin/', 'mezzanine.core.views.page_not_found'),
- url(r'^about/$', TemplateView.as_view(template_name='pastebin/about.html'), name='about'),
- url(r'^about/api/$', TemplateView.as_view(template_name='pastebin/api.html'), name='api'),
+ url(r'^help/$', TemplateView.as_view(template_name='pastebin/help.html'), name='help'),
+ url(r'^api/$', TemplateView.as_view(template_name='pastebin/api.html'), name='api'),
url(r'^api/$', 'pastebin.views.api_create'),
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Wed, 30 Oct 2013 21:55:11 UTC
Commit: 1f80507adc4023a1d4520c72c7ed37859b6b2702
https://github.com/geany/www.geany.org/commit/1f80507adc4023a1d4520c72c7ed3…
Log Message:
-----------
Show snippet TTL as forever if it is (almost) forever
Modified Paths:
--------------
pastebin/templates/pastebin/snippet_details.html
pastebin/templatetags/pastebin_tags.py
Modified: pastebin/templates/pastebin/snippet_details.html
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -14,7 +14,7 @@
</h2>
<div class="snippet-options">
- <abbr title="Time to life">TTL:</abbr> {{ snippet.expires|timeuntil }}
+ <abbr title="Time to life">TTL:</abbr> {{ snippet.expires|timeuntil_or_forever }}
—
{% if snippet.pk|in_list:request.session.snippet_list %}
<a onclick="return confirm('Really delete this snippet?')" href="{% url 'snippet_delete' snippet.secret_id %}">Delete</a>
Modified: pastebin/templatetags/pastebin_tags.py
20 files changed, 18 insertions(+), 2 deletions(-)
===================================================================
@@ -3,18 +3,22 @@
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
-#
+#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.template import Library
+from django.template.defaultfilters import timeuntil
+from django.utils.timezone import now
from pastebin.highlight import pygmentize
+NINETY_YEARS_IN_DAYS = 32850 # 90 * 365
+
register = Library()
@@ -27,6 +31,18 @@ def in_list(value, arg):
#----------------------------------------------------------------------
@register.filter
+def timeuntil_or_forever(snippet_expire):
+ ttl = snippet_expire - now()
+ if ttl.days > NINETY_YEARS_IN_DAYS:
+ # snippet TTL 'forever' is defined as 100 years, so if remaining TTL is more than
+ # (90 * 365) days, we most probably got a snippet with TTL 'forever'
+ return u'forever'
+ else:
+ return timeuntil(snippet_expire)
+
+
+#----------------------------------------------------------------------
+(a)register.filter
def highlight(snippet, line_count=None):
h = pygmentize(snippet.content, snippet.lexer)
if h:
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sun, 15 Dec 2013 18:03:26 UTC
Commit: 9f2acf580c590f90f911568220ae316cfb55fd87
https://github.com/geany/www.geany.org/commit/9f2acf580c590f90f911568220ae3…
Log Message:
-----------
Better use django.conf.timezone.now() instead of datetime.datetime.now()
django.conf.timezone.now() is timezone aware while the good old datetime is not.
Modified Paths:
--------------
pastebin/views.py
Modified: pastebin/views.py
4 files changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -12,7 +12,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from datetime import datetime
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
@@ -21,6 +20,7 @@
HttpResponse, HttpResponseForbidden
from django.shortcuts import render_to_response, get_object_or_404
from django.template.context import RequestContext
+from django.utils import timezone
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from honeypot.decorators import check_honeypot
@@ -47,7 +47,7 @@ def _get_snippet_list(no_content=False):
#----------------------------------------------------------------------
def _clean_expired_snippets():
- deleteable_snippets = Snippet.objects.filter(expires__lte=datetime.now())
+ deleteable_snippets = Snippet.objects.filter(expires__lte=timezone.now())
if deleteable_snippets:
deleteable_snippets.delete()
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sun, 05 Jan 2014 18:46:51 UTC
Commit: 9b8a304cfed49212e16c5984c6bb7f4d5f3c3b7c
https://github.com/geany/www.geany.org/commit/9b8a304cfed49212e16c5984c6bb7…
Log Message:
-----------
And again, django.utils.timezone.now()
Modified Paths:
--------------
pastebin/forms.py
Modified: pastebin/forms.py
7 files changed, 4 insertions(+), 3 deletions(-)
===================================================================
@@ -12,11 +12,12 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from datetime import timedelta
from django import forms
+from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from pastebin.highlight import LEXER_LIST, LEXER_DEFAULT
from pastebin.models import Snippet, Spamword
-import datetime
#===============================================================================
@@ -72,8 +73,8 @@ def save(self, parent=None, *args, **kwargs):
self.instance.parent = parent
# Add expire datestamp
- self.instance.expires = datetime.datetime.now() + \
- datetime.timedelta(seconds=int(self.cleaned_data['expire_options']))
+ self.instance.expires = timezone.now() + \
+ timedelta(seconds=int(self.cleaned_data['expire_options']))
# Save snippet in the db
forms.ModelForm.save(self, *args, **kwargs)
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sun, 05 Jan 2014 18:39:40 UTC
Commit: 03ff9c72c55967385b2bd79056c33f56519f53de
https://github.com/geany/www.geany.org/commit/03ff9c72c55967385b2bd79056c33…
Log Message:
-----------
Use django.utils.timezone.now() instead of datetime.now()
This prevents timezone errors in Django. django.utils.timezone.now() is
Timezone aware.
Modified Paths:
--------------
pastebin/models.py
Modified: pastebin/models.py
11 files changed, 6 insertions(+), 5 deletions(-)
===================================================================
@@ -3,20 +3,21 @@
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
-#
+#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from datetime import timedelta
from django.core.urlresolvers import reverse
from django.db import models
+from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from pastebin.highlight import LEXER_DEFAULT
-import datetime
import random
import re
import time
@@ -66,7 +67,7 @@ def _readable_delta(self, from_seconds, until_seconds=None):
until_seconds = time.time()
seconds = until_seconds - from_seconds
- delta = datetime.timedelta(seconds=seconds)
+ delta = timedelta(seconds=seconds)
# deltas store time as seconds and days, we have to get hours and minutes ourselves
delta_minutes = delta.seconds // 60
@@ -93,7 +94,7 @@ def content_splitted(self):
#----------------------------------------------------------------------
def save(self, *args, **kwargs):
if not self.pk:
- self.published = datetime.datetime.now()
+ self.published = timezone.now()
self.secret_id = generate_secret_id()
self.content_highlighted = self.content
models.Model.save(self, *args, **kwargs)
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sun, 05 Jan 2014 18:29:22 UTC
Commit: d82a171c820ce68b893aeff2b1310fb85b875171
https://github.com/geany/www.geany.org/commit/d82a171c820ce68b893aeff2b1310…
Log Message:
-----------
Implement IRC userlist page
This page dynamically reads currently connected IRC usernames from
/var/tmp/irc_userlist which is filled by the IRC bot.
Modified Paths:
--------------
geany/settings.py
geany/templates/pages/richtextpage.html
geany/templates/pages/support/irc.html
geany/templatetags/geany_tags.py
Modified: geany/settings.py
2 files changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -399,6 +399,8 @@
NIGHTLYBUILDS_BASE_DIR = '/path/to/nightly/builds'
+IRC_USER_LIST_FILE = '/var/tmp/irc_userlist'
+
LOGGING = {
'version': 1,
Modified: geany/templates/pages/richtextpage.html
6 files changed, 6 insertions(+), 0 deletions(-)
===================================================================
@@ -6,6 +6,9 @@
<div class="well">
+{% block content_before %}
+{% endblock %}
+
{% block richtext_content %}
{# render the content as template, e.g. to replace {{ geany_latest_version }} #}
@@ -14,6 +17,9 @@
{# display #}
{{ evaluated_content|richtext_filter|safe }}
+{% block content_after %}
+{% endblock %}
+
{% endblock %}
</div>
Modified: geany/templates/pages/support/irc.html
25 files changed, 25 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,25 @@
+{% extends "pages/richtextpage.html" %}
+
+{% load geany_tags %}
+
+{% block content_after %}
+
+{% get_irc_userlist as irc_userlist %}
+
+<h2>Users</h2>
+
+<p>Currently {{ irc_userlist|length }} users are connected:</p>
+
+<div class="row">
+{% for username in irc_userlist %}
+ <div class="span2">{{ username }}</div>
+
+ {% if forloop.counter|divisibleby:4 %}
+ </div>
+ <div class="row">
+ {% endif %}
+{% endfor %}
+</div>
+
+
+{% endblock %}
Modified: geany/templatetags/geany_tags.py
25 files changed, 22 insertions(+), 3 deletions(-)
===================================================================
@@ -3,18 +3,22 @@
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
-#
+#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django import template
+from django.conf import settings
+from mezzanine.template import Library
+import logging
-register = template.Library()
+register = Library()
+logger = logging.getLogger(__name__)
########################################################################
@@ -51,3 +55,18 @@ def do_evaluate(parser, token):
raise template.TemplateSyntaxError(u'%r tag requires a single argument' %
token.contents.split()[1])
return EvaluateNode(variable, target_var_name)
+
+
+#----------------------------------------------------------------------
+(a)register.as_tag
+def get_irc_userlist():
+ user_list = list()
+ try:
+ with open(settings.IRC_USER_LIST_FILE) as file_h:
+ user_list = file_h.readlines()
+ except IOError, e:
+ logger.error(u'An error occurred reading IRC user list: %s', unicode(e), exc_info=True)
+
+ # remove newline characters
+ user_list = [username.strip() for username in user_list]
+ return sorted(user_list)
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sun, 05 Jan 2014 18:18:24 UTC
Commit: 91acbed5c58197b465b6742acec444fbcaffe81b
https://github.com/geany/www.geany.org/commit/91acbed5c58197b465b6742acec44…
Log Message:
-----------
Add Mezzanine's custom error page handlers to get STATIC_URL resolved in templates
Modified Paths:
--------------
latest_version/urls.py
nightlybuilds/urls.py
pastebin/urls.py
static_docs/urls.py
Modified: latest_version/urls.py
8 files changed, 6 insertions(+), 2 deletions(-)
===================================================================
@@ -3,12 +3,12 @@
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
-#
+#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -23,3 +23,7 @@
content_type='text/plain'),
name='latest_version'),
)
+
+# Adds ``STATIC_URL`` to the context of error pages, so that error pages can use JS, CSS and images.
+handler404 = "mezzanine.core.views.page_not_found"
+handler500 = "mezzanine.core.views.server_error"
Modified: nightlybuilds/urls.py
4 files changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -30,3 +30,7 @@
# use our custom sitemap implementation
url(r"^sitemap\.xml$", 'django.contrib.sitemaps.views.sitemap', sitemaps)
)
+
+# Adds ``STATIC_URL`` to the context of error pages, so that error pages can use JS, CSS and images.
+handler404 = "mezzanine.core.views.page_not_found"
+handler500 = "mezzanine.core.views.server_error"
Modified: pastebin/urls.py
4 files changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -47,3 +47,7 @@
# use our custom sitemap implementation
url(r"^sitemap\.xml$", 'django.contrib.sitemaps.views.sitemap', sitemaps)
)
+
+# Adds ``STATIC_URL`` to the context of error pages, so that error pages can use JS, CSS and images.
+handler404 = "mezzanine.core.views.page_not_found"
+handler500 = "mezzanine.core.views.server_error"
Modified: static_docs/urls.py
8 files changed, 6 insertions(+), 2 deletions(-)
===================================================================
@@ -3,12 +3,12 @@
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
-#
+#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -22,3 +22,7 @@
url(r'^documentation/releasenotes/$', ReleaseNotesView.as_view(), name='releasenotes'),
url(r'^documentation/releasenotes/(?P<version>.*)$', ReleaseNotesView.as_view(), name='releasenotes_for_release'),
)
+
+# Adds ``STATIC_URL`` to the context of error pages, so that error pages can use JS, CSS and images.
+handler404 = "mezzanine.core.views.page_not_found"
+handler500 = "mezzanine.core.views.server_error"
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).