Index: E:/Software/workspace/django/django/template/__init__.py
===================================================================
--- E:/Software/workspace/django/django/template/__init__.py	(revision 7661)
+++ E:/Software/workspace/django/django/template/__init__.py	(working copy)
@@ -49,7 +49,7 @@
 u'<html></html>'
 """
 import re
-from inspect import getargspec
+from inspect import getargspec, isfunction
 from django.conf import settings
 from django.template.context import Context, RequestContext, ContextPopException
 from django.utils.itercompat import is_iterable
@@ -859,22 +859,44 @@
         self.filters[getattr(func, "_decorated_function", func).__name__] = func
         return func
 
-    def simple_tag(self,func):
-        params, xx, xxx, defaults = getargspec(func)
+    def simple_tag(self, *args, **kwargs):
+        def dec(func):
+            params, xx, xxx, defaults = getargspec(func)
+            if takes_context:
+                if params[0] == 'context':
+                    params = params[1:]
+                else:
+                    raise TemplateSyntaxError("Any tag function decorated with takes_context=True must have a first argument of 'context'")
 
-        class SimpleNode(Node):
-            def __init__(self, vars_to_resolve):
-                self.vars_to_resolve = map(Variable, vars_to_resolve)
+            class SimpleNode(Node):
+                def __init__(self, vars_to_resolve):
+                    self.vars_to_resolve = map(Variable, vars_to_resolve)
+    
+                def render(self, context):
+                    resolved_vars = [var.resolve(context) for var in self.vars_to_resolve]
+                    if takes_context:
+                        func_args = [context] + resolved_vars
+                    else:
+                        func_args = resolved_vars
+                    return func(*func_args)
 
-            def render(self, context):
-                resolved_vars = [var.resolve(context) for var in self.vars_to_resolve]
-                return func(*resolved_vars)
+            compile_func = curry(generic_tag_compiler, params, defaults, getattr(func, "_decorated_function", func).__name__, SimpleNode)
+            compile_func.__doc__ = func.__doc__
+            self.tag(getattr(func, "_decorated_function", func).__name__, compile_func)
+            return func
+        
+        if len(args) == 1 and len(kwargs) == 0 and isfunction(args[0]):
+            takes_context = False
+            return dec(args[0])
+        elif len(args) == 0 and len(kwargs) == 0:
+            takes_context = False
+            return dec
+        elif len(args) == 0 and len(kwargs) == 1 and 'takes_context' in kwargs:
+            takes_context = kwargs['takes_context']
+            return dec
+        else:
+            raise TemplateSyntaxError("Incorrect parameters for simple_tag")
 
-        compile_func = curry(generic_tag_compiler, params, defaults, getattr(func, "_decorated_function", func).__name__, SimpleNode)
-        compile_func.__doc__ = func.__doc__
-        self.tag(getattr(func, "_decorated_function", func).__name__, compile_func)
-        return func
-
     def inclusion_tag(self, file_name, context_class=Context, takes_context=False):
         def dec(func):
             params, xx, xxx, defaults = getargspec(func)
Index: E:/Software/workspace/django/tests/regressiontests/templates/tests.py
===================================================================
--- E:/Software/workspace/django/tests/regressiontests/templates/tests.py	(revision 7641)
+++ E:/Software/workspace/django/tests/regressiontests/templates/tests.py	(working copy)
@@ -17,6 +17,7 @@
 from django.utils.safestring import mark_safe
 from django.utils.tzinfo import LocalTimezone
 
+from decorators import DecoratorsTest
 from unicode import unicode_tests
 from context import context_tests
 
Index: E:/Software/workspace/django/tests/regressiontests/templates/decorators.py
===================================================================
--- E:/Software/workspace/django/tests/regressiontests/templates/decorators.py	(revision 0)
+++ E:/Software/workspace/django/tests/regressiontests/templates/decorators.py	(revision 0)
@@ -0,0 +1,42 @@
+from unittest import TestCase
+from sys import version_info
+
+from django import template
+
+register = template.Library()
+
+def a_simple_tag(arg):
+    """Expected __doc__"""
+    return "Expected result"
+a_simple_tag.anything = "Expected __dict__"
+
+a_simple_tag = register.simple_tag(a_simple_tag)
+
+
+def a_simple_tag_with_context(context, arg):
+    """Expected __doc__"""
+    return "Expected result"
+a_simple_tag_with_context.anything = "Expected __dict__"
+
+a_simple_tag_with_context = register.simple_tag(takes_context=True)(a_simple_tag_with_context)
+
+
+
+class DecoratorsTest(TestCase):
+
+    def test_simple_tag(self):
+        # Only check __name__ on Python 2.4 or later since __name__ can't be
+        # assigned to in earlier Python versions.
+        if version_info[0] >= 2 and version_info[1] >= 4:
+            self.assertEquals(a_simple_tag.__name__, 'a_simple_tag')
+        self.assertEquals(a_simple_tag.__doc__, 'Expected __doc__')
+        self.assertEquals(a_simple_tag.__dict__['anything'], 'Expected __dict__')
+
+
+    def test_simple_tag_with_context(self):
+        # Only check __name__ on Python 2.4 or later since __name__ can't be
+        # assigned to in earlier Python versions.
+        if version_info[0] >= 2 and version_info[1] >= 4:
+            self.assertEquals(a_simple_tag_with_context.__name__, 'a_simple_tag_with_context')
+        self.assertEquals(a_simple_tag_with_context.__doc__, 'Expected __doc__')
+        self.assertEquals(a_simple_tag_with_context.__dict__['anything'], 'Expected __dict__')
\ No newline at end of file
Index: E:/Software/workspace/django/docs/templates_python.txt
===================================================================
--- E:/Software/workspace/django/docs/templates_python.txt	(revision 7641)
+++ E:/Software/workspace/django/docs/templates_python.txt	(working copy)
@@ -1169,7 +1169,7 @@
 In Python 2.4, the decorator syntax also works::
 
     @register.simple_tag
-    def current_time(token):
+    def current_time(format_string):
         ...
 
 A couple of things to note about the ``simple_tag`` helper function:
@@ -1184,6 +1184,26 @@
 function to work with the input values and using the ``simple_tag`` helper is
 the easiest way to create a new tag.
 
+If your template tag *does* need to access the current context, you can use the
+``takes_context`` option as follows::
+
+    # The first argument *must* be called "context" here.
+    def current_time(context, format_string):
+        timezone = context['timezone']
+        ...
+
+    register.simple_tag(takes_context=True)(current_time)
+
+You can also use the decorator syntax if running in Python 2.4::
+
+    @register.simple_tag(takes_context=True)
+    def current_time(context, format_string):
+
+For more information on how the ``takes_context`` option works, see the section
+on `inclusion tags`_.
+
+.. _inclusion tags: #inclusion-tags
+
 Inclusion tags
 ~~~~~~~~~~~~~~
 
