[Zope3-checkins] CVS: Zope3/src/zope/app/browser/cache - cacheable.py:1.4 cacheableedit.pt:1.3

Viktorija Zaksiene ryzaja@codeworks.lt
Thu, 23 Jan 2003 04:53:59 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/cache
In directory cvs.zope.org:/tmp/cvs-serv17263/src/zope/app/browser/cache

Modified Files:
	cacheable.py cacheableedit.pt 
Log Message:
Added getInterface method to caches.
Fixed cachable's to use the right template.


=== Zope3/src/zope/app/browser/cache/cacheable.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/cache/cacheable.py:1.3	Thu Jan  9 09:12:58 2003
+++ Zope3/src/zope/app/browser/cache/cacheable.py	Thu Jan 23 04:53:26 2003
@@ -35,12 +35,23 @@
 
     __used_for__ = IAnnotatable
 
-    form = ViewPageTemplateFile("edit.pt")
+    form = ViewPageTemplateFile("cacheableedit.pt")
 
     def __init__(self, *args):
         super(CacheableView, self).__init__(*args)
-        self.cachable = getAdapter(self.context, ICacheable)
-        setUpEditWidgets(self, ICacheable, self.cachable)
+        self.cacheable = getAdapter(self.context, ICacheable)
+        setUpEditWidgets(self, ICacheable, self.cacheable)
+
+    def current_cache_id(self):
+        "Returns the current cache ID."
+        return self.cacheable.getCacheId()
+
+    def current_cache_url(self):
+        "Returns the current cache provider's URL."
+        # XXX: it would be *really* useful to the user to be able to jump to
+        # the cache component and see the stats etc. directly from the
+        # cacheable view.  All this needs is to find out the URL somehow.
+        return None
 
     def invalidate(self):
         "Invalidate the current cached value."
@@ -61,5 +72,5 @@
             #return self.form(errors=e.errors)
             return repr(e.errors)
         else:
-            self.cachable.setCacheId(cacheId)
+            self.cacheable.setCacheId(cacheId)
             return self.form(message="Saved changes.")


=== Zope3/src/zope/app/browser/cache/cacheableedit.pt 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/cache/cacheableedit.pt:1.2	Wed Dec 25 09:12:28 2002
+++ Zope3/src/zope/app/browser/cache/cacheableedit.pt	Thu Jan 23 04:53:26 2003
@@ -4,6 +4,17 @@
 
     <p>This edit form allows you to associate a cache with this object.</p>
 
+    <p tal:condition="not: view/current_cache_id">
+      Currently there is no cache associated with the object.
+    </p>
+    
+    <p tal:condition="view/current_cache_id">
+      Currently the object uses
+      <a tal:omit-tag="not:view/current_cache_url"
+         tal:attributes="href view/current_cache_url"
+         tal:content="view/current_cache_id"/>.
+    </p>
+
     <div tal:condition="python: options.has_key('errors') and
                                 options['errors']">
       <span style="font-weight: bold">Errors:</span>