Edgewall Software

Opened 10 years ago

Closed 10 years ago

Last modified 13 months ago

#11494 closed enhancement (fixed)

Remove deprecated functions and methods from 0.10 and earlier — at Version 10

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

Removed old-style macro examples in sample-plugins directory.

API Changes:

Removed functions and methods that have been deprecated since Trac 0.11 or earlier.

  • trac.mimeview.api:Mimeview.get_max_preview_size
  • trac.mimeview.api:Mimeview.to_utf8
  • trac.perm:PermissionCache.permissions
  • trac.ticket.ReportModule.execute_report
  • trac.util:pairwise
  • trac.versioncontrol.diff:hdf_diff
  • trac.web.chrome:add_javascript
  • trac.wiki.api:IWikiMacroProvider.render_macro
  • trac.wiki.web_ui:InvalidWikiPage
Internal Changes:

Description

It was suggested in comment:1:ticket:11490 that some deprecated code in trac.web.chrome and trac.mimeview.api might be removed. It seems best to remove all deprecated code at the same time, so the scope of this ticket may extend beyond those two module. The code to be removed will have been deprecated in Trac 0.10.x or earlier, and the trac-hacks repository will be searched for any plugins that might still be utilizing the code.

Change History (10)

comment:1 by Ryan J Ollos, 10 years ago

Reporter: changed from anonymous to Ryan J Ollos

comment:2 by Jun Omae, 10 years ago

Okay to me for deleting deprecated trac.web.chrome:add_javascript, trac.mimeview.api:Mimeview.get_max_preview_size and trac.mimeview.api:Mimeview.to_utf8 methods from trunk.

comment:3 by Ryan J Ollos, 10 years ago

Milestone: 1.1.31.1.2
Owner: set to Ryan J Ollos
Status: newassigned

comment:4 by Ryan J Ollos, 10 years ago

The proposed changes remove a few more functions that have been deprecated since 0.11:

