本文整理汇总了Python中pushmaster.taglib.T.h2方法的典型用法代码示例。如果您正苦于以下问题:Python T.h2方法的具体用法?Python T.h2怎么用?Python T.h2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pushmaster.taglib.T
的用法示例。
在下文中一共展示了T.h2方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: request_display
# 需要导入模块: from pushmaster.taglib import T [as 别名]
# 或者: from pushmaster.taglib.T import h2 [as 别名]
def request_display(request, push):
title = T.h2(class_='request-title')(
T.span(class_='subject')(request.subject),
common.user_home_link(request.owner),
common.display_date(request.target_date),
)
div = T.div(class_='request')(title)
if request.branch:
div(T.h3(T.span('Branch: '), T.a(request.branch, href=config.git_branch_url % dict(branch=request.branch))))
if request.reject_reason:
div(
T.h3('Reject Reason:'),
T.p(common.linkify(request.reject_reason), class_='reject-reason'),
)
div(T.div(class_='message')(common.linkify(request.message or '')))
if request.urgent:
title.attrs['class'] += ' urgent'
title(common.request_badges(request))
title(T.span(request.state, class_='state'))
if not push or users.get_current_user() == push.owner:
div(request_actions_form(request))
return div
示例2: get
# 需要导入模块: from pushmaster.taglib import T [as 别名]
# 或者: from pushmaster.taglib.T import h2 [as 别名]
def get(self, datestr):
from_date, to_date = report_date_range(datestr)
doc = common.Document(title='pushmaster: reports')
doc.body(T.h1('Report for ', from_date.strftime('%e %b %Y'), ' - ', to_date.strftime('%e %b %Y')))
pushes = query.pushes_for_the_week_of(from_date)
for push in pushes:
pushdiv = T.div(class_='push')
pushdiv(T.h2(
T.a(href=push.uri)(
push.ltime.replace(tzinfo=timezone.UTC()).astimezone(config.timezone).strftime('%a, %l:%M %p, %e %b %Y'),
T.span(' '),
push.name or '',
),
T.span(' by '),
common.display_user_email(push.owner),
))
reqlist = T.ol(class_='requests')
for request in query.push_requests(push):
reqlist(common.request_item(request))
pushdiv(reqlist)
doc.body(pushdiv)
doc.body(common.jquery_js, common.jquery_ui_js, common.pushmaster_js)
doc.serialize(self.response.out)
示例3: get
# 需要导入模块: from pushmaster.taglib import T [as 别名]
# 或者: from pushmaster.taglib.T import h2 [as 别名]
def get(self):
requests = query.current_requests()
doc = common.Document(title='pushmaster: requests')
doc.body(
T.h2(('Current Requests (%d)' % len(requests)) if len(requests) > 5 else 'Current Requests'),
common.request_list(requests) if requests else T.span('There are no requests at present.'),
T.div(common.bookmarklet(self.hostname)),
)
doc.serialize(self.response.out)
示例4: reject_request_form
# 需要导入模块: from pushmaster.taglib import T [as 别名]
# 或者: from pushmaster.taglib.T import h2 [as 别名]
def reject_request_form():
return T.form(action='#', method='post', class_='reject-request', id='reject-request-form')(
T.div(class_='fields')(
hidden(act='reject', push='true', return_url=''),
T.h2(class_='subject'),
T.label(for_='reject-request-reason')(
T.span('Reason:'),
T.div(T.textarea(name='reason', id='reject-request-reason')),
),
T.div(T.button(type='submit', class_='submit')('Reject')),
),
)
示例5: request_display
# 需要导入模块: from pushmaster.taglib import T [as 别名]
# 或者: from pushmaster.taglib.T import h2 [as 别名]
def request_display(request, push):
title = T.h2(class_='request-title')(
T.span(class_='subject')(request.subject),
common.user_home_link(request.owner, logic.user_info(request.owner)),
common.display_date(request.target_date),
)
div = T.div(class_='request')(title)
if request.branch:
if '/' in request.branch:
repo, _, branch = request.branch.partition('/')
repo = 'devs/%s.git' % repo
else:
repo, branch = 'yelp-main.git', request.branch
div(T.h3(T.span('Branch: '), T.a(request.branch, href=config.git_branch_url % dict(repo=repo,branch=branch))))
if push:
div(T.h3(T.span('Push: '), T.a('%s %s' % (util.format_datetime(push.ptime), push.name), href=push.uri)))
if request.reject_reason:
div(
T.h3('Reject Reason:'),
T.p(common.linkify(request.reject_reason), class_='reject-reason'),
)
div(T.div(class_='message')(common.linkify(request.message or '')))
if request.urgent:
title.attrs['class'] += ' urgent'
title(common.request_badges(request))
title(T.span(request.state, class_='state'))
if not push or users.get_current_user() == push.owner:
div(request_actions_form(request))
return div
示例6: render_push_div
# 需要导入模块: from pushmaster.taglib import T [as 别名]
# 或者: from pushmaster.taglib.T import h2 [as 别名]
def render_push_div(self, current_user, push, requests, pending_requests):
push_div = T.div(class_='push')
if current_user == push.owner:
push_div(push_actions_form(push, requests)(class_='small push-action'))
elif push.can_change_owner:
push_div(common.take_ownership_form(push)(class_='small push-action'))
header = T.h1(common.display_datetime(push.ptime), T.span(class_='name')(push.name or ''), common.user_home_link(push.owner, logic.user_info(push.owner)))
if any(request.push_plans for request in requests):
header(common.push_plans_badge())
if any(request.js_serials for request in requests):
header(common.js_serials_badge())
if any(request.img_serials for request in requests):
header(common.img_serials_badge())
push_div(header)
requests_div = T.div(class_='requests')
push_div(requests_div)
def requests_with_state(state):
return filter(lambda r: r.state == state, requests)
if push.state == 'live':
requests_div(accepted_list(requests_with_state('live'), state='live'))
else:
def onstage_request_item(request):
li = common.request_item(request)
if current_user == push.owner:
li.children.insert(0, T.div(class_='actions')(mark_tested_form(request), T.span('or', class_='sep'), withdraw_form(request)))
elif current_user == request.owner:
li.children.insert(0, T.div(class_='actions')(mark_tested_form(request)))
return li
def withdrawable_request_item(request):
li = common.request_item(request)
if current_user == push.owner:
li.children.insert(0, T.div(class_='actions')(withdraw_form(request)))
return li
def accepted_request_item(request):
li = common.request_item(request)
if current_user == push.owner:
li.children.insert(0, T.div(class_='actions')(
mark_checked_in_form(request),
T.span('or', class_='sep'),
withdraw_form(request),
T.span('or', class_='sep'),
reject_request_link(request),
))
return li
request_states = [
('Verified on Stage', 'tested', withdrawable_request_item),
('On Stage (%s)' % push.stage, 'onstage', onstage_request_item),
('Checked In', 'checkedin', withdrawable_request_item),
('Accepted', 'accepted', accepted_request_item),
]
for label, state, request_item in request_states:
subrequests = requests_with_state(state)
if subrequests:
if len(subrequests) > 5:
label = '%(label)s (%(count)d)' % {'label': label, 'count': len(subrequests)}
requestors = ', '.join(set(request.owner.nickname() for request in subrequests))
label = '%(label)s - %(requestors)s' % {'label': label, 'requestors': requestors}
requests_div(T.h3(label), accepted_list(subrequests, request_item=request_item, state=state))
if current_user == push.owner:
accepted_requests = requests_with_state('accepted')
if accepted_requests:
requests_div(T.div('cherry-pick-branches %s' % (' '.join(['"%s"' % request.branch for request in accepted_requests if request.branch]),), class_='code'))
if push.editable:
if pending_requests:
pending_requests_title = ('Pending Requests (%d)' % len(pending_requests)) if len(pending_requests) > 5 else 'Pending Requests'
push_div(T.h2(class_='pending')(pending_requests_title), push_pending_list(push, pending_requests))
return push_div