本文整理汇总了Python中pushmaster.taglib.T.h3方法的典型用法代码示例。如果您正苦于以下问题:Python T.h3方法的具体用法?Python T.h3怎么用?Python T.h3使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pushmaster.taglib.T
的用法示例。
在下文中一共展示了T.h3方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: request_display
# 需要导入模块: from pushmaster.taglib import T [as 别名]
# 或者: from pushmaster.taglib.T import h3 [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 h3 [as 别名]
def get(self, email):
email = urllib.unquote_plus(email)
doc = common.Document(title='pushmaster: recent activity: ' + email)
doc.body(T.div(class_='bookmarklet')(common.bookmarklet(self.hostname)))
user = users.User(email)
requests = query.requests_for_user(user)
pushes = query.pushes_for_user(user)
if requests:
doc.body(
T.h3('Recent Requests'),
T.ol(class_='my requests')(map(request_item, requests)),
)
if pushes:
doc.body(
T.h3('Recent Pushes'),
T.ol(class_='pushes')(map(push_item, pushes)),
)
doc.serialize(self.response.out)
示例3: request_display
# 需要导入模块: from pushmaster.taglib import T [as 别名]
# 或者: from pushmaster.taglib.T import h3 [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
示例4: get
# 需要导入模块: from pushmaster.taglib import T [as 别名]
# 或者: from pushmaster.taglib.T import h3 [as 别名]
def get(self, datestr=None):
if datestr:
from_date, to_date = report_date_range(datestr)
else:
for_date = last_monday_datetime() - datetime.timedelta(days=7)
return self.redirect('/lastweek/' + for_date.strftime('%Y%m%d'))
pushes = query.pushes_for_the_week_of(from_date)
requests = []
for push in pushes:
requests.extend(query.push_requests(push))
requests = sorted(requests, key=lambda r: r.mtime)
doc = common.Document(title='pushmaster: weekly report: ' + datestr)
teams_list = T.ul(class_='teams')
doc(teams_list)
nothing_messages_list = None
for team in config.report_users:
team_item = T.li(class_='team')(T.h3(team['name']))
teams_list(team_item)
devs_list = T.ul(class_='devs')
team_item(devs_list)
for dev in sorted(team['dev']):
dev_item = T.li(class_='dev')(T.h4(dev))
devs_list(dev_item)
dev_requests = filter(lambda r: r.owner.nickname() == dev, requests)
if dev_requests:
requests_list = T.ol(class_='requests')(map(common.request_item, dev_requests))
dev_item(requests_list)
else:
# lazy (re)initialize random messages
if not nothing_messages_list:
nothing_messages_list = list(config.nothing_messages)
import random
random.shuffle(nothing_messages_list)
dev_item(T.div(nothing_messages_list.pop(), class_='nothing'))
if 'prod' in team:
team_item(T.h4('PM: ' if len(team['prod']) == 1 else 'PMs: ', ', '.join(team['prod']), class_='pm'))
doc.serialize(self.response.out)
示例5: render_push_div
# 需要导入模块: from pushmaster.taglib import T [as 别名]
# 或者: from pushmaster.taglib.T import h3 [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