Permalink
Browse files

Automatically assign widgets an ID.

  • Loading branch information...
ralphbean committed May 26, 2013
1 parent 5d7b43a commit ca81db016c06583e37f573c8bec815e7c084dc1a
Showing with 6 additions and 0 deletions.
  1. +6 −0 tw2/core/widgets.py
@@ -6,6 +6,7 @@
import itertools
import inspect
import webob
import uuid
from . import templating
from . import core
@@ -318,6 +319,11 @@ def prepare(self):
super(MyWidget, self).prepare()
self.value = 'My: ' + str(self.value)
"""
# First, if we don't already have an id, then pick a random one.
if not hasattr(self, 'id'):
self.id = 'id_' + str(uuid.uuid4()).replace('-', '')
for a in self._deferred:
dfr = getattr(self, a)
if isinstance(dfr, pm.Deferred):

0 comments on commit ca81db0

Please sign in to comment.