From 4502ee672780073ca2744a6795d83f1ebbc1eccb Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Mon, 28 Mar 2011 11:32:01 +0200 Subject: [PATCH] [entropy.client.services] add "url" metadatum to Document --- libraries/entropy/client/services/interfaces.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libraries/entropy/client/services/interfaces.py b/libraries/entropy/client/services/interfaces.py index 810d00140..550e41da0 100644 --- a/libraries/entropy/client/services/interfaces.py +++ b/libraries/entropy/client/services/interfaces.py @@ -86,6 +86,9 @@ class Document(dict): # Document hash table key pointing to document timestamp (float) DOCUMENT_TIMESTAMP_ID = "ts" + # Document hash table key pointing to document URL + DOCUMENT_URL_ID = "url" + def __init__(self, repository_id, document_id, document_type_id): """ Document constructor. @@ -182,7 +185,16 @@ class Document(dict): @return: document timestamp @rtype: float """ - return self.get(Document.DOCUMENT_TIMESTAMP_ID) + return self.get(Document.DOCUMENT_TIMESTAMP_ID, 0.0) + + def document_url(self): + """ + Return the document url, if any. + + @return: document URL + @rtype: string or None + """ + return self.get(Document.DOCUMENT_URL_ID) def is_icon(self): """