On 1/9/07, serbaut <[EMAIL PROTECTED]> wrote: > fields.py tries to get settings.URL_VALIDATOR_USER_AGENT with: > > try: > from django.conf import settings > URL_VALIDATOR_USER_AGENT = settings.URL_VALIDATOR_USER_AGENT > except ImportError: > # It's OK if Django settings aren't configured. > URL_VALIDATOR_USER_AGENT = 'Django (http://www.djangoproject.com/)' > > Should that be "except AttributeError" in case URL_VALIDATOR_USER_AGENT > isnt defined in settings or do you mean that only settings import > errors should be catched?
It's correct as-is, because we can safely assume the URL_VALIDATOR_USER_AGENT setting exists. That's because Django uses django.conf.global_settings as its default; any setting defined in there can be assumed to be available at any time. The try/except in this case is meant to handle the case in which somebody is using newforms without the rest of Django, which was an early goal of mine. Since then, I've sort of resigned myself to requiring Django, due to ties into the internationalization hooks and various Django functions, but it's still an eventual goal. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---