$ grep -ri "deprecated" . --exclude=*.pyc --exclude-dir=.svn --exclude-dir=locale --exclude-dir=default-pages --exclude-dir=tests
./ChangeLog: * Deprecated SQLite 2.x support (#8625).
./trac/ticket/model.py:        :since 1.0: the `cnum` parameter is deprecated, and threading should
./trac/ticket/model.py:        :since 1.0.2: the `retarget_to` parameter is deprecated and tickets
./trac/ticket/roadmap.py:           deprecated `countsToProg` argument was removed, use
./trac/ticket/query.py:    ''deprecated in favor of the `rows` parameter''
./trac/ticket/query.py:    but is deprecated.
./trac/db/api.py:    :deprecated: This decorator is in turn deprecated in favor of
./trac/mimeview/api.py:        """:deprecated: since 1.0, use `web_context` instead."""
./trac/mimeview/api.py:    :deprecated: since 1.0, use `RenderingContext` instead. `Context` is
./trac/env.py:        :deprecated: Use :meth:`db_transaction` or :meth:`db_query` instead
./trac/env.py:        """Decorator for transaction functions :deprecated:"""
./trac/env.py:        """Return a database connection for read purposes :deprecated:
./trac/perm.py:        """Deprecated (but still used by the HDF compatibility layer)"""
./trac/perm.py:        self.env.log.warning("perm.permissions() is deprecated and "
./trac/util/__init__.py:    .. deprecated :: 0.11
./trac/wiki/formatter.py:    """deprecated in favor of format_to_html (will be removed in 1.0)"""
./trac/wiki/formatter.py:    """:deprecated: in favor of format_to_oneliner (will be removed in 1.0)"""
./trac/wiki/formatter.py:    """:deprecated: will be removed in 1.0 and replaced by something else"""
./trac/wiki/api.py:        """Return the HTML output of the macro :deprecated:"""
./trac/wiki/macros.py:     * `nolink` means without link to image source (deprecated, use `link=`)
./trac/wiki/web_ui.py:    :deprecated: Not used anymore since 0.11
./trac/htdocs/css/jquery-ui/jquery-ui.css:/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
./trac/htdocs/js/suggest.js:/* Warning: this module is deprecated and will be removed in Trac 1.1.x
./trac/versioncontrol/api.py:        This option is deprecated, and repositories should be defined in the

One of the changes has been deferred to #11539. The other proposed changes can be found in log:rjollos.git:t11494.

comment:5 by Ryan J Ollos, 10 years ago

API Changes: modified (diff)
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to trunk in [12605:12606].

comment:6 by Ryan J Ollos, 10 years ago

I was seeing some errors when building the API docs.

$ make apidoc
Running Sphinx v1.1.3
loading pickled environment... done
building [html]: targets for 1 source files that are out of date
updating environment: 0 added, 2 changed, 0 removed
Traceback (most recent call last):_versioncontrol_diff                          
  File "/usr/lib/python2.7/dist-packages/sphinx/ext/autodoc.py", line 326, in import_object
    obj = self.get_attr(obj, part)
  File "/usr/lib/python2.7/dist-packages/sphinx/ext/autodoc.py", line 232, in get_attr
    return safe_getattr(obj, name, *defargs)
  File "/usr/lib/python2.7/dist-packages/sphinx/util/inspect.py", line 70, in safe_getattr
    raise AttributeError(name)
AttributeError: hdf_diff
Traceback (most recent call last):_web_chrome                                   
  File "/usr/lib/python2.7/dist-packages/sphinx/ext/autodoc.py", line 326, in import_object
    obj = self.get_attr(obj, part)
  File "/usr/lib/python2.7/dist-packages/sphinx/ext/autodoc.py", line 232, in get_attr
    return safe_getattr(obj, name, *defargs)
  File "/usr/lib/python2.7/dist-packages/sphinx/util/inspect.py", line 70, in safe_getattr
    raise AttributeError(name)
AttributeError: add_javascript

/home/user/Workspace/tracdev/teo-rjollos.git/doc/api/trac_versioncontrol_diff.rst:36: WARNING: autodoc can't import/find function 'trac.versioncontrol.diff.hdf_diff', it reported error: "hdf_diff", please check your spelling and sys.path
/home/user/Workspace/tracdev/teo-rjollos.git/trac/web/chrome.py:docstring of trac.web.chrome.Chrome.wiki_toolbars:1: WARNING: Inline interpreted text or phrase reference start-string without end-string.
/home/user/Workspace/tracdev/teo-rjollos.git/doc/api/trac_web_chrome.rst:42: WARNING: autodoc can't import/find function 'trac.web.chrome.add_javascript', it reported error: "add_javascript", please check your spelling and sys.path
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                  
writing additional files... genindex py-modindex search
copying downloadable files... [ 50%] /home/user/Workspace/tracdev/teo-rjollos.gicopying downloadable files... [100%] /home/user/Workspace/tracdev/teo-rjollos.git/doc/api/../../trac/templates/attach_file_form.html
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 3 warnings.

Fixed in [12631].

comment:7 by Ryan J Ollos, 10 years ago

Here is one more deprecated function: tags/trac-1.0.1/trac/ticket/report.py@:662-670#L661. There are no instances of it being used in plugins on trac-hacks.org that are supported in 0.11 or later.

$ grep -r "\.execute_report" trachacks.git/
trachacks.git/autotracplugin/0.9/autotrac/autotrac/autotrac.py:    # This method was adapted from ReportModule.execute_report()
trachacks.git/tracspanishtranslation/0.10/patchs/trac-spanish-python_utf-8.diff:             cols, rows = self.execute_report(req, db, id, sql, args)
trachacks.git/relationalrolesupportpatch/0.9/myhack.diff:             cols, rows = self.execute_report(req, db, id, sql, args)
trachacks.git/traditionalchinesetranslation/0.10/trunk/0.10.x/trac/ticket/report.py:            cols, rows = self.execute_report(req, db, id, sql, args)
trachacks.git/zoomquiettranslation/trunk/0.10.x/trac/ticket/report.py:            cols, rows = self.execute_report(req, db, id, sql, args)
trachacks.git/zoomquiettranslation/branches/Trac0.10.4zh3/trac/ticket/report.py:            cols, rows = self.execute_report(req, db, id, sql, args)
trachacks.git/zoomquiettranslation/branches/Trac0.10.4zh2/trac/ticket/report.py:            cols, rows = self.execute_report(req, db, id, sql, args)
trachacks.git/zoomquiettranslation/branches/Trac0.10.4zh1/trac/ticket/report.py:            cols, rows = self.execute_report(req, db, id, sql, args)
trachacks.git/zoomquiettranslation/branches/Trac0.10.4zh0/build/lib/trac/ticket/report.py:            cols, rows = self.execute_report(req, db, id, sql, args)
trachacks.git/zoomquiettranslation/branches/Trac0.10.4zh0/trac/ticket/report.py:            cols, rows = self.execute_report(req, db, id, sql, args)
trachacks.git/tracfrenchtranslation/0.10/trac/ticket/report.py:            cols, rows = self.execute_report(req, db, id, sql, args)

Shall I remove it?

comment:8 by Jun Omae, 10 years ago

Yeah, please go ahead ;)

comment:9 by Ryan J Ollos, 10 years ago

Thanks, committed to trunk in [12781].

comment:10 by Ryan J Ollos, 10 years ago

API Changes: modified (diff)
Note: See TracTickets for help on using tickets.