Edgewall Software

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#11684 closed defect (fixed)

Methods decorated with lazy are not included in ApiDocs — at Version 1

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.2
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:

Exposed the docstring for methods decorated with lazy.

Internal Changes:

Description

The following patch seems to fix the issue:

  • trac/util/__init__.py

    diff --git a/trac/util/__init__.py b/trac/util/__init__.py
    index 13676d5..a31a147 100644
    a b  
    2020from __future__ import with_statement
    2121
    2222import errno
     23import functools
    2324import inspect
    2425from itertools import izip, tee
    2526import locale
    class lazy(object):  
    11091110
    11101111    def __init__(self, fn):
    11111112        self.fn = fn
     1113        functools.update_wrapper(self, fn)
    11121114
    11131115    def __get__(self, instance, owner):
    11141116        if instance is None:

Change History (1)

comment:1 by Ryan J Ollos, 10 years ago

API Changes: modified (diff)
Resolution: fixed
Status: newclosed

Also, previously we'd see:

$ python
Python 2.7.4 (default, Sep 26 2013, 03:20:26) 
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from trac.env import Environment
>>> Environment.href.__doc__
'A lazily-evaluated attribute'
>>> Environment.abs_href.__doc__
'A lazily-evaluated attribute'

Now:

$ python
Python 2.7.4 (default, Sep 26 2013, 03:20:26) 
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from trac.env import Environment
>>> Environment.href.__doc__
'The application root path'
>>> Environment.abs_href.__doc__
'The application URL'

Fixed in [12968], merged to trunk in [12969].

Note: See TracTickets for help on using tickets.