Edgewall Software
Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#11824 closed enhancement (fixed)

Remove //Since// version information from TracIni documentation

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.3
Component: general Version:
Severity: normal Keywords: trac.ini ​documentation
Cc: Branch:
Release Notes:

Removed from documentation the version in which a configuration option was added for versions of Trac < 0.12.

API Changes:

Leading and trailing whitespace is stripped from translatable string (plugin developers should use cleandoc from trac.util.text). Previously only uniform indentation was removed.

Description

Discussed on the mailing list in gmessage:trac-dev:c136Ptgl_WU/FeZNjNkR06YJ, the Since x.y version information will be removed for Trac < 0.12.

Attachments (0)

Change History (14)

comment:1 by Ryan J Ollos, 5 years ago

Release Notes: modified (diff)

Proposed changes in log:rjollos.git:t11824.

comment:2 by Steffen Hoffmann, 5 years ago

Did you miss the ("enabled" added in 0.11), or was it intentional to keep just that one in trac/config.py? Other changes look right. Thanks for taking care to clean this up.

in reply to:  2 ; comment:3 by Ryan J Ollos, 5 years ago

Replying to shoffmann:

Did you miss the ("enabled" added in 0.11), or was it intentional to keep just that one in trac/config.py? Other changes look right. Thanks for taking care to clean this up.

Yeah, I wasn't consistent in changing the API documentation. I was wondering whether the same approach should be taken, removing mentions of Trac < 0.12, or if the Trac 0.11 documentation might still be useful for plugin developers.

We should probably just remove mention of Trac < 0.12 from the API documentation too, but I'll just save all changes to the API documentation for another ticket and take a consistent approach when making the changes.

comment:4 by Ryan J Ollos, 5 years ago

Committed to trunk in [13304].

I was using the PEP-0008 docstring conventions, putting the trailing """ on a separate line for multiline strings.

However, cleandoc doesn't strip the trailing whitespace for cases like this: trunk/trac/search/web_ui.py@:50#L39

#: trac/search/web_ui.py:48
msgid ""
"Minimum length of query string allowed when performing a search.\n"
"        "
msgstr ""

I propose a fix for this in log:rjollos.git:t11824.1.

in reply to:  4 ; comment:5 by Christian Boos, 5 years ago

Replying to rjollos:

I propose a fix for this in log:rjollos.git:t11824.1.

Be careful, cleandoc_ is a keyword for message extraction (see setup.cfg), so using it for things like cleandoc_(m) is wrong (not sure if it triggers an error, but it doesn't feel right).

in reply to:  5 comment:6 by Ryan J Ollos, 5 years ago

Replying to cboos:

Be careful, cleandoc_ is a keyword for message extraction (see setup.cfg), so using it for things like cleandoc_(m) is wrong (not sure if it triggers an error, but it doesn't feel right).

Thanks, I guess I was unlucky enough that it didn't blow up! I've reworked the changes in log:rjollos.git:t11824.2.

comment:7 by Ryan J Ollos, 5 years ago

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

Changes from comment:6 committed in [13311]. New extraction in [13312]. I did some testing by modifying po files, however I'm sure I don't have as good of an eye towards potential problems as translators do. Please let me know if you spot any issues.

in reply to:  7 ; comment:8 by Jun Omae, 5 years ago

Replying to rjollos:

Changes from comment:6 committed in [13311]. New extraction in [13312]. I did some testing by modifying po files, however I'm sure I don't have as good of an eye towards potential problems as translators do. Please let me know if you spot any issues.

Why is cleandoc added to trac/util/__init__.py at [13311#file2], for backward compatibility?

  • trac/config.py

    diff --git a/trac/config.py b/trac/config.py
    index 862b0ca..b6fd874 100644
    a b import re  
    2020from genshi.builder import tag
    2121from trac.admin import AdminCommandError, IAdminCommandProvider
    2222from trac.core import *
    23 from trac.util import AtomicFile, as_bool, cleandoc
     23from trac.util import AtomicFile, as_bool
    2424from trac.util.compat import wait_for_file_mtime_change
    2525from trac.util.text import printout, to_unicode, CRLF
    26 from trac.util.translation import _, N_, tag_
     26from trac.util.translation import _, N_, cleandoc, tag_
    2727
    2828__all__ = ['Configuration', 'ConfigSection', 'Option', 'BoolOption',
    2929           'IntOption', 'FloatOption', 'ListOption', 'ChoiceOption',
  • trac/dist.py

    diff --git a/trac/dist.py b/trac/dist.py
    index e65f5de..c3d8c8b 100644
    a b try:  
    7171        `cleandoc_keywords` option: a list of keywords to clean up the
    7272        extracted messages with `cleandoc`.
    7373        """
    74         from trac.util import cleandoc
     74        from trac.util.translation import cleandoc
    7575
    7676        funcname = lineno = message_lineno = None
    7777        kwargs_maps = func_kwargs_map = None
  • trac/util/__init__.py

    diff --git a/trac/util/__init__.py b/trac/util/__init__.py
    index 43eca24..c2f4c46 100644
    a b from trac.util.datefmt import pretty_timedelta, format_datetime, \  
    12131213                              get_date_format_hint, \
    12141214                              get_datetime_format_hint, http_date, \
    12151215                              parse_date
    1216 from trac.util.translation import cleandoc
    12171216
    12181217__no_apidoc__ = 'compat presentation translation'
