[Checkins] SVN: z3c.relationfieldui/trunk/ Pass along some information about the from object of the relation we're

Martijn Faassen faassen at infrae.com
Fri Jan 16 11:37:30 EST 2009


Log message for revision 94774:
  Pass along some information about the from object of the relation we're
  creating to the explorerurl.
  

Changed:
  U   z3c.relationfieldui/trunk/CHANGES.txt
  U   z3c.relationfieldui/trunk/setup.py
  U   z3c.relationfieldui/trunk/src/z3c/relationfieldui/README.txt
  U   z3c.relationfieldui/trunk/src/z3c/relationfieldui/widget.py

-=-
Modified: z3c.relationfieldui/trunk/CHANGES.txt
===================================================================
--- z3c.relationfieldui/trunk/CHANGES.txt	2009-01-16 16:24:12 UTC (rev 94773)
+++ z3c.relationfieldui/trunk/CHANGES.txt	2009-01-16 16:37:29 UTC (rev 94774)
@@ -1,10 +1,11 @@
 CHANGES
 *******
 
-0.2.1 (unreleased)
+0.3 (unreleased)
 ==================
 
-* ...
+* Pass along ``from_attribute`` and ``from_path`` URL parameters to
+  explorer_url.
 
 0.2 (2009-01-08)
 ================

Modified: z3c.relationfieldui/trunk/setup.py
===================================================================
--- z3c.relationfieldui/trunk/setup.py	2009-01-16 16:24:12 UTC (rev 94773)
+++ z3c.relationfieldui/trunk/setup.py	2009-01-16 16:37:29 UTC (rev 94774)
@@ -15,7 +15,7 @@
 
 setup(
     name='z3c.relationfieldui',
-    version='0.2.1dev',
+    version='0.3dev',
     description="A widget for z3c.relationfield.",
     long_description=long_description,
     classifiers=[],

Modified: z3c.relationfieldui/trunk/src/z3c/relationfieldui/README.txt
===================================================================
--- z3c.relationfieldui/trunk/src/z3c/relationfieldui/README.txt	2009-01-16 16:24:12 UTC (rev 94773)
+++ z3c.relationfieldui/trunk/src/z3c/relationfieldui/README.txt	2009-01-16 16:37:29 UTC (rev 94774)
@@ -103,9 +103,15 @@
   >>> from zope.publisher.browser import TestRequest
   >>> from z3c.relationfieldui import RelationWidget
   >>> request = TestRequest()
-  >>> widget = RelationWidget(IItem['rel'], request)
+  >>> field = IItem['rel']
+  >>> class Context(object):
+  ...    pass
+  >>> obj = Context()
+  >>> obj.__name__ = 'something'
+  >>> field.context = obj
+  >>> widget = RelationWidget(field, request)
   >>> print widget()
-  <input class="textType" id="field.rel" name="field.rel" size="20" type="text" value=""  /><input class="buttonType" onclick="Z3C.relation.popup(this.previousSibling, 'http://grok.zope.org')" type="button" value="get relation" />
+  <input class="textType" id="field.rel" name="field.rel" size="20" type="text" value=""  /><input class="buttonType" onclick="Z3C.relation.popup(this.previousSibling, 'http://grok.zope.org?from_attribute=rel&amp;from_path=something')" type="button" value="get relation" />
 
 Relation display widget
 =======================

Modified: z3c.relationfieldui/trunk/src/z3c/relationfieldui/widget.py
===================================================================
--- z3c.relationfieldui/trunk/src/z3c/relationfieldui/widget.py	2009-01-16 16:24:12 UTC (rev 94773)
+++ z3c.relationfieldui/trunk/src/z3c/relationfieldui/widget.py	2009-01-16 16:37:29 UTC (rev 94774)
@@ -27,6 +27,11 @@
         explorer_url = component.getMultiAdapter((self.context.context,
                                                  self.request),
                                                  name="explorerurl")()
+        from_attribute = self.context.__name__
+        object_path = component.getUtility(IObjectPath)
+        from_path = object_path.path(self.context.context)
+        explorer_url += '?from_attribute=%s&from_path=%s' % (
+            from_attribute, from_path)
         result += renderElement(
             'input', type='button', value='get relation',
             onclick="Z3C.relation.popup(this.previousSibling, '%s')" %



More information about the Checkins mailing list