SVN: Zope/branches/2.13/ - Fixed editing offset-naive 'date' properties in the ZMI.

Yvo Schubbe <[email protected]>
Newsgroups gmane.comp.web.zope.cvs
Message-ID <[email protected]>
Log message for revision 120840:
  - Fixed editing offset-naive 'date' properties in the ZMI.

Changed:
  U   Zope/branches/2.13/doc/CHANGES.rst
  U   Zope/branches/2.13/src/OFS/dtml/properties.dtml

-=-
Modified: Zope/branches/2.13/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.13/doc/CHANGES.rst	2011-03-10 09:49:42 UTC (rev 120839)
+++ Zope/branches/2.13/doc/CHANGES.rst	2011-03-10 11:09:15 UTC (rev 120840)
@@ -13,6 +13,9 @@
 
 - Corrected copyright information shown in the ZMI.
 
+- OFS: Fixed editing offset-naive 'date' properties in the ZMI.
+  The "Properties" tab no longer shows the time zone of offset-naive dates.
+
 Features Added
 ++++++++++++++
 

Modified: Zope/branches/2.13/src/OFS/dtml/properties.dtml
===================================================================
--- Zope/branches/2.13/src/OFS/dtml/properties.dtml	2011-03-10 09:49:42 UTC (rev 120839)
+++ Zope/branches/2.13/src/OFS/dtml/properties.dtml	2011-03-10 11:09:15 UTC (rev 120840)
@@ -86,10 +86,11 @@
   <input type="text" name="&dtml-id;:&dtml-type;" size="35"
    value="<dtml-if "hasProperty(id)"><dtml-var
     "('%s' % getProperty(id))" html_quote></dtml-if>" />
-  <dtml-elif "type in ('float', 'date')">
+  <dtml-elif "type == 'date' and not _.same_type(getProperty(id), '')
+              and getProperty(id).timezoneNaive()">
   <input type="text" name="&dtml-id;:&dtml-charset_tag;&dtml-type;" size="35"
-   value="<dtml-var "getProperty(id)" html_quote>" />
-  <dtml-elif "type in ['string','ustring']">
+   value="<dtml-var "str(getProperty(id)).rsplit(' ', 1)[0]" html_quote>" />
+  <dtml-elif "type in ['date', 'float', 'string', 'ustring']">
   <input type="text" name="&dtml-id;:&dtml-charset_tag;&dtml-type;" size="35"
    value="<dtml-var "getProperty(id)" html_quote>" />
   <dtml-elif "type=='boolean'">

_______________________________________________
Zope-Checkins maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-checkins
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.