def entity_url(entity, **kwargs): if isinstance(entity, model.User): return user.url(entity, **kwargs) elif isinstance(entity, model.Proposal): return proposal.url(entity, **kwargs) elif isinstance(entity, model.Page): return page.url(entity, **kwargs) elif isinstance(entity, model.Text): return text.url(entity, **kwargs) elif isinstance(entity, model.Delegateable): return delegateable.url(entity, **kwargs) elif isinstance(entity, model.Poll): return poll.url(entity, **kwargs) elif isinstance(entity, model.Selection): return selection.url(entity, **kwargs) elif isinstance(entity, model.Comment): return comment.url(entity, **kwargs) elif isinstance(entity, model.Instance): return instance.url(entity, **kwargs) elif isinstance(entity, model.Delegation): return delegation.url(entity, **kwargs) elif isinstance(entity, model.Milestone): return milestone.url(entity, **kwargs) elif isinstance(entity, model.Tag): return tag.url(entity, **kwargs) elif isinstance(entity, model.StaticPage): return staticpage.url(entity, **kwargs) elif isinstance(entity, model.Treatment): return treatment.url(entity, **kwargs) elif isinstance(entity, model.Message): return message.url(entity, **kwargs) elif (isinstance(entity, model.CategoryBadge) and c.instance is not None and c.instance.display_category_pages): return category.url(entity, **kwargs) raise ValueError("No URL maker for: %s" % repr(entity))
def entity_url(entity, **kwargs): if isinstance(entity, model.User): return user.url(entity, **kwargs) elif isinstance(entity, model.Proposal): return proposal.url(entity, **kwargs) elif isinstance(entity, model.Page): return page.url(entity, **kwargs) elif isinstance(entity, model.Text): return text.url(entity, **kwargs) elif isinstance(entity, model.Delegateable): return delegateable.url(entity, **kwargs) elif isinstance(entity, model.Poll): return poll.url(entity, **kwargs) elif isinstance(entity, model.Selection): return selection.url(entity, **kwargs) elif isinstance(entity, model.Comment): return comment.url(entity, **kwargs) elif isinstance(entity, model.Instance): return instance.url(entity, **kwargs) elif isinstance(entity, model.Delegation): return delegation.url(entity, **kwargs) elif isinstance(entity, model.Milestone): return milestone.url(entity, **kwargs) elif isinstance(entity, model.Tag): return tag.url(entity, **kwargs) raise ValueError("No URL maker for: %s" % repr(entity))