web/widgets.py
changeset 488 2984b3ec7034
parent 62 ef06f71533d9
child 849 8591d896db7e
child 1190 15fc369bc3ca
equal deleted inserted replaced
487:355356b781d7 488:2984b3ec7034
   730 
   730 
   731     def render_example(self, req):
   731     def render_example(self, req):
   732         formatstr = req.property_value(self.format_key)
   732         formatstr = req.property_value(self.format_key)
   733         return now().strftime(formatstr)
   733         return now().strftime(formatstr)
   734 
   734 
   735     def add_localized_infos(self, req):
   735     @classmethod
       
   736     def add_localized_infos(cls, req):
   736         """inserts JS variables defining localized months and days"""
   737         """inserts JS variables defining localized months and days"""
   737         # import here to avoid dependancy from cubicweb-common to simplejson
   738         # import here to avoid dependancy from cubicweb-common to simplejson
   738         _ = req._
   739         _ = req._
   739         monthnames = [_(mname) for mname in self.monthnames]
   740         monthnames = [_(mname) for mname in cls.monthnames]
   740         daynames = [_(dname) for dname in self.daynames]
   741         daynames = [_(dname) for dname in cls.daynames]
   741         req.html_headers.define_var('MONTHNAMES', monthnames)
   742         req.html_headers.define_var('MONTHNAMES', monthnames)
   742         req.html_headers.define_var('DAYNAMES', daynames)
   743         req.html_headers.define_var('DAYNAMES', daynames)
   743 
   744 
   744 
   745 
   745     def _edit_render(self, entity):
   746     def _edit_render(self, entity):