def get_dirs_from_date(self):
		"""
		Renders a list of all the year "folders" in the system.

		As we're not rendering any photos, we can assume this to be a separate
		function from the photo fetching and rendering; this is just reporting
		certain dates.
		"""
		path = self._env.get('PATH_INFO', '').lstrip('/')
		path = os.path.relpath(path, "photos")
		Logger.debug(path)
		path_parts = path.split(os.sep)
		if len(path_parts) == 1 and path_parts[0] == ".":
			path_parts = []

		year = None if len(path_parts) < 1 else path_parts[0]
		month = None if len(path_parts) < 2 else path_parts[1]
		list = Photo.get_all_dates(year=year, month=month)

		list = [("0%d" % f if f < 10 else str(f)) for f in list]
		list.sort()
		tokens = {
			"dirs": list,
			"year": year,
			"month": month
		}
		return self.construct_response(Template.render("photos/dirs.html", tokens))
Example #2
0
    def get_dirs_from_date(self):
        """
		Renders a list of all the year "folders" in the system.

		As we're not rendering any photos, we can assume this to be a separate
		function from the photo fetching and rendering; this is just reporting
		certain dates.
		"""
        path = self._env.get('PATH_INFO', '').lstrip('/')
        path = os.path.relpath(path, "photos")
        Logger.debug(path)
        path_parts = path.split(os.sep)
        if len(path_parts) == 1 and path_parts[0] == ".":
            path_parts = []

        year = None if len(path_parts) < 1 else path_parts[0]
        month = None if len(path_parts) < 2 else path_parts[1]
        list = Photo.get_all_dates(year=year, month=month)

        list = [("0%d" % f if f < 10 else str(f)) for f in list]
        list.sort()
        tokens = {"dirs": list, "year": year, "month": month}
        return self.construct_response(
            Template.render("photos/dirs.html", tokens))