<NME> easy_maps_tags.py
<BEF> from django import template
from django.core.exceptions import ImproperlyConfigured

from classytags.arguments import Argument, IntegerArgument
from classytags.core import Options
from classytags.helpers import InclusionTag

from ..conf import settings
from ..models import Address


register = template.Library()

CENTER = settings.EASY_MAPS_CENTER


class EasyMapTag(InclusionTag):
    """

    if not address:
        return Address(
            latitude=settings.EASY_MAPS_CENTER[0],
            longitude=settings.EASY_MAPS_CENTER[1],
        )

    return Address.objects.for_address(address)


class EasyMapTag(InclusionTag):
    """
        Argument('address', resolve=True, required=True),
        IntegerArgument('width', required=False, default=None),
        IntegerArgument('height', required=False, default=None),
        IntegerArgument('zoom', required=False, default=16),
        'using',
        Argument('template_name', default=None, required=False),
    )

    def render_tag(self, context, **kwargs):
        params = dict((k, v) for k, v in kwargs.items() if v is not None)
        if len(params.keys()) == 3 or len(params.keys()) > 5:
            raise template.TemplateSyntaxError(
                "easy_map tag has the following syntax: "
                "{% easy_map <address> [<width> <height>] [zoom] [using <template_name>] %}"
        Argument("width", required=False, default=None),
        Argument("height", required=False, default=None),
        IntegerArgument("zoom", required=False, default=None),
        "using",
        Argument("template_name", default=None, required=False),
    )

    def render_tag(self, context, **kwargs):
            return address

        if not address:
            return Address(latitude=CENTER[0], longitude=CENTER[1])
        else:
            return Address.objects.get_or_create(address=address)[0]

                "because of the restrictions introduced in Google Maps API v3 by Google, Inc."

    def get_context(self, context, **kwargs):
        kwargs.update({'map': self.parse_address(kwargs.pop('address'))})
        return kwargs

register.tag(EasyMapTag)
        if not kwargs.get("zoom", None):
            kwargs["zoom"] = settings.EASY_MAPS_ZOOM  # default value
        kwargs["language"] = settings.EASY_MAPS_LANGUAGE
        kwargs["api_key"] = settings.EASY_MAPS_GOOGLE_KEY or settings.EASY_MAPS_GOOGLE_MAPS_API_KEY
        return kwargs


register.tag(EasyMapTag)

<MSG> better ``TemplateSyntaxError`` exception handling

<DFF> @@ -11,8 +11,6 @@ from ..models import Address
 
 register = template.Library()
 
-CENTER = settings.EASY_MAPS_CENTER
-
 
 class EasyMapTag(InclusionTag):
     """
@@ -31,14 +29,14 @@ class EasyMapTag(InclusionTag):
         Argument('address', resolve=True, required=True),
         IntegerArgument('width', required=False, default=None),
         IntegerArgument('height', required=False, default=None),
-        IntegerArgument('zoom', required=False, default=16),
+        IntegerArgument('zoom', required=False, default=None),
         'using',
         Argument('template_name', default=None, required=False),
     )
 
     def render_tag(self, context, **kwargs):
-        params = dict((k, v) for k, v in kwargs.items() if v is not None)
-        if len(params.keys()) == 3 or len(params.keys()) > 5:
+        params = dict((k, v) for k, v in kwargs.items() if v and k not in ['template_name'])
+        if 'address' in params and (len(params) == 2 or len(params) > 4):
             raise template.TemplateSyntaxError(
                 "easy_map tag has the following syntax: "
                 "{% easy_map <address> [<width> <height>] [zoom] [using <template_name>] %}"
@@ -53,7 +51,10 @@ class EasyMapTag(InclusionTag):
             return address
 
         if not address:
-            return Address(latitude=CENTER[0], longitude=CENTER[1])
+            return Address(
+                latitude=settings.EASY_MAPS_CENTER[0],
+                longitude=settings.EASY_MAPS_CENTER[1],
+            )
         else:
             return Address.objects.get_or_create(address=address)[0]
 
@@ -61,6 +62,8 @@ class EasyMapTag(InclusionTag):
 
     def get_context(self, context, **kwargs):
         kwargs.update({'map': self.parse_address(kwargs.pop('address'))})
+        if not kwargs.get('zoom', None):
+            kwargs['zoom'] = 16  # default value
         return kwargs
 
 register.tag(EasyMapTag)

better ``TemplateSyntaxError`` exception handling