Last edited 5 years ago by Jun Omae (previous) (diff)

in reply to:  8 comment:9 by Jun Omae, 5 years ago

Replying to jomae:

Why is cleandoc added to trac/util/__init__.py at [13311#file2], for backward compatibility?

Reconsidering,

  • trac.util.text is better location for cleandoc, rather than trac.util
  • Or, put implementation of cleandoc on trac.util and trac.util.translation use from trac.util import cleandoc.

comment:10 by Ryan J Ollos, 5 years ago

I encountered what look like circular import effects when trying to put the cleandoc definition of cleandoc in trac.util or trac.util.text.

When locating in trac.util.text, the following error results:

Python: /home/user/Workspace/t11944/py2.7/bin/python
Traceback (most recent call last):
  File "contrib/make_status.py", line 7, in <module>
    from trac.util.text import print_table, printout
  File "/home/user/Workspace/t11944/teo-rjollos.git/trac/util/__init__.py", line 36, in <module>
    from trac.util.compat import any, md5, sha1, sorted
  File "/home/user/Workspace/t11944/teo-rjollos.git/trac/util/compat.py", line 24, in <module>
    from trac.util.text import cleandoc
  File "/home/user/Workspace/t11944/teo-rjollos.git/trac/util/text.py", line 30, in <module>
    from trac.util.translation import _
  File "/home/user/Workspace/t11944/teo-rjollos.git/trac/util/translation.py", line 22, in <module>
    from trac.util.text import cleandoc
ImportError: cannot import name cleandoc
make: *** [status] Error 1

We can work around that by moving the import of _ in trac.util.text. See log:rjollos.git:t11824.3.

in reply to:  10 comment:11 by Jun Omae, 5 years ago

Replying to rjollos:

I encountered what look like circular import effects when trying to put the cleandoc definition of cleandoc in trac.util or trac.util.text. […] We can work around that by moving the import of _ in trac.util.text. See log:rjollos.git:t11824.3.

Oh, I missed circular references. Your changes look to me. Thanks!

comment:12 by Ryan J Ollos, 5 years ago

Thanks for review. Committed in [13327].

comment:13 by Ryan J Ollos, 5 years ago

API Changes: modified (diff)

in reply to:  3 comment:14 by Ryan J Ollos, 5 years ago

Replying to rjollos:

Replying to shoffmann:

Did you miss the ("enabled" added in 0.11), or was it intentional to keep just that one in trac/config.py? Other changes look right. Thanks for taking care to clean this up.

Yeah, I wasn't consistent in changing the API documentation. I was wondering whether the same approach should be taken, removing mentions of Trac < 0.12, or if the Trac 0.11 documentation might still be useful for plugin developers.

We should probably just remove mention of Trac < 0.12 from the API documentation too, but I'll just save all changes to the API documentation for another ticket and take a consistent approach when making the changes.

TODO for cleaning up API documentation added to TracDev/ApiChanges/1.1.3@12.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.