Exemplo n.º 1
0
 def encyclopedia_link_attr_generator(match):
     matched_str = match.group(0)
     assert matched_str
     # detecting here WHICH keyword triggered the match would be possible, but expensive... let's postpone that
     link = reverse("pychronia_game.views.view_encyclopedia",
                    kwargs={"game_instance_id": datamanager.game_instance_id})
     link += "?search=%s" % urllib.quote_plus(matched_str.encode("utf8"), safe=b"")
     return dict(href=link)
Exemplo n.º 2
0
 def site_link_attr_generator(match):
     matched_str = match.group("view")
     if "." not in matched_str:
         matched_str = "pychronia_game.views." + matched_str
     try:
         link = reverse(matched_str, kwargs={"game_instance_id": datamanager.game_instance_id})
         return dict(href=link)
     except Exception:
         logging.warning("Error in generate_site_links for match %r", matched_str, exc_info=True)
         return None # abort link creation
Exemplo n.º 3
0
 def email_link_attr_generator(match):
     matched_str = match.group(0)
     link = reverse("pychronia_game.views.compose_message",
                    kwargs={"game_instance_id": datamanager.game_instance_id})
     link += "?recipient=%s" % urllib.quote_plus(matched_str.encode("utf8"), safe=b"")
     return dict(href=link)