Skip to content

Retrieve HTML URL to display to users #32

@klmitch

Description

@klmitch

I would find it handy to be able to obtain an HTML URL to display to users for objects like projects or issues. As an example, for issues, I'm currently monkeypatching the following into redmine.redmine.Issue:

@property
def html_url(self):
    """
    Retrieve an HTML URL for the issue.
    """

    # Have to strip off the '.json' suffix
    path = (self._item_path % self.id)[:-len('.json')]

    # Merge safely with the URL base and return
    return self._redmine._url.rstrip('/') + path

If the Redmine URL is "http://redmine.example.com/", and the issue has id 23, the above would give me the issue URL "http://redmine.example.com/issues/23", which I could then use in, say, the body of an email to refer a user to the Redmine user interface for that issue. I don't know if that trick would work for the other objects, but it would be a handy feature to have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions