[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Epydoc

From: Karsten Hilbert
Subject: Re: [Gnumed-devel] Epydoc
Date: Sun, 20 Jun 2004 19:34:39 +0200
User-agent: Mutt/

> > I have had to commit some changes as epydoc is more strict than Python 
> > itself (?)
> Checking them out currently.
EpyDoc is both right and wrong: It seems to not like that
there is on definition for _() in them files. Which is true by
standard logic. However, the docs for gettext() say that
installing gettext via the class interface puts a definition
for _() into the *global* namespace. Which it does. Which is
why those imported files with an "undefined" _() still work IF
imported by something that already imported gmI18N before
them. However, if run standalone they break down (which is
what EpyDoc doesn't like). Most of them won't meaningfully be
run standalone except for self tests. The fix to this is to add

if __name__== '__main__':
    _ = lambda x:x

to them. However, some of some do make sense to be run
standalone. The proper fix (which was missing in some cases)
is to

if __name__== '__main__':
    from Gnumed.pycommon import gmI18N

Still, EpyDoc won't like that as it can't know about _() being
defined globally elsewhere (since it could be
translate_this(), too). So, to fool EpyDoc into compliance we
need to do this on those files:

if __name__== '__main__':
    _ = lambda x:x  # fool epydoc
    from Gnumed.pycommon import gmI18N

And I am not entirely sure if that'll work because the _()
defined here may take precedence over the one defined in
gmI18N due to it being in the local module namespace. Will

GPG key ID E4071346 @
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

reply via email to

[Prev in Thread] Current Thread [Next in Thread]