aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--glifestream/apis/__init__.py2
-rw-r--r--glifestream/settings-sample.py3
-rw-r--r--glifestream/stream/models.py31
-rw-r--r--glifestream/usettings/views.py6
-rw-r--r--static/js/glifestream.js30
5 files changed, 38 insertions, 34 deletions
diff --git a/glifestream/apis/__init__.py b/glifestream/apis/__init__.py
index 9f97186..ef79b66 100644
--- a/glifestream/apis/__init__.py
+++ b/glifestream/apis/__init__.py
@@ -38,9 +38,7 @@ API_LIST = (
('webfeed', 'Webfeed'),
('twitter', 'Twitter'),
('fb', 'Facebook'),
- ('friendfeed', 'FriendFeed'),
('identica', 'Identi.ca'),
- ('greader', 'Google Reader'),
('youtube', 'YouTube'),
('vimeo', 'Vimeo'),
('delicious', 'Delicious'),
diff --git a/glifestream/settings-sample.py b/glifestream/settings-sample.py
index 529839f..fc139cf 100644
--- a/glifestream/settings-sample.py
+++ b/glifestream/settings-sample.py
@@ -71,7 +71,7 @@ MEDIA_URL = '/static/'
# URL prefix for admin media. Make sure to use a trailing slash.
# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = '/admin_static/'
+STATIC_URL = '/stream/admin_static/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'YOUR-SECRET-KEY'
@@ -99,6 +99,7 @@ INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
+ 'django.contrib.staticfiles',
'glifestream.gauth',
'glifestream.apis',
'glifestream.stream',
diff --git a/glifestream/stream/models.py b/glifestream/stream/models.py
index ec4c492..ae89707 100644
--- a/glifestream/stream/models.py
+++ b/glifestream/stream/models.py
@@ -1,4 +1,4 @@
-# gLifestream Copyright (C) 2009, 2010, 2013 Wojciech Polak
+# gLifestream Copyright (C) 2009, 2010, 2013, 2015 Wojciech Polak
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@@ -13,11 +13,15 @@
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
+from __future__ import unicode_literals
+
from django.conf import settings
from django.db import models
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
+from django.utils.encoding import python_2_unicode_compatible, smart_text
+
from glifestream.apis import API_LIST
from glifestream.utils.time import now
@@ -31,6 +35,7 @@ except ImportError:
pass
+@python_2_unicode_compatible
class Service (models.Model):
api = models.CharField(_('API'), max_length=16, choices=API_LIST,
default='feed', db_index=True)
@@ -71,10 +76,11 @@ class Service (models.Model):
self.cls = self.api
super(Service, self).save()
- def __unicode__(self):
- return u'%s' % self.name
+ def __str__(self):
+ return '%s' % self.name
+@python_2_unicode_compatible
class Entry (models.Model):
service = models.ForeignKey(Service, verbose_name=_('Service'),
null=False, blank=False)
@@ -120,10 +126,11 @@ class Entry (models.Model):
ordering = '-date_published',
unique_together = (('service', 'guid'),)
- def __unicode__(self):
- return u'%s: %s' % (self.service.name, self.title[0:60])
+ def __str__(self):
+ return '%s: %s' % (self.service.name, smart_text(self.title))
+@python_2_unicode_compatible
class Media (models.Model):
entry = models.ForeignKey(Entry, verbose_name=_('Entry'),
null=False, blank=False)
@@ -134,10 +141,11 @@ class Media (models.Model):
verbose_name_plural = _('Media')
unique_together = (('entry', 'file'),)
- def __unicode__(self):
- return u'%s: %s' % (self.entry.title, self.file.name)
+ def __str__(self):
+ return '%s: %s' % (smart_text(self.entry.title), self.file.name)
+@python_2_unicode_compatible
class Favorite (models.Model):
user = models.ForeignKey(User, db_index=True)
entry = models.ForeignKey(Entry, verbose_name=_('Entry'),
@@ -150,10 +158,11 @@ class Favorite (models.Model):
ordering = '-date_added',
unique_together = (('user', 'entry'),)
- def __unicode__(self):
- return u'%s: %s' % (self.user, self.entry.title[0:60])
+ def __str__(self):
+ return '%s: %s' % (self.user, smart_text(self.entry.title))
+@python_2_unicode_compatible
class List (models.Model):
user = models.ForeignKey(User, db_index=True)
name = models.CharField(_('Name'), max_length=48, null=False, blank=False)
@@ -171,8 +180,8 @@ class List (models.Model):
self.slug = slugify(self.name)
super(List, self).save()
- def __unicode__(self):
- return u'%s: %s' % (self.user, self.name)
+ def __str__(self):
+ return '%s: %s' % (self.user, self.name)
class Pshb (models.Model):
diff --git a/glifestream/usettings/views.py b/glifestream/usettings/views.py
index 5c76944..39aad01 100644
--- a/glifestream/usettings/views.py
+++ b/glifestream/usettings/views.py
@@ -402,12 +402,6 @@ def _import_service(url, title, cls='webfeed'):
url = url.replace('format=atom', 'format=rss_200')
api = 'flickr'
cls = 'photos'
- elif 'friendfeed.com' in url:
- m = re.search(r'friendfeed.com/([\w/]+)\?format=atom', url)
- if m:
- url = m.groups()[0]
- api = 'friendfeed'
- cls = 'links'
elif 'twitter.com' in url:
m = re.search(r'twitter.com/1/statuses/user_timeline/(\w+)\.', url)
if m:
diff --git a/static/js/glifestream.js b/static/js/glifestream.js
index 553ac96..ad9efa3 100644
--- a/static/js/glifestream.js
+++ b/static/js/glifestream.js
@@ -1,5 +1,5 @@
/*
- * gLifestream Copyright (C) 2009, 2010, 2011, 2013 Wojciech Polak
+ * gLifestream Copyright (C) 2009, 2010, 2011, 2013, 2015 Wojciech Polak
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -15,6 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/*jshint indent: 2, white: true, browser: true */
+/*global $, FB, tinyMCE, settings, gettext_msg */
+
(function () {
function parse_id (id) {
var p = id.indexOf ('-');
@@ -454,7 +457,7 @@
this.href = 'http://maps.google.com/?q=' + lat +','+ lng;
}
- p = this.parentNode;
+ var p = this.parentNode;
$('a', p).html (get_map_embed (lat, lng));
$(p).css ('paddingLeft', '0');
this.folded = true;
@@ -547,7 +550,7 @@
function kshortcuts (e) {
var code;
- if (!e) var e = window.event;
+ if (!e) e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
if (e.ctrlKey || e.metaKey || e.altKey)
@@ -803,7 +806,6 @@
[{ name: 'E-mail', href: 'mailto:?subject={URL}&body={TITLE}', className: 'email'},
{ name: 'Twitter', href: 'http://twitter.com/?status={TITLE}:%20{URL}', className: 'twitter'},
{ name: 'Facebook', href: 'http://www.facebook.com/sharer.php?u={URL}&t={TITLE}', className: 'facebook'},
- { name: 'FriendFeed', href: 'http://friendfeed.com/share?url={URL}&title={TITLE}', className: 'friendfeed'},
{ name: 'Delicious', href: 'http://delicious.com/save?url={URL}&title={TITLE}', className: 'delicious'},
{ name: 'Digg', href: 'http://digg.com/submit?phase=2&url={URL}&title={TITLE}', className: 'digg'},
{ name: 'Reddit', href: 'http://reddit.com/submit?url={URL}&title={TITLE}', className: 'reddit'}];
@@ -923,7 +925,7 @@
}
}
}
- }
+ };
function prepare_service_form (data) {
var form = document.getElementById ('service-form');
@@ -967,7 +969,7 @@
obj.onclick = function () {
oauth_configure (data.id);
return false;
- }
+ };
}
else {
var obj = DCE ('input', {type: f.type, id: f.name, name: f.name,
@@ -994,7 +996,7 @@
for (var name in f.deps) {
if (!settings_deps[name])
settings_deps[name] = [];
- settings_deps[name].push ([f.deps[name], row])
+ settings_deps[name].push ([f.deps[name], row]);
}
}
fs.append (row);
@@ -1118,7 +1120,7 @@
sbox.style.display = 'none';
document.body.appendChild (sbox);
initied = true;
- }
+ };
this.open = function (opts) {
self.init ();
@@ -1174,7 +1176,7 @@
$('#overlay').click (this.close);
document.onkeydown = function (e) {
var code;
- if (!e) var e = window.event;
+ if (!e) e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
if (code == 27) { /* escape */
@@ -1211,7 +1213,7 @@
this.scan = function (ctx) {
self.init ();
- $imgs = $('.thumbnails > a:has(img)', ctx);
+ var $imgs = $('.thumbnails > a:has(img)', ctx);
$imgs.each (function (i, v) {
this.rel = $(v).closest ('article').get (0).id;
});
@@ -1258,7 +1260,7 @@
href = href.replace (/-h\//, '/');
return self.open ({src: href, type: type, obj: this});
- }
+ };
this.open = function (opts) {
var src = opts.src;
@@ -1320,7 +1322,7 @@
$('#overlay').click (this.close);
document.onkeydown = function (e) {
var code;
- if (!e) var e = window.event;
+ if (!e) e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
if (code == 27) { /* escape */
@@ -1379,7 +1381,7 @@
var ovl = null;
this.enable = function (level) {
if (typeof level == 'undefined')
- level = '80'
+ level = '80';
if (visible) return;
ovl = document.createElement ('div');
if (ovl) {
@@ -1456,7 +1458,7 @@
for (var p in props) {
if (p == 'style') {
for (var s in props[p])
- obj.style[s] = props.style[s]
+ obj.style[s] = props.style[s];
}
else
obj[p] = props[p];

Return to:

Send suggestions and report system problems to the System administrator.