[Scodoc-devel] [SVN] Scolar : [1206] - Minor bug fix (ZEntreprises).

eviennet at lipn.univ-paris13.fr eviennet at lipn.univ-paris13.fr
Mer 13 Mar 15:56:11 CET 2013


Une pièce jointe HTML a été nettoyée...
URL: <https://www-rt.iutv.univ-paris13.fr/pipermail/scodoc-devel/attachments/20130313/86393cd2/attachment.html>
-------------- section suivante --------------
Modified: trunk/ZEntreprises.py
===================================================================
--- trunk/ZEntreprises.py	2013-03-13 11:00:13 UTC (rev 1205)
+++ trunk/ZEntreprises.py	2013-03-13 14:56:10 UTC (rev 1206)
@@ -92,9 +92,10 @@
                 else:
                     r['date'] = None
             # sort
-            R.sort( lambda r1, r2: cmp(r2['date'],r1['date']) )
+            R.sort( lambda r1, r2: cmp(r2['date'] or datetime.datetime.min,
+                                       r1['date'] or datetime.datetime.min) )
             for r in R:
-                r['date'] = DateISOtoDMY(r['date'])
+                r['date'] = DateISOtoDMY(r['date'] or datetime.datetime.min)
         return R
 
     def list_by_etud(self, cnx, args={},
@@ -118,9 +119,9 @@
             R.append(d)
         # sort
         if sort_on_contact:
-            R.sort( lambda r1, r2: cmp(r2['date'],r1['date']) )
+            R.sort( lambda r1, r2: cmp(r2['date'] or datetime.datetime.min,r1['date'] or datetime.datetime.min) )
         for r in R:
-            r['date'] = DateISOtoDMY(r['date'])
+            r['date'] = DateISOtoDMY(r['date'] or datetime.datetime.min)
         return R
 
 _entreprisesEditor = EntreprisesEditor(

Modified: trunk/notesdb.py
===================================================================
--- trunk/notesdb.py	2013-03-13 11:00:13 UTC (rev 1205)
+++ trunk/notesdb.py	2013-03-13 14:56:10 UTC (rev 1206)
@@ -10,6 +10,7 @@
 from sco_exceptions import *
 from types import *
 from cgi import escape
+import datetime
 
 quote_html = escape
 


Plus d'informations sur la liste de diffusion Scodoc-devel