263 <input name="data-subject__detach:%(eid)s" type="checkbox" /> |
263 <input name="data-subject__detach:%(eid)s" type="checkbox" /> |
264 detach attached file |
264 detach attached file |
265 <p><b>You can either submit a new file using the browse button above, or choose to remove already uploaded file by checking the "detach attached file" check-box, or edit file content online with the widget below.</b></p> |
265 <p><b>You can either submit a new file using the browse button above, or choose to remove already uploaded file by checking the "detach attached file" check-box, or edit file content online with the widget below.</b></p> |
266 <textarea cols="80" name="data-subject:%(eid)s" onkeyup="autogrow(this)" rows="3">new widgets system</textarea>''' % {'eid': file.eid}) |
266 <textarea cols="80" name="data-subject:%(eid)s" onkeyup="autogrow(this)" rows="3">new widgets system</textarea>''' % {'eid': file.eid}) |
267 |
267 |
268 def _modified_tzdatenaiss(self, eid, datestr, timestr): |
268 def _modified_tzdatenaiss(self, eid, date_and_time_str=None): |
269 ctx = {'tzdatenaiss-subjectdate:%d' % eid: datestr, |
269 ctx = {} |
270 'tzdatenaiss-subjecttime:%d' % eid: timestr} |
270 if date_and_time_str: |
|
271 datestr, timestr = date_and_time_str |
|
272 ctx['tzdatenaiss-subjectdate:%d' % eid] = datestr |
|
273 ctx['tzdatenaiss-subjecttime:%d' % eid] = timestr |
271 with self.admin_access.web_request(**ctx) as req: |
274 with self.admin_access.web_request(**ctx) as req: |
272 form = EntityFieldsForm(req, None, entity=req.entity_from_eid(eid)) |
275 form = EntityFieldsForm(req, None, entity=req.entity_from_eid(eid)) |
273 field = TZDatetimeField(name='tzdatenaiss', eidparam=True, |
276 field = TZDatetimeField(name='tzdatenaiss', eidparam=True, |
274 role='subject') |
277 role='subject') |
275 form.append_field(field) |
278 form.append_field(field) |
283 datestr, timestr = tzd.strftime('%Y/%m/%d %H:%M').split() |
286 datestr, timestr = tzd.strftime('%Y/%m/%d %H:%M').split() |
284 with self.admin_access.web_request() as req: |
287 with self.admin_access.web_request() as req: |
285 eid = req.create_entity('Personne', nom=u'Flo', tzdatenaiss=tzd).eid |
288 eid = req.create_entity('Personne', nom=u'Flo', tzdatenaiss=tzd).eid |
286 req.cnx.commit() |
289 req.cnx.commit() |
287 |
290 |
288 modified = self._modified_tzdatenaiss(eid, datestr, timestr) |
291 modified = self._modified_tzdatenaiss(eid, (datestr, timestr)) |
289 self.assertFalse(modified) |
292 self.assertFalse(modified) |
290 |
293 |
291 modified = self._modified_tzdatenaiss(eid, '2016/05/04', '15:07') |
294 modified = self._modified_tzdatenaiss(eid, ('2016/05/04', '15:07')) |
|
295 self.assertTrue(modified) |
|
296 |
|
297 modified = self._modified_tzdatenaiss(eid, None) |
292 self.assertTrue(modified) |
298 self.assertTrue(modified) |
293 |
299 |
294 def test_passwordfield(self): |
300 def test_passwordfield(self): |
295 class PFForm(EntityFieldsForm): |
301 class PFForm(EntityFieldsForm): |
296 upassword = PasswordField(eidparam=True, role='subject') |
302 upassword = PasswordField(eidparam=True, role='subject') |