本文整理汇总了Python中opengever.ogds.base.actor.Actor.lookup方法的典型用法代码示例。如果您正苦于以下问题:Python Actor.lookup方法的具体用法?Python Actor.lookup怎么用?Python Actor.lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opengever.ogds.base.actor.Actor
的用法示例。
在下文中一共展示了Actor.lookup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _msg_mapping
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def _msg_mapping(self):
mapping = super(Reject, self)._msg_mapping
change = self.response.get_change('responsible')
if change:
mapping['old_responsible'] = Actor.lookup(change.get('before')).get_link()
mapping['new_responsible'] = Actor.lookup(change.get('after')).get_link()
return mapping
示例2: test_user_is_the_only_representatives_of_a_user
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def test_user_is_the_only_representatives_of_a_user(self):
actor = Actor.lookup('jurgen.konig')
self.assertEquals([self.get_ogds_user(self.secretariat_user)],
actor.representatives())
actor = Actor.lookup(self.regular_user.getId())
self.assertEquals([self.get_ogds_user(self.regular_user)],
actor.representatives())
示例3: msg
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def msg(self):
change = self.response.get_change('responsible')
responsible_new = Actor.lookup(change.get('after')).get_link()
responsible_old = Actor.lookup(change.get('before')).get_link()
return _('transition_msg_reassign',
u'Reassigned from ${responsible_old} to '
u'${responsible_new} by ${user}',
mapping={'user': self.response.creator_link(),
'responsible_new': responsible_new,
'responsible_old': responsible_old})
示例4: test_contact_has_no_representatives
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def test_contact_has_no_representatives(self):
contact = create(Builder('contact')
.having(firstname=u'Paul')
.in_state('published'))
actor = Actor.lookup('contact:{}'.format(contact.id))
self.assertItemsEqual([], actor.representatives())
示例5: get_data_for_item
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def get_data_for_item(self, item):
admin_unit = item.get_admin_unit().title
task_type = task_type_helper(item, item.task_type)
sequence_number = unicode(item.sequence_number).encode("utf-8")
deadline = helper.readable_date(item, item.deadline)
title = unicode(getattr(item, "Title", getattr(item, "title", ""))).encode("utf-8")
issuer = get_issuer_of_task(item, with_client=True, with_principal=False)
responsible_org_unit = item.get_assigned_org_unit()
responsible = Actor.lookup(item.responsible)
responsible_label = responsible_org_unit.prefix_label(responsible.get_label(with_principal=False))
dossier_title = item.containing_dossier or ""
reference = unicode(getattr(item, "reference", getattr(item, "reference_number", ""))).encode("utf-8")
review_state = workflow_state(item, item.review_state)
return [
admin_unit,
sequence_number,
title,
task_type,
dossier_title,
reference,
issuer,
responsible_label,
deadline,
review_state,
]
示例6: test_template_journal_tab
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def test_template_journal_tab(self, browser):
browser.login().open(self.template, view=JOURNAL_TAB)
journal_entries = browser.css('table.listing').first.dicts()
self.assertEqual(Actor.lookup(TEST_USER_ID).get_label(),
journal_entries[0]['Changed by'])
self.assertEqual('Document added: My Document',
journal_entries[0]['Title'])
示例7: plone_participations
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def plone_participations(self):
if not self.context.has_participation_support():
return []
# get the participants
phandler = IParticipationAware(self.context)
results = list(phandler.get_participations())
# also append the responsible
class ResponsibleParticipant(object):
pass
responsible = ResponsibleParticipant()
responsible.roles = _dossier(u'label_responsible', 'Responsible')
responsible.role_list = responsible.roles
dossier_adpt = IDossier(self.context)
responsible.contact = dossier_adpt.responsible
results.append(responsible)
users = []
for dossier in results:
actor = Actor.lookup(dossier.contact)
users.append({
'Title': actor.get_label(),
'getURL': actor.get_profile_url(),
'css_class': 'function-user',
})
return users
示例8: test_document_report
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def test_document_report(self, browser):
browser.login().open(view='document_report',
data={'paths:list': [
'/'.join(self.document.getPhysicalPath()),
]})
with NamedTemporaryFile(delete=False, suffix='.xlsx') as tmpfile:
tmpfile.write(browser.contents)
tmpfile.flush()
workbook = load_workbook(tmpfile.name)
self.assertSequenceEqual(
[
u'Client1 / 1 / 1',
1L,
u'Testdokum\xe4nt',
u'Mustermann Max',
get_localized_time(self.document_date),
get_localized_time(self.receipt_date),
get_localized_time(self.delivery_date),
Actor.lookup(TEST_USER_ID).get_label(),
u'unchecked',
u'Dossier A',
],
[cell.value for cell in workbook.active.rows[1]])
示例9: test_inbox_corresponds_to_all_inbox_assigned_users
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def test_inbox_corresponds_to_all_inbox_assigned_users(self):
actor = Actor.lookup('inbox:fa')
self.assertTrue(
actor.corresponds_to(self.get_ogds_user(self.secretariat_user)))
self.assertFalse(
actor.corresponds_to(self.get_ogds_user(self.regular_user)))
示例10: get_responsible_label
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def get_responsible_label(self, linked=True):
actor = Actor.lookup(self.responsible)
org_unit = ogds_service().fetch_org_unit(self.assigned_org_unit)
if not linked:
return org_unit.prefix_label(actor.get_label())
return org_unit.prefix_label(actor.get_link())
示例11: summary
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def summary(self):
actor = Actor.lookup(self.context.Creator())
msg = _('summary_disposition_added',
u'New disposition added by ${user} on admin unit ${admin_unit}',
mapping={'user': actor.get_label(with_principal=False),
'admin_unit': get_current_admin_unit().label()})
return self.translate_to_all_languages(msg)
示例12: test_user_corresponds_to_current_user
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def test_user_corresponds_to_current_user(self):
actor = Actor.lookup('jurgen.konig')
self.assertTrue(
actor.corresponds_to(self.get_ogds_user(self.secretariat_user)))
self.assertFalse(
actor.corresponds_to(self.get_ogds_user(self.regular_user)))
示例13: test_template_journal_tab
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def test_template_journal_tab(self, browser):
self.login(self.regular_user, browser)
browser.open(self.normal_template, view='tabbedview_view-journal')
journal_entries = browser.css('table.listing').first.dicts()
self.assertEqual(Actor.lookup(self.administrator.id).get_label(), journal_entries[0]['Changed by'])
self.assertEqual(u'Document added: T\xc3\xb6mpl\xc3\xb6te Normal', journal_entries[0]['Title'])
示例14: test_team_corresponds_to_all_team_group_members
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def test_team_corresponds_to_all_team_group_members(self):
actor = Actor.lookup('team:1')
self.assertTrue(
actor.corresponds_to(self.get_ogds_user(self.regular_user)))
self.assertTrue(
actor.corresponds_to(self.get_ogds_user(self.dossier_responsible)))
self.assertFalse(
actor.corresponds_to(self.get_ogds_user(self.secretariat_user)))
示例15: test_inbox_actor_lookup
# 需要导入模块: from opengever.ogds.base.actor import Actor [as 别名]
# 或者: from opengever.ogds.base.actor.Actor import lookup [as 别名]
def test_inbox_actor_lookup(self):
actor = Actor.lookup('inbox:fa')
self.assertEqual(u'Inbox: Finanzamt', actor.get_label())
self.assertIsNone(actor.get_profile_url())
self.assertEqual('Inbox: Finanzamt', actor.get_link())
self.assertEqual(u'fa_inbox_users', actor.permission_identifier)
self.assertEqual(
u'<span class="actor-label actor-inbox">Inbox: Finanzamt</span>',
actor.get_link(with_icon=True))