summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorSiegfried-Angel Gevatter Pujals <siegfried@gevatter.com>2012-10-08 15:49:18 +0200
committerSiegfried-Angel Gevatter Pujals <siegfried@gevatter.com>2012-10-08 15:49:18 +0200
commit24b1b0c3ea071eb4751da43c586ea2249d7607c7 (patch)
tree6d0a835784e98f83eb8ae3d6f6b3634e666c63d2 /python
parentb737cd19dc5672fac993c4a777b9b6605b382f00 (diff)
downloadzeitgeist-24b1b0c3ea071eb4751da43c586ea2249d7607c7.tar.gz
More CurrentOrigin implementation. Various fixes.
Diffstat (limited to 'python')
-rw-r--r--python/client.py2
-rw-r--r--python/datamodel.py32
-rw-r--r--python/mimetypes.py2
3 files changed, 30 insertions, 6 deletions
diff --git a/python/client.py b/python/client.py
index 9976e964..7efdd2d7 100644
--- a/python/client.py
+++ b/python/client.py
@@ -1099,3 +1099,5 @@ class ZeitgeistClient:
_FIND_EVENTS_FOR_TEMPLATES_ARGS = inspect.getargspec(
ZeitgeistClient.find_events_for_templates)[0]
+
+# vim:noexpandtab:ts=4:sw=4
diff --git a/python/datamodel.py b/python/datamodel.py
index 9df75f3e..9595b9d6 100644
--- a/python/datamodel.py
+++ b/python/datamodel.py
@@ -375,10 +375,12 @@ class Subject(list):
Mimetype,
Text,
Storage,
- CurrentUri) = range(8)
+ CurrentUri,
+ CurrentOrigin) = range(9)
- SUPPORTS_NEGATION = (Uri, CurrentUri, Interpretation, Manifestation, Origin, Mimetype)
- SUPPORTS_WILDCARDS = (Uri, CurrentUri, Origin, Mimetype)
+ SUPPORTS_NEGATION = (Uri, CurrentUri, Interpretation, Manifestation,
+ Origin, CurrentOrigin, Mimetype)
+ SUPPORTS_WILDCARDS = (Uri, CurrentUri, Origin, CurrentOrigin, Mimetype)
def __init__(self, data=None):
if data:
@@ -400,8 +402,8 @@ class Subject(list):
def __eq__(self, other):
for field in Subject.Fields:
- if field is Subject.CurrentUri and not self[field] or \
- not other[field]:
+ if field in (Subject.CurrentUri, Subject.CurrentOrigin) and \
+ not self[field] or not other[field]:
continue
if self[field] != other[field]:
return False
@@ -469,7 +471,15 @@ class Subject(list):
self[Subject.Origin] = value
origin = property(get_origin, set_origin,
doc="Read/write property with the URI of the location where the subject can be found. For files this is the parent directory, or for downloaded files it would be the URL of the page where you clicked the download link")
-
+
+ def get_current_origin(self):
+ return self[Subject.CurrentOrigin]
+
+ def set_current_origin(self, value):
+ self[Subject.CurrentOrigin] = value
+ origin = property(get_origin, set_origin,
+ doc="Read/write property with the URI of the location where the subject can be found. For files this is the parent directory, or for downloaded files it would be the URL of the page where you clicked the download link")
+
def get_mimetype(self):
return self[Subject.Mimetype]
@@ -1083,6 +1093,14 @@ class ResultType(_Enumeration):
"different origin, ordered by the popularity of the origins")
LeastPopularEventOrigin = EnumValue(30, "The last event of each "
"different origin, ordered ascendingly by the popularity of the origin")
+ MostRecentCurrentOrigin = EnumValue(31,
+ "The last event of each different subject origin")
+ LeastRecentCurrentOrigin = EnumValue(32, "The last event of each different "
+ "subject origin, ordered by least recently used first")
+ MostPopularCurrentOrigin = EnumValue(33, "The last event of each different "
+ "subject origin, ordered by the popularity of the origins")
+ LeastPopularCurrentOrigin = EnumValue(34, "The last event of each different "
+ "subject origin, ordered ascendingly by the popularity of the origin")
# We should eventually migrate over to those names to disambiguate
# subject origin and event origin:
@@ -1180,3 +1198,5 @@ if __name__ == "__main__":
print "Success"
end_symbols = time.time()
print >> sys.stderr, "Import time: %s" % (end_symbols - start_symbols)
+
+# vim:noexpandtab:ts=4:sw=4
diff --git a/python/mimetypes.py b/python/mimetypes.py
index a4e80572..c099f8c6 100644
--- a/python/mimetypes.py
+++ b/python/mimetypes.py
@@ -249,3 +249,5 @@ SCHEMES = tuple((
("davs://", Manifestation.REMOTE_DATA_OBJECT),
("smb://", Manifestation.REMOTE_DATA_OBJECT),
))
+
+# vim:noexpandtab:ts=4:sw=4