From b2de7b912828575a24950991103d3359feec56d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Thu, 11 Oct 2012 11:31:13 +0200
Subject: [PATCH] Avoid accessing object just to fetch its uid.

---
 master/product/Vifib/Tool/SlapTool.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/master/product/Vifib/Tool/SlapTool.py b/master/product/Vifib/Tool/SlapTool.py
index f3ac604aa..0d895779d 100644
--- a/master/product/Vifib/Tool/SlapTool.py
+++ b/master/product/Vifib/Tool/SlapTool.py
@@ -1154,7 +1154,9 @@ class SlapTool(BaseTool):
 
   @UnrestrictedMethod
   def _getComputerUidByReference(self, computer_reference):
-    return self._getComputerDocument(computer_reference).getUid()
+    return self.getPortalObject().portal_catalog.unrestrictedSearchResults(
+      portal_type='Computer', reference=computer_reference,
+      validation_state="validated")[0].UID
 
   def _getComputerPartitionDocument(self, computer_reference,
                                     computer_partition_reference):
-- 
2.30.9