Ejemplo n.º 1
0
	def postProcess(self, parsed, filename, languages):
		for key, value in parsed.items():
			if type(value) is str:
				parsed[key] = self.__fixJasyCommands(value)

		if "slug" in parsed:
			parsed["slug"] = Util.fixSlug(parsed["slug"])
		else:
			parsed["slug"] = Util.fixSlug(parsed["title"])

		parsed["content"] = Util.fixCoreTemplating(parsed["content"])

		if not "status" in parsed:
			parsed["status"] = "published"
		if not "pos" in parsed:
			parsed["pos"] = 0
		else:
			parsed["pos"] = int(parsed["pos"])

		if not "lang" in parsed:
			parsed["lang"] = self.__defaultLanguage

		if parsed["lang"] not in languages:
			languages.append(parsed["lang"])

		# Add modification time and short hash
		parsed["mtime"] = os.path.getmtime(filename)
		parsed["hash"] = File.sha1(filename)[0:8]

		# Create simple boolean flag for publish state check
		parsed["publish"] = parsed["status"] == "published"

		# Parse date if available
		if "date" in parsed:
			parsed["date"] = dateutil.parser.parse(parsed["date"]).replace(tzinfo=dateutil.tz.tzlocal())

		return parsed
Ejemplo n.º 2
0
 def getChecksum(self):
     return File.sha1(self.fp)
Ejemplo n.º 3
0
    def getChecksum(self, mode="rb"):
        """Returns the SHA1 checksum of the item."""

        return File.sha1(open(self.getPath(), mode))
Ejemplo n.º 4
0
 def getChecksum(self):
     return File.sha1(self.fp)
Ejemplo n.º 5
0
 def getChecksum(self, mode="rb"):
     """Returns the SHA1 checksum of the item"""
     
     return File.sha1(open(self.getPath(), mode))