gjhiggins/rdflib — Issue #134: Two tweaks from "layercake"
Author: gjhiggins
Created: 2011-10-19 01:29:17+00:00
State: open

Originally filed by gjhigg...@gmail.com on 2010-08-06T03:31:41

Two small changes to rdflib.term by Chimezie made to his 2.4.X "layercake-python" setup:

http://groups.google.com/group/fuxi-discussion/msg/d9f3be240efb81ab

They don't appear to have been propagated to the rdflib main branch, so I'll simply post the diff for immediacy of inspection (with an attached diff for convenience) :

Index: /opt/rdflib-svn/rdflib/term.py
============================================
--- /opt/rdflib-svn/rdflib/term.py	(revision 1890)
+++ /opt/rdflib-svn/rdflib/term.py	(working copy)
@@ -129,6 +129,8 @@
def __eq__(self, other):
if isinstance(other, URIRef):
return unicode(self)==unicode(other)
+ elif isinstance(other,basestring):
+ return unicode(self)==other
else:
return False

@@ -719,7 +721,10 @@
return strptime(v, "%H:%M:%S")

def _strToDate(v) :
- tstr = strptime(v, "%Y-%m-%d")
+ try:
+ tstr = strptime(v,"%Y-%m-%d")
+ except:
+ tstr = strptime(v,"%Y-%m-%dZ")
return date(tstr.tm_year, tstr.tm_mon, tstr.tm_mday)

def _strToDateTime(v) :