Merged [4721] from adam@nostrum.com:
Adding an \'href\' method to documents. It doesn\'t work for documents of type \'liai-att\' or \'liaison\', but it's a good start.
- Legacy-Id: 4726
Note: SVN reference [4721] has been migrated to Git commit 80d7ab9eba
This commit is contained in:
commit
c7c4679d57
|
@ -75,6 +75,18 @@ class DocumentInfo(models.Model):
|
|||
else:
|
||||
raise NotImplemented
|
||||
|
||||
def href(self):
|
||||
try:
|
||||
format = settings.DOC_HREFS[self.type_id]
|
||||
except KeyError:
|
||||
if len(self.external_url):
|
||||
return self.external_url
|
||||
return None
|
||||
meeting = None
|
||||
if self.type_id in ("agenda", "minutes", "slides"):
|
||||
meeting = self.name.split("-")[1]
|
||||
return format.format(doc=self,meeting=meeting)
|
||||
|
||||
def set_state(self, state):
|
||||
"""Switch state type implicit in state to state. This just
|
||||
sets the state, doesn't log the change."""
|
||||
|
@ -173,7 +185,6 @@ class Document(DocumentInfo):
|
|||
return urlreverse('doc_view', kwargs={ 'name': name }, urlconf="ietf.urls")
|
||||
|
||||
|
||||
|
||||
def file_tag(self):
|
||||
return u"<%s>" % self.filename_with_rev()
|
||||
|
||||
|
|
|
@ -210,6 +210,22 @@ IESG_MINUTES_FILE = '/a/www/www6/iesg/internal/minutes.txt'
|
|||
IESG_WG_EVALUATION_DIR = "/a/www/www6/iesg/evaluation"
|
||||
INTERNET_DRAFT_ARCHIVE_DIR = '/a/www/www6s/draft-archive'
|
||||
|
||||
# Ideally, more of these would be local -- but since we don't support
|
||||
# versions right now, we'll point to external websites
|
||||
DOC_HREFS = {
|
||||
"agenda": "/meeting/{meeting}/agenda/{doc.group.acronym}/",
|
||||
#"charter": "/doc/{doc.name}-{doc.rev}/",
|
||||
"charter": "http://www.ietf.org/charter/{doc.name}-{doc.rev}.txt",
|
||||
#"draft": "/doc/{doc.name}-{doc.rev}/",
|
||||
"draft": "http://tools.ietf.org/html/{doc.name}-{doc.rev}",
|
||||
# I can't figure out the liaison maze. Hopefully someone
|
||||
# who understands this better can take care of it.
|
||||
#"liai-att": None
|
||||
#"liaison": None
|
||||
"minutes": "http://www.ietf.org/proceedings/{meeting}/minutes/{doc.name}",
|
||||
"slides": "http://www.ietf.org/proceedings/{meeting}/slides/{doc.name}",
|
||||
}
|
||||
|
||||
# Override this in settings_local.py if needed
|
||||
CACHE_MIDDLEWARE_SECONDS = 300
|
||||
CACHE_MIDDLEWARE_KEY_PREFIX = ''
|
||||
|
|
Loading…
Reference in a new issue