equal
deleted
inserted
replaced
14 from logilab.common.changelog import ChangeLog |
14 from logilab.common.changelog import ChangeLog |
15 from logilab.mtconverter import CHARSET_DECL_RGX |
15 from logilab.mtconverter import CHARSET_DECL_RGX |
16 |
16 |
17 from cubicweb.selectors import match_form_params |
17 from cubicweb.selectors import match_form_params |
18 from cubicweb.view import StartupView |
18 from cubicweb.view import StartupView |
19 from cubicweb.utils import strptime |
19 from cubicweb.utils import strptime, todate |
20 from cubicweb.common.uilib import rest_publish |
20 from cubicweb.common.uilib import rest_publish |
21 from cubicweb.web import NotFound |
21 from cubicweb.web import NotFound |
22 |
22 |
23 _ = unicode |
23 _ = unicode |
24 |
24 |
190 rid = 'ChangeLog_%s' % (self.req.lang) |
190 rid = 'ChangeLog_%s' % (self.req.lang) |
191 allentries = [] |
191 allentries = [] |
192 title = self.req._(self.title) |
192 title = self.req._(self.title) |
193 restdata = ['.. -*- coding: utf-8 -*-', '', title, '='*len(title), ''] |
193 restdata = ['.. -*- coding: utf-8 -*-', '', title, '='*len(title), ''] |
194 w = restdata.append |
194 w = restdata.append |
|
195 today = date.today() |
195 for fpath in self.config.locate_all_files(rid): |
196 for fpath in self.config.locate_all_files(rid): |
196 cl = ChangeLog(fpath) |
197 cl = ChangeLog(fpath) |
197 encoding = 'utf-8' |
198 encoding = 'utf-8' |
198 # additional content may be found in title |
199 # additional content may be found in title |
199 for line in (cl.title + cl.additional_content).splitlines(): |
200 for line in (cl.title + cl.additional_content).splitlines(): |
203 continue |
204 continue |
204 elif line.startswith('.. '): |
205 elif line.startswith('.. '): |
205 w(unicode(line, encoding)) |
206 w(unicode(line, encoding)) |
206 for entry in cl.entries: |
207 for entry in cl.entries: |
207 if entry.date: |
208 if entry.date: |
208 edate = strptime(entry.date, '%Y-%m-%d') |
209 edate = todate(strptime(entry.date, '%Y-%m-%d')) |
209 else: |
210 else: |
210 edate = date.today() |
211 edate = today |
211 messages = [] |
212 messages = [] |
212 for msglines, submsgs in entry.messages: |
213 for msglines, submsgs in entry.messages: |
213 msgstr = unicode(' '.join(l.strip() for l in msglines), encoding) |
214 msgstr = unicode(' '.join(l.strip() for l in msglines), encoding) |
214 msgstr += u'\n\n' |
215 msgstr += u'\n\n' |
215 for submsglines in submsgs: |
216 for submsglines in submsgs: |
223 for edate, messages in reversed(allentries): |
224 for edate, messages in reversed(allentries): |
224 if latestdate != edate: |
225 if latestdate != edate: |
225 fdate = self.format_date(edate) |
226 fdate = self.format_date(edate) |
226 w(u'\n%s' % fdate) |
227 w(u'\n%s' % fdate) |
227 w('~' * len(fdate)) |
228 w('~' * len(fdate)) |
228 latestdate = date |
229 latestdate = edate |
229 for msg in messages: |
230 for msg in messages: |
230 w(u'* %s' % msg) |
231 w(u'* %s' % msg) |
231 i += 1 |
232 i += 1 |
232 if i > self.maxentries: |
233 if i > self.maxentries: |
233 break |
234 break |