Index: django/contrib/admin/templates/admin/change_list_results.html
===================================================================
--- django/contrib/admin/templates/admin/change_list_results.html	(revisjon 4815)
+++ django/contrib/admin/templates/admin/change_list_results.html	(arbeidskopi)
@@ -10,7 +10,7 @@
 </thead>
 <tbody>
 {% for result in results %}
-<tr class="{% cycle row1,row2 %}">{% for item in result %}{{ item }}{% endfor %}</tr>
+<tr class="{% cycle 'row1' 'row2' %}">{% for item in result %}{{ item }}{% endfor %}</tr>
 {% endfor %}
 </tbody>
 </table>
Index: django/template/defaulttags.py
===================================================================
--- django/template/defaulttags.py	(revisjon 4815)
+++ django/template/defaulttags.py	(arbeidskopi)
@@ -2,7 +2,7 @@
 
 from django.template import Node, NodeList, Template, Context, resolve_variable
 from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END
-from django.template import get_library, Library, InvalidTemplateLibrary
+from django.template import get_library, Library, InvalidTemplateLibrary, resolve_variable
 from django.conf import settings
 import sys
 
@@ -22,6 +22,7 @@
     def render(self, context):
         self.counter += 1
         value = self.cyclevars[self.counter % self.cyclevars_len]
+	value = resolve_variable(value, context)
         if self.variable_name:
             context[self.variable_name] = value
         return value
@@ -372,7 +373,7 @@
     the loop::
 
         {% for o in some_list %}
-            <tr class="{% cycle row1,row2 %}">
+            <tr class="{% cycle 'row1' 'row2' %}">
                 ...
             </tr>
         {% endfor %}
@@ -380,16 +381,15 @@
     Outside of a loop, give the values a unique name the first time you call
     it, then use that name each sucessive time through::
 
-            <tr class="{% cycle row1,row2,row3 as rowcolors %}">...</tr>
+            <tr class="{% cycle 'row1' 'row2' 'row3' as rowcolors %}">...</tr>
             <tr class="{% cycle rowcolors %}">...</tr>
             <tr class="{% cycle rowcolors %}">...</tr>
 
