Skip to content

Commit

Permalink
Rev1277, Fix sidebar site size display
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcutme committed Apr 27, 2016
1 parent 432aa03 commit 3294f62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions plugins/Sidebar/SidebarPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,18 @@ def sidebarRenderFileStats(self, body, site):
# Collect stats
size_filetypes = {}
size_total = 0
for content in site.content_manager.contents.values():
for key, content in site.content_manager.contents.iteritems():
if "files" not in content:
continue
for file_name, file_details in content["files"].items():
size_total += file_details["size"]
ext = file_name.split(".")[-1]
size_filetypes[ext] = size_filetypes.get(ext, 0) + file_details["size"]
size_other = size_total

# The missing difference is content.json sizes
if "json" in size_filetypes:
size_filetypes["json"] += site.settings["size"] - size_total
size_total = size_other = site.settings["size"]

# Bar
for extension, color in extensions:
Expand Down
2 changes: 1 addition & 1 deletion src/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Config(object):

def __init__(self, argv):
self.version = "0.3.7"
self.rev = 1276
self.rev = 1277
self.argv = argv
self.action = None
self.config_file = "zeronet.conf"
Expand Down

0 comments on commit 3294f62

Please sign in to comment.