[Scodoc-devel] [SVN] Scolar : [1207] Fixed typo.

eviennet at lipn.univ-paris13.fr eviennet at lipn.univ-paris13.fr
Mer 13 Mar 16:43:05 CET 2013


Une pièce jointe HTML a été nettoyée...
URL: <https://www-rt.iutv.univ-paris13.fr/pipermail/scodoc-devel/attachments/20130313/03f6f131/attachment.html>
-------------- section suivante --------------
Modified: trunk/ZEntreprises.py
===================================================================
--- trunk/ZEntreprises.py	2013-03-13 14:56:10 UTC (rev 1206)
+++ trunk/ZEntreprises.py	2013-03-13 15:43:05 UTC (rev 1207)
@@ -88,14 +88,13 @@
                     args={ 'entreprise_id' : r['entreprise_id'] },
                     disable_formatting=True)
                 if c:
-                    r['date'] = max( [ x['date'] for x in c ] )
+                    r['date'] = max( [ x['date'] or datetime.date.min for x in c ] )
                 else:
-                    r['date'] = None
+                    r['date'] = datetime.date.min
             # sort
-            R.sort( lambda r1, r2: cmp(r2['date'] or datetime.datetime.min,
-                                       r1['date'] or datetime.datetime.min) )
+            R.sort( lambda r1, r2: cmp(r2['date'], r1['date']) )
             for r in R:
-                r['date'] = DateISOtoDMY(r['date'] or datetime.datetime.min)
+                r['date'] = DateISOtoDMY(r['date'])
         return R
 
     def list_by_etud(self, cnx, args={},
@@ -107,7 +106,6 @@
         titles, res = [ x[0] for x in cursor.description ], cursor.dictfetchall()
         R = []
         for r in res:
-            log('r=' + str(r))
             r['etud_prenom'] = r['etud_prenom'] or ''
             d = {}
             for key in r:
@@ -119,9 +117,9 @@
             R.append(d)
         # sort
         if sort_on_contact:
-            R.sort( lambda r1, r2: cmp(r2['date'] or datetime.datetime.min,r1['date'] or datetime.datetime.min) )
+            R.sort( lambda r1, r2: cmp(r2['date'] or datetime.date.min, r1['date'] or datetime.date.min) )
         for r in R:
-            r['date'] = DateISOtoDMY(r['date'] or datetime.datetime.min)
+            r['date'] = DateISOtoDMY(r['date'] or datetime.date.min)
         return R
 
 _entreprisesEditor = EntreprisesEditor(


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