Skip to content

Commit

Permalink
Made some character encoding fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jahaja committed Sep 6, 2014
1 parent faa0c15 commit e7dc5ac
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion psdash/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def get_logs(self):
try:
stat = os.stat(log.filename)
available_logs.append({
'path': log.filename,
'path': log.filename.encode("utf-8"),
'size': stat.st_size,
'atime': stat.st_atime,
'mtime': stat.st_mtime
Expand Down
6 changes: 3 additions & 3 deletions psdash/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<tbody>
{% for u in users %}
<tr>
<td>{{ u.name }}</td>
<td>{{ u.name.decode("utf-8") }}</td>
<td>{{ u.started|fromtimestamp }}</td>
<td>{{ u.host }}</td>
</tr>
Expand All @@ -56,7 +56,7 @@
<table class="cpu table table-striped table-bordered">
<tr>
<td class="label-col">Load average</td>
<td class="load" style="word-spacing: 10px;">{{ load_avg[0] }} {{ load_avg[1] }} {{ load_avg[2] }}</td>
<td class="load" style="word-spacing: 10px;">{{ load_avg[0]|round(2) }} {{ load_avg[1]|round(2) }} {{ load_avg[2]|round(2) }}</td>
</tr>
<tr>
<td class="label-col">User</td>
Expand Down Expand Up @@ -148,7 +148,7 @@
<tbody>
{% for ni in net_interfaces %}
<tr>
<td>{{ ni.name }}</td>
<td>{{ ni.name.decode("utf-8") }}</td>
<td>{{ ni.ip }}</td>
<td>{{ ni.send_rate|default(0)|filesizeformat }}</td>
<td>{{ ni.recv_rate|default(0)|filesizeformat }}</td>
Expand Down
6 changes: 5 additions & 1 deletion psdash/templates/logs.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
<tbody>
{% for log in logs %}
<tr>
<td><a href="{{ url_for(".view_log", filename=log.path) }}">{{ log.path }}</a></td>
<td>
<a href="{{ url_for(".view_log", filename=log.path.decode("utf-8")) }}">
{{ log.path.decode("utf-8") }}
</a>
</td>
<td>{{ log.size|filesizeformat }}</td>
<td>{{ log.atime|fromtimestamp }}</td>
<td>{{ log.mtime|fromtimestamp }}</td>
Expand Down
2 changes: 1 addition & 1 deletion psdash/templates/network.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tbody>
{% for io in network_interfaces %}
<tr>
<td>{{ io.name }}</td>
<td>{{ io.name.decode("utf-8") }}</td>
<td>{{ io.ip }}</td>
<td>{{ io.bytes_sent }}</td>
<td>{{ io.bytes_recv }}</td>
Expand Down
4 changes: 2 additions & 2 deletions psdash/templates/process/environment.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<tbody>
{% for var, value in process_environ.iteritems() %}
<tr>
<td>{{ var }}</td>
<td>{{ value }}</td>
<td>{{ var.decode("utf-8") }}</td>
<td>{{ value.decode("utf-8") }}</td>
</tr>
{% endfor %}
</tbody>
Expand Down
4 changes: 2 additions & 2 deletions psdash/templates/process/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<tr>
<td>Command</td>
<td>
{{ process.cmdline }}
{{ process.cmdline.decode("utf-8") }}
</td>
</tr>
<tr>
Expand Down Expand Up @@ -113,7 +113,7 @@
</tr>
<tr>
<td>CWD</td>
<td>{{ process.cwd }}</td>
<td>{{ process.cwd.decode("utf-8") }}</td>
</tr>
<tr>
<td># File-descriptors</td>
Expand Down
4 changes: 3 additions & 1 deletion psdash/templates/processes.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
{% for p in processes %}
<tr>
<td>{{ p.pid }}</td>
<td title="{{ p.cmdline }}"><a href="{{ url_for(".process", pid=p.pid) }}">{{ p.name }}</a></td>
<td title="{{ p.cmdline.decode("utf-8") }}">
<a href="{{ url_for(".process", pid=p.pid) }}">{{ p.name.decode("utf-8") }}</a>
</td>
<td>{{ p.user }}</td>
<td>{{ p.status }}</td>
<td>{{ p.created|fromtimestamp }}</td>
Expand Down

0 comments on commit e7dc5ac

Please sign in to comment.