Index: django/template/defaulttags.py
===================================================================
--- django/template/defaulttags.py	(revision 6716)
+++ django/template/defaulttags.py	(working copy)
@@ -39,15 +39,67 @@
 
 class CycleNode(Node):
     def __init__(self, cyclevars, variable_name=None):
-        self.cycle_iter = itertools_cycle(cyclevars)
+        self.cycle_iter = None
         self.variable_name = variable_name
+        self.cyclevars = cyclevars
+        self.resolve = None
+        self.collection = None
 
+    def render_init(self,context):
+        if len(self.cyclevars) == 1:
+        #startning from syntax check
+            if not context.has_key(self.cyclevars[0]):
+                raise TemplateSyntaxError("Named cycle '%s' does not exist" % self.cyclevars[0])
+        try:
+            i = iter(Variable(self.cyclevars[0]).resolve(context))
+            isiterable = True
+        except TypeError:
+            isiterable = False
+        except NameError:
+            isiterable = False
+        if len(self.cyclevars) == 1 and context.has_key(self.cyclevars[0]) and isiterable:
+            #the {% cycle colors %} case
+            self.resolve = False
+            self.collection = Variable(self.cyclevars[0]).resolve(context)
+            self.cycle_iter = itertools_cycle(self.collection)
+        else:
+            self.resolve = True
+            self.collection = self.cyclevars
+            self.cycle_iter = itertools_cycle(self.collection) 
+        context['cycle'] = {
+            # cycle internals
+            'collection': self.collection,
+            'name':self.variable_name,
+            'value':None,
+        }
+        
+    def __repr__(self):
+        return "<Cycle Node: cycle_iter %s, variable_name %s, cyclevars %s, resolve %s, collection %s>" % \
+            (self.cycle_iter, self.variable_name, self.cyclevars, self.resolve, self.collection)
+    
     def render(self, context):
-        value = self.cycle_iter.next()
-        value = Variable(value).resolve(context)
+        if self.collection == None:
+            #first execution of render, so finally we will know the context
+            self.render_init(context)
+        #all is initiated
+        if self.resolve:
+            value = self.cycle_iter.next()
+            try:
+                value = Variable(value).resolve(context)
+            except NameError:
+                pass
+        else:
+            value = self.cycle_iter.next()
+
         if self.variable_name:
             context[self.variable_name] = value
-        return value
+        context['cycle'] = {
+            # cycle internals
+            'collection': self.collection,
+            'name':self.variable_name,
+            'value':value,
+        }
+        return value        
 
 class DebugNode(Node):
     def render(self, context):
@@ -456,7 +508,16 @@
 
     You can use any number of values, seperated by spaces. Commas can also
     be used to separate values; if a comma is used, the cycle values are
-    interpreted as literal strings.
+    interpreted as literal strings. 
+    
+    Additionally when you pass a single value, the cycle tag resolves it from 
+    context and than iterates over context value::
+
+        {'colors': ['red', 'blue', 'green']}
+
+        {% for row in mydata %}
+        <tr class="{% cycle colors %}">...</tr>
+        {% endfor %}
     """
 
     # Note: This returns the exact same node on each {% cycle name %} call;
@@ -480,16 +541,22 @@
         args[1:2] = ['"%s"' % arg for arg in args[1].split(",")]
 
     if len(args) == 2:
-        # {% cycle foo %} case.
+        #two cases: 
+        # {% cycle foo %}
+        # {% cycle foos %} where foos are an iterable type defined in context
         name = args[1]
         if not hasattr(parser, '_namedCycleNodes'):
-            raise TemplateSyntaxError("No named cycles in template."
-                                      " '%s' is not defined" % name)
-        if not name in parser._namedCycleNodes:
-            raise TemplateSyntaxError("Named cycle '%s' does not exist" % name)
-        return parser._namedCycleNodes[name]
+            #if not a table than we will throw an exception at rendering
+            parser._namedCycleNodes = {}
+            node = CycleNode(args[1:2])
+            parser._namedCycleNodes[name] = node
+        else:
+            if not name in parser._namedCycleNodes:
+                raise TemplateSyntaxError("Named cycle '%s' does not exist" % name)
+            node = parser._namedCycleNodes[name]
+        return node
 
-    if len(args) > 4 and args[-2] == 'as':
+    if len(args) >= 4 and args[-2] == 'as':
         name = args[-1]
         node = CycleNode(args[1:-2], name)
         if not hasattr(parser, '_namedCycleNodes'):
Index: tests/regressiontests/templates/tests.py
===================================================================
--- tests/regressiontests/templates/tests.py	(revision 6716)
+++ tests/regressiontests/templates/tests.py	(working copy)
@@ -394,6 +394,17 @@
             'cycle13': ("{% for i in test %}{% cycle 'a' 'b' %}{{ i }},{% endfor %}", {'test': range(5)}, 'a0,b1,a2,b3,a4,'),
             'cycle14': ("{% cycle one two as foo %}{% cycle foo %}", {'one': '1','two': '2'}, '12'),
             'cycle13': ("{% for i in test %}{% cycle aye bee %}{{ i }},{% endfor %}", {'test': range(5), 'aye': 'a', 'bee': 'b'}, 'a0,b1,a2,b3,a4,'),
+            # List format
+            'cycle20': ("{% cycle colors %}", {'colors': 'r'}, 'r'),
+            'cycle21': ("{% cycle colors %}{% cycle colors %}", {'colors': ['r', 'g', 'b']}, 'rg'),
+#            'cycle22': ("{% cycle colors %}{% cycle colors %}", {'colors': {'r': 1, 'g': 2}}, 'rg'), not reliable test
+            'cycle23': ("{% cycle colors %}{% cycle colors %}{% cycle colors %}", {'colors': ['r', 'g', 'b']}, 'rgb'),
+            'cycle24': ("{% cycle colors %}{% cycle colors %}{% cycle colors %}{% cycle colors %}", {'colors': ['r', 'g', 'b']}, 'rgbr'),
+            'cycle25': ("{% cycle colors as color %}{% cycle color %}", {'colors': ['r', 'g', 'b']}, 'rg'),
+            'cycle26': ("{% cycle colors as color %}{% cycle color %}{% cycle color %}", {'colors': ['r', 'g', 'b']}, 'rgb'),
+            'cycle27': ("{% cycle colors as color %}{% cycle color %}{% cycle color %}{% cycle color %}", {'colors': ['r', 'g', 'b']}, 'rgbr'),
+            'cycle28': ("{% for i in test %}{% cycle colors %}{{ cycle.value }}{{ i }},{% endfor %}", {'test': range(5),'colors': ['r', 'g', 'b']}, 'rr0,gg1,bb2,rr3,gg4,'),
+            'cycle29': ("{% for i in test %}{% cycle colors %}{% cycle colors %}{{ i }},{% endfor %}", {'test': range(5),'colors': ['r', 'g', 'b']}, 'rg0,br1,gb2,rg3,br4,'),
 
             ### EXCEPTIONS ############################################################
 
