Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
no alternative could be found.
"""
date = we.start_date
if not self.care_about_conflicts(we):
return date
# ar.debug("20140310 resolve_conflicts %s", we.start_date)
while we.has_conflicting_events():
qs = we.get_conflicting_events()
ar.debug("%s conflicts with %s. ", we, qs)
date = rset.get_next_alt_date(ar, date)
if date is None or date > until:
ar.debug(
"Failed to get next date for %s (%s > %s).",
we, date, until)
conflicts = [E.tostring(ar.obj2html(o)) for o in qs]
msg = ', '.join(conflicts)
ar.warning("%s conflicts with %s. ", we, msg)
return None
rset.move_event_to(we, date)
return date
else:
must_read = True
else:
must_read = True
if must_read:
msg = _("Must read eID card!")
if config:
elems.append(ar.instance_action_button(
self.read_beid, msg, icon_name=None))
else:
elems.append(msg)
# same red as in lino.css for .x-grid3-row-red td
# ~ attrs.update(style="background-color:#FA7F7F; padding:3pt;")
attrs.update(class_="lino-info-red")
return E.div(*elems, **attrs)
tpl = u"{0}: {1}"
# if obj.site is not None and obj.site == mi.interesting_for:
# lst.append(_("site-specific"))
if obj.site is not None: # and obj.site != mi.interesting_for:
lst.append(tpl.format(
unicode(_("Site")), unicode(obj.site)))
if obj.reporter is not None:
lst.append(tpl.format(
unicode(_("Reporter")), unicode(obj.reporter)))
if obj.project is not None:
lst.append(tpl.format(
unicode(_("Project")), unicode(obj.project)))
if obj.topic is not None:
lst.append(tpl.format(
unicode(_("Topic")), unicode(obj.topic)))
return E.p(*join_elems(lst, '. '))
def html_text(self, html):
"""Wrpt the given html fragment into a ``<div class="htmlText">``
which specifies that this fragment contains simple html text
inside an ExtJS component. This is required because ExtJS
does a lot of CSS magic which neutralizes the "usual" effects
of most html tags.
"""
if isinstance(html, six.string_types):
return '<div class="htmlText">{0}</div>'.format(html)
if not E.iselement(html):
raise Exception("{!r} is not an element".format(html))
if html.tag in ('div', 'span'):
html.attrib['class'] = 'htmlText'
return html
return E.div(html, class_='htmlText')
# # is a list or tuple of ET elements</div>
for date, projects in d2p.items():
parts = []
tot = Duration()
for prj, duration in projects.items():
if prj is None:
prj = "N/A"
txt = "{0} ({1})".format(prj, fmt(duration))
parts.append(txt)
tot += duration
if len(parts):
if len(parts) == 1:
txt = parts[0]
else:
txt = ', '.join(parts) + " = " + fmt(tot)
txt = E.p(txt, style="text-align:right")
days[date].append(txt)
polls_responses.setdefault(resp.poll.pk, []).append(resp)
items = []
for poll in visible_polls:
iar = self.insert_action.request_from(
ar, obj, known_values=dict(poll=poll))
elems = [str(poll), ' : ']
responses = polls_responses.get(poll.pk, [])
elems += join_elems(
[ar.obj2html(r, dd.fds(r.date))
for r in responses], sep=', ')
if poll.state == PollStates.published:
elems += [' ', iar.ar2button()]
#elems += [' ', iar.insert_button()]
items.append(E.li(*elems))
return E.div(E.ul(*items))
def ticket2html(parser, s):
ar = parser.context['ar']
pk = int(s)
obj = sender.site.models.tickets.Ticket.objects.get(pk=pk)
text = "#{0}".format(obj.id)
e = ar.obj2html(obj, text, title=obj.summary)
return E.tostring(e)
# url = rnd.get_detail_url(obj)
sep = None
for ses in qs:
if sep:
chunks.append(sep)
busy_tickets.add(ses.ticket.id)
txt = unicode(ses.ticket)
chunks.append(
ar.obj2html(ses.ticket, txt, title=ses.ticket.summary))
chunks += [
' (',
ar.instance_action_button(
ses.end_session, EndTicketSession.label),
')']
sep = ', '
chunks.append('. ')
yield E.p(*chunks)
def get_notify_body(self, ar):
return E.tostring(E.p(
_("{user} worked on [ticket {t}]").format(
user=ar.get_user(), t=self.id)))
yield ''
yield ''
yield ''
yield '<title>%s</title>' % settings.LINO.title
user = ar.get_user() # request.subst_user or request.user
menu = settings.LINO.get_site_menu(self,user.profile)
yield ''
yield menu.as_html(ar)
story = []
#~ story.append(xghtml.E.p(str(menu)))
#~ story.append(xghtml.E.p(str(args)))
#~ story.append(xghtml.E.p(str(kw)))
e = xghtml.E.div(*story,id='body')
yield xghtml.E.tostring(e)
yield lh.main.__html__(ar)
yield ""