Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Commit

Permalink
post.path should always be computed from the permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
EnigmaCurry committed Apr 10, 2010
1 parent 18c4878 commit 6a474bc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions blogofile/site_init/blog_features/_controllers/blog/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"each seperated by commas",
"permalink" :"The full permanent URL for this post. "\
"Automatically created if not provided",
"path" :"The path from the permalink of the post",
"guid" :"A unique hash for the post, if not provided it "\
"is assumed that the permalink is the guid",
"author" :"The name of the author of the post",
Expand Down Expand Up @@ -182,8 +183,6 @@ def __post_process(self):
self.permalink = re.sub(":uuid", hashlib.sha1(
self.title.encode('utf-8')).hexdigest(), self.permalink)

self.path = urlparse.urlparse(self.permalink).path

logger.debug("Permalink: %s" % self.permalink)

def __parse_yaml(self, yaml_src):
Expand All @@ -199,7 +198,6 @@ def __parse_yaml(self, yaml_src):
if not self.permalink.startswith(bf.config.site.url):
raise PostParseException(self.filename+": permalink for a different site"
" than configured")
self.path = urlparse.urlparse(self.permalink).path
logger.debug("path from permalink: "+self.path)
except KeyError:
pass
Expand Down Expand Up @@ -252,6 +250,13 @@ def __cmp__(self, other_post):
return cmp(self.date, other_post.date)
def __eq__(self, other_post):
return self is other_post
def __getattr__(self, name):
if name == "path":
#Always generate the path from the permalink
return self.permapath()
else:
raise AttributeError, name


class Category:
def __init__(self, name):
Expand Down

0 comments on commit 6a474bc

Please sign in to comment.