Thanks!
Moving to 1.6.7 solved the logger issue, and your suggestion works with a 
minor change
    def apply(self):
        absolute_path = 'http://my-site/'
        for node in self.document.traverse(nodes.reference):
            if 'refuri' in node and 
node['refuri'].startswith(absolute_path):
                logger.warning('found absolote path reference at: %r', 
node, location=node) 

Note the 
if 'refuri' in node
addition

Regards
Tzach



On Sunday, February 18, 2018 at 5:15:11 PM UTC+2, Komiya Takeshi wrote:
>
> Hi, 
>
> 1.5.1 is too old. Please upgrade to latest one. 
> If upgrading is difficult, use `print` function instead. 
>
> Thanks, 
> Takeshi KOMIYA 
>
> 2018-02-18 23:51 GMT+09:00 Tzach Livyatan <tz...@scylladb.com 
> <javascript:>>: 
> > Thanks Takeshi KOMIYA 
> > 
> > Using your code sample I get 
> > Exception occurred: 
> >  File "conf.py", line 447, in <module> 
> >    logger = logging.getLogger(__name__) 
> > AttributeError: 'module' object has no attribute 'getLogger' 
> > 
> > 
> > I'm using Running Sphinx v1.5.1, and I have a file 
> > ./lib/python2.7/site-packages/sphinx/util/logging.py on my machine 
> > Any idea? 
> > 
> > Regards 
> > Tzach 
> > 
> > 
> > On Friday, February 16, 2018 at 1:52:48 PM UTC+2, Komiya Takeshi wrote: 
> >> 
> >> Hi, 
> >> 
> >> I think installing custom transform might resolve your situation. 
> >> Please add following code into your conf.py 
> >> 
> >> ``` 
> >> from docutils import nodes 
> >> from docutils.transforms import Transform 
> >> from sphinx.util import logging 
> >> 
> >> logger = logging.getLogger(__name__) 
> >> 
> >> 
> >> class MySiteDetector(Transform): 
> >>     default_priority = 500 
> >> 
> >>     def apply(self): 
> >>         for node in self.document.traverse(nodes.reference): 
> >>             if node['refuri'].startswith('http://my-docs-site.com/'): 
> >>                 logger.warning('found: %r', node, location=node) 
> >> 
> >> 
> >> def setup(app): 
> >>     app.add_transform(MySiteDetector) 
> >> ``` 
> >> 
> >> Please read the documentation of docutils for more details. 
> >> 
> >> 
> >> Thanks, 
> >> Takeshi KOMIYA 
> >> 
> >> 2018-02-12 16:46 GMT+09:00 Tzach Livyatan <tz...@scylladb.com>: 
> >> > Hi 
> >> > I want to generate a warning base on the format of links in my docs. 
> In 
> >> > particular, anytime someone uses an absolute path starting with 
> >> > http://my-docs-site.com/ instead of a releative path. 
> >> > What is the idiomatic way to do that with Sphinx? 
> >> > 
> >> > Thanks 
> >> > Tzach 
> >> > 
> >> > -- 
> >> > You received this message because you are subscribed to the Google 
> >> > Groups 
> >> > "sphinx-users" group. 
> >> > To unsubscribe from this group and stop receiving emails from it, 
> send 
> >> > an 
> >> > email to sphinx-users...@googlegroups.com. 
> >> > To post to this group, send email to sphinx...@googlegroups.com. 
> >> > Visit this group at https://groups.google.com/group/sphinx-users. 
> >> > For more options, visit https://groups.google.com/d/optout. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "sphinx-users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to sphinx-users...@googlegroups.com <javascript:>. 
> > To post to this group, send email to sphinx...@googlegroups.com 
> <javascript:>. 
> > Visit this group at https://groups.google.com/group/sphinx-users. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To post to this group, send email to sphinx-users@googlegroups.com.
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to