[Checkins] SVN: grok/branches/ulif-i18n/src/grok/ Make localesdir more templatedir-compatible.

Uli Fouquet uli at gnufix.de
Wed Oct 17 21:19:28 EDT 2007


Log message for revision 80910:
  Make localesdir more templatedir-compatible.

Changed:
  U   grok/branches/ulif-i18n/src/grok/ftests/i18n/register_translations.py
  U   grok/branches/ulif-i18n/src/grok/i18n.py

-=-
Modified: grok/branches/ulif-i18n/src/grok/ftests/i18n/register_translations.py
===================================================================
--- grok/branches/ulif-i18n/src/grok/ftests/i18n/register_translations.py	2007-10-17 22:26:40 UTC (rev 80909)
+++ grok/branches/ulif-i18n/src/grok/ftests/i18n/register_translations.py	2007-10-18 01:19:27 UTC (rev 80910)
@@ -91,7 +91,7 @@
 # ('locales'). This is not neccessary, because the 'locales' dir would
 # be searched by default for translations. But calling it explicitly,
 # we provoke complains about missing directories.
-grok.localesdir()
+grok.localesdir('locales')
 
 class I18nSavannah(grok.Application, grok.Container):
     """A place for mammoths.

Modified: grok/branches/ulif-i18n/src/grok/i18n.py
===================================================================
--- grok/branches/ulif-i18n/src/grok/i18n.py	2007-10-17 22:26:40 UTC (rev 80909)
+++ grok/branches/ulif-i18n/src/grok/i18n.py	2007-10-18 01:19:27 UTC (rev 80910)
@@ -28,22 +28,7 @@
 from martian.error import GrokImportError
 from martian.directive import MultipleTextDirective, ModuleDirectiveContext
 
-DEFAULT_LOCALES_DIR = 'locales'
 
-class localesdirDirective(MultipleTextDirective):
-    def check_arguments(self, directory=DEFAULT_LOCALES_DIR):
-        if directory is None:
-            raise GrokImportError(u"You must specify a locales directory "
-                                  u"when using grok.localesdir()"
-                                  )
-
-    def value_factory(self, *args, **kw):
-        if len(args) == 0:
-            # The default dir. Should we really provide it?
-            return DEFAULT_LOCALES_DIR
-        return args
-
-
 def registerTranslationsDirectory(directory):
     """A replacement for the ZCML registerTranslations directive.
 
@@ -81,5 +66,5 @@
     return
 
 
-localesdir = localesdirDirective('grok.localesdir',
+localesdir = MultipleTextDirective('grok.localesdir',
                                  ModuleDirectiveContext())



More information about the Checkins mailing list