core: removed pyfeed and xe dependencies:
pyfeed and xe where still used only for date format handling, and there is already dateutil which is a dependency of Wokkel.
Furthermore pyfeed and xe are still not on pypi, causing troubles for installation with pip
This commit is contained in:
parent
6bbcbaf522
commit
06663b9571
1 changed files with 11 additions and 20 deletions
|
|
@ -28,16 +28,15 @@ from twisted.python import failure
|
|||
from sat.core import exceptions
|
||||
from sat.tools import xml_tools
|
||||
from sat.tools import sat_defer
|
||||
from sat.tools import utils
|
||||
from sat.tools.common import data_format
|
||||
|
||||
# XXX: tmp.pubsub is actually use instead of wokkel version
|
||||
from wokkel import pubsub
|
||||
try:
|
||||
from feed.date import rfc3339
|
||||
except ImportError:
|
||||
raise exceptions.MissingModule(u"Missing module pyfeed, please download/install it from http://home.avvanta.com/~steveha/pyfeed.html")
|
||||
import uuid
|
||||
import time
|
||||
import dateutil
|
||||
import calendar
|
||||
import urlparse
|
||||
|
||||
NS_MICROBLOG = 'urn:xmpp:microblog:0'
|
||||
|
|
@ -252,13 +251,13 @@ class XEP_0277(object):
|
|||
except StopIteration:
|
||||
msg = u'No atom updated element found in the pubsub item {}'.format(id_)
|
||||
raise failure.Failure(exceptions.DataError(msg))
|
||||
microblog_data[u'updated'] = unicode(rfc3339.tf_from_timestamp(unicode(updated_elt)))
|
||||
microblog_data[u'updated'] = unicode(calendar.timegm(dateutil.parser.parse(unicode(updated_elt)).utctimetuple()))
|
||||
try:
|
||||
published_elt = entry_elt.elements(NS_ATOM, 'published').next()
|
||||
except StopIteration:
|
||||
microblog_data[u'published'] = microblog_data[u'updated']
|
||||
else:
|
||||
microblog_data[u'published'] = unicode(rfc3339.tf_from_timestamp(unicode(published_elt)))
|
||||
microblog_data[u'published'] = unicode(calendar.timegm(dateutil.parser.parse(unicode(published_elt)).utctimetuple()))
|
||||
|
||||
# links
|
||||
for link_elt in entry_elt.elements(NS_ATOM, 'link'):
|
||||
|
|
@ -421,9 +420,9 @@ class XEP_0277(object):
|
|||
## published/updated time ##
|
||||
current_time = time.time()
|
||||
entry_elt.addElement('updated',
|
||||
content=rfc3339.timestamp_from_tf(float(data.get('updated', current_time))))
|
||||
content = utils.xmpp_date(float(data.get('updated', current_time))))
|
||||
entry_elt.addElement('published',
|
||||
content=rfc3339.timestamp_from_tf(float(data.get('published', current_time))))
|
||||
content = utils.xmpp_date(float(data.get('published', current_time))))
|
||||
|
||||
## categories ##
|
||||
for tag in data_format.dict2iter("tag", data):
|
||||
|
|
|
|||
Loading…
Reference in a new issue