Browse files

Workflow macro: use 12 hexdigits for graph ids instead of 8.

On Linux x86_64, `id()` returns a large integer which is represented by more than 8 hex digits.

Also, use `"%0nx"` instead of `"%.nx`, the latter happens to work but is normally meant to be used for floating point values. (''The precision is not allowed for integer values'', [http://docs.python.org/library/string.html#formatstrings 7.1.3]).


git-svn-id: http://svn.edgewall.org/repos/trac/trunk@11033 af82e41b-90c4-0310-8c96-b1721e28e2e2
  • Loading branch information...
1 parent b44d860 commit 81e4866645d05623b2001798caa0c64787ba94c9 cboos committed Apr 15, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 trac/htdocs/js/workflow_graph.js
  2. +1 −1 trac/ticket/default_workflow.py
View
2 trac/htdocs/js/workflow_graph.js
@@ -208,7 +208,7 @@
$(document).ready(function() {
$('.trac-workflow-graph').each(function (index) {
- var data = window['graph_' + this.id.slice(-8)];
+ var data = window['graph_' + this.id.slice(-12)];
var width = data.width, height = data.height;
var nodes = [], actions = [], edges = [];
for (var i = 0; i < data.nodes.length; ++i)
View
2 trac/ticket/default_workflow.py
@@ -485,7 +485,7 @@ def expand_macro(self, formatter, name, text, args):
graph = {'nodes': states, 'actions': action_names, 'edges': edges,
'width': args.get('width', 800),
'height': args.get('height', 600)}
- graph_id = '%.8x' % id(graph)
+ graph_id = '%012x' % id(graph)
req = formatter.req
add_script(req, 'common/js/excanvas.js', ie_if='IE')
add_script(req, 'common/js/workflow_graph.js')

0 comments on commit 81e4866

Please sign in to comment.