-    You can use any number of values, seperated by commas. Make sure not to
-    put spaces between the values -- only commas.
+    You can use any number of values, seperated by spaces.
     """
 
     # Note: This returns the exact same node on each {% cycle name %} call; that
-    # is, the node object returned from {% cycle a,b,c as name %} and the one
+    # is, the node object returned from {% cycle a b c as name %} and the one
     # returned from {% cycle name %} are the exact same object.  This shouldn't
     # cause problems (heh), but if it does, now you know.
     #
@@ -398,17 +398,13 @@
     # a global variable, which would make cycle names have to be unique across
     # *all* templates.
 
-    args = token.contents.split()
+    args = token.split_contents()
+    
     if len(args) < 2:
-        raise TemplateSyntaxError("'Cycle' statement requires at least two arguments")
+	raise TemplateSyntaxError("Cycle' statement requires at least two arguments")
 
-    elif len(args) == 2 and "," in args[1]:
-        # {% cycle a,b,c %}
-        cyclevars = [v for v in args[1].split(",") if v]    # split and kill blanks
-        return CycleNode(cyclevars)
-        # {% cycle name %}
-
-    elif len(args) == 2:
+    if len(args) == 2:
+	# {% cycle foo %} case
         name = args[1]
         if not hasattr(parser, '_namedCycleNodes'):
             raise TemplateSyntaxError("No named cycles in template: '%s' is not defined" % name)
@@ -416,22 +412,25 @@
             raise TemplateSyntaxError("Named cycle '%s' does not exist" % name)
         return parser._namedCycleNodes[name]
 
-    elif len(args) == 4:
-        # {% cycle a,b,c as name %}
-        if args[2] != 'as':
-            raise TemplateSyntaxError("Second 'cycle' argument must be 'as'")
-        cyclevars = [v for v in args[1].split(",") if v]    # split and kill blanks
-        name = args[3]
-        node = CycleNode(cyclevars, name)
-
-        if not hasattr(parser, '_namedCycleNodes'):
-            parser._namedCycleNodes = {}
-
-        parser._namedCycleNodes[name] = node
+    if len(args) > 2 and args[-2]:
+	if args[-2] == 'as':
+	    # {% cycle 'value 1' 'value 2' 'value 3' as foo %} case
+	    name = args[-1]
+	    cyclevars = args[1:-2]
+	    node = CycleNode(cyclevars, name)
+	    if not hasattr(parser, '_namedCycleNodes'):
+		parser._namedCycleNodes = {}
+	    parser._namedCycleNodes[name] = node
+	else:
+	    # {% cycle 'value 1' 'value 2' 'value 3' %} case
+	    cyclevars = args[1:]
+	    node = CycleNode(cyclevars)
+        
         return node
 
-    else:
-        raise TemplateSyntaxError("Invalid arguments to 'cycle': %s" % args)
+    # none of the cases were met
+    raise TemplateSyntaxError("Invalid arguments to 'cycle': %s" % args)
+    
 cycle = register.tag(cycle)
 
 def debug(parser, token):
Index: tests/regressiontests/templates/tests.py
===================================================================
--- tests/regressiontests/templates/tests.py	(revisjon 4815)
+++ tests/regressiontests/templates/tests.py	(arbeidskopi)
@@ -233,13 +233,17 @@
 
             ### CYCLE TAG #############################################################
             'cycle01': ('{% cycle a %}', {}, template.TemplateSyntaxError),
-            'cycle02': ('{% cycle a,b,c as abc %}{% cycle abc %}', {}, 'ab'),
-            'cycle03': ('{% cycle a,b,c as abc %}{% cycle abc %}{% cycle abc %}', {}, 'abc'),
-            'cycle04': ('{% cycle a,b,c as abc %}{% cycle abc %}{% cycle abc %}{% cycle abc %}', {}, 'abca'),
-            'cycle05': ('{% cycle %}', {}, template.TemplateSyntaxError),
-            'cycle06': ('{% cycle a %}', {}, template.TemplateSyntaxError),
-            'cycle07': ('{% cycle a,b,c as foo %}{% cycle bar %}', {}, template.TemplateSyntaxError),
-            'cycle08': ('{% cycle a,b,c as foo %}{% cycle foo %}{{ foo }}{{ foo }}{% cycle foo %}{{ foo }}', {}, 'abbbcc'),
+            'cycle02': ("{% cycle 'a' 'b' 'c' as abc %}{% cycle abc %}", {}, 'ab'),
+            'cycle03': ("{% cycle 'a' 'b' 'c' as abc %}{% cycle abc %}{% cycle abc %}", {}, 'abc'),
+            'cycle04': ("{% cycle 'a' 'b' 'c' as abc %}{% cycle abc %}{% cycle abc %}{% cycle abc %}", {}, 'abca'),
+            'cycle05': ("{% cycle %}", {}, template.TemplateSyntaxError),
+            'cycle06': ("{% cycle a %}", {}, template.TemplateSyntaxError),
+            'cycle07': ("{% cycle 'a' 'b' 'c' as foo %}{% cycle bar %}", {}, template.TemplateSyntaxError),
+            'cycle08': ("{% cycle 'a' 'b' 'c' as foo %}{% cycle foo %}{{ foo }}{{ foo }}{% cycle foo %}{{ foo }}",
+			{}, 'abbbcc'),
+	    'cycle09': ("{% cycle 'chris 1' 'camri is cute' 'cotton' as foo %}{% cycle foo %}", {}, 'chris 1camri is cute'),
+	    'cycle10': ("{% for i in test %}{% cycle 'row1' 'row2' %}{% endfor %}", {'test':[1,2]}, 'row1row2'),
+	    'cycle11': ("{% cycle one two as foo %}{% cycle foo %}", {'one':'1','two':'2'}, '12'),
 
             ### EXCEPTIONS ############################################################
 
Index: docs/templates.txt
===================================================================
--- docs/templates.txt	(revisjon 4815)
+++ docs/templates.txt	(arbeidskopi)
@@ -362,7 +362,7 @@
 Within a loop, cycles among the given strings each time through the loop::
 
     {% for o in some_list %}
-        <tr class="{% cycle row1,row2 %}">
+        <tr class="{% cycle 'row1' 'row2' %}">
             ...
         </tr>
     {% endfor %}
@@ -370,12 +370,11 @@
 Outside of a loop, give the values a unique name the first time you call it,
 then use that name each successive time through::
 
-        <tr class="{% cycle row1,row2,row3 as rowcolors %}">...</tr>
+        <tr class="{% cycle 'row1' 'row2' 'row3' as rowcolors %}">...</tr>
         <tr class="{% cycle rowcolors %}">...</tr>
         <tr class="{% cycle rowcolors %}">...</tr>
 
-You can use any number of values, separated by commas. Make sure not to put
-spaces between the values -- only commas.
+You can use any number of values,  separated by spaces.
 
 debug
 ~~~~~
