def joinMessage(self, message, packages): content = [] branch = XML.digValue(message.xml, str, "message", "source", "branch") if branch: content.append(Nouvelle.tag('strong')[ self.format_branch(branch.strip()) ]) for package in packages: if content: content.append(Nouvelle.tag('br')) content.append(package) return content
def render_dataTable(self, context): data = [] for id in BZFlag.Players.keys(): player = BZFlag.Players[id] data.append([ id, player.callsign, player.wins - player.losses, player.team ]) return MyTable(data, [ Nouvelle.IndexedColumn('id', 0), Nouvelle.IndexedColumn('callsign', 1), Nouvelle.IndexedColumn('score', 2), Nouvelle.IndexedColumn('team', 3), ], id='players')
def render_data(self, context, row): path = row[self.index] if path: return Nouvelle.tag('img', src = '/images/db/' + path, width = row[self.widthIndex], height = row[self.heightIndex]) else: return ()
def render_data(self, context, row): path = row[self.index] if path: return Nouvelle.tag('img', src='/images/db/' + path, width=row[self.widthIndex], height=row[self.heightIndex]) else: return ()
def format(self, args): from LibCIA.Web import Template return [ Nouvelle.tag('p')[ColortextToXHTML.format(self, args), ], Template.longError[ "This message was received in CIA's legacy format, 'colorText'. " "To see much more detailed information about each commit, " "ask this project's administrators to upgrade their client script."], ]
def format(self, args): return [ Nouvelle.tag('p')[ ColortextToXHTML.format(self, args), ], Template.longError[ "This message was received in CIA's legacy format, 'colorText'. " "To see much more detailed information about each commit, " "ask this project's administrators to upgrade their client script."], ]
def element_color(self, element): """Convert the fg and bg attributes, if we have them, to <span> tags""" style = '' for attr, css in ( ('fg', 'color'), ('bg', 'background'), ): attrValue = element.getAttributeNS(None, attr) if attrValue: try: style = "%s%s: %s;" % (style, css, self.colorTable[attrValue]) except KeyError: pass return Nouvelle.tag('span', style=style)[self.element_colorText(element)]
class MessageList(Template.Section): """A list of messages, with metadata and hyperlinks. Must be constructed with a list of Message instances. """ title = "messages" columns = [ MessageDateColumn(), MessageProjectColumn(), MessageContentColumn(), Nouvelle.AttributeColumn('link', 'hyperlink'), ] def renderMessages(self, context, messages): return [ Template.Table(messages, self.columns, defaultSortReversed=True, id='message'), ]
def element_u(self, element): # We can't use <u> here, it's been deprecated and XHTML # strict can't contain it. Just use some inline CSS instead. return Nouvelle.tag('span', style="text-decoration: underline;")[ self.element_colorText(element)]
def element_u(self, element): # We can't use <u> here, it's been deprecated and XHTML # strict can't contain it. Just use some inline CSS instead. return Nouvelle.tag('span', style="text-decoration: underline;")[ self.element_colorText(element) ]
def element_b(self, element): return Nouvelle.tag('b')[ self.element_colorText(element) ]
def element_br(self, element): return Nouvelle.tag('br')
def link_url(self, match): url = match.group() return Nouvelle.tag('a', href=url)[ url ]
def link_url(self, match): url = match.group() return Nouvelle.tag('a', href=url)[url]
def element_b(self, element): return Nouvelle.tag('b')[self.element_colorText(element)]