Edgewall Software
Modify

Opened 11 years ago

Closed 11 years ago

Last modified 19 months ago

#11494 closed enhancement (fixed)

Remove deprecated functions and methods from 0.10 and earlier

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
  • addEvent, addHeadingLinks, enableControl and getAncestorByTagName from trac.js

Removed functions and methods that were deprecated and scheduled for removal in Trac 1.0 or earlier:

  • Removed macros.html and macros.rss, which have been deprecated since Trac 0.12.
  • Removed accessor for default_ attributes in TicketModule. The options were moved to TicketSystem in Trac 0.12.
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.

Attachments (0)

Change History (21)

comment:1 by Ryan J Ollos, 11 years ago

Reporter: changed from anonymous to Ryan J Ollos

comment:2 by Jun Omae, 11 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, 11 years ago

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

comment:4 by Ryan J Ollos, 11 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, 11 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, 11 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)

comment:11 by Ryan J Ollos, 10 years ago

#11539 was opened to address some more complex issues in trac.wiki.formatter, but it looks like trunk/trac/wiki/formatter.py@12820:419-422#L410 could be removed immediately.

Since env.abs_href.base is set here, can the following change be made now?

  • trac/wiki/formatter.py

    diff --git a/trac/wiki/formatter.py b/trac/wiki/formatter.py
    index fe7de40..dc031d7 100644
    a b class Formatter(object):  
    422422    LINK_SCHEME = WikiParser.LINK_SCHEME
    423423
    424424    def __init__(self, env, context):
    425         """Note: `req` is still temporarily used."""
    426425        self.env = env
    427426        self.context = context.child()
    428427        self.context.set_hints(disable_warnings=True)
    429         self.req = context.req
     428        self.req = context.req  # Deprecated and will be removed in 1.3.1
    430429        self.href = context.href
    431430        self.resource = context.resource
    432431        self.perm = context.perm
    class Formatter(object):  
    740739            return self._make_ext_link(url, label, title)
    741740
    742741    def _make_ext_link(self, url, text, title=''):
    743         local_url = self.env.project_url or \
    744                     (self.req or self.env).abs_href.base
     742        local_url = self.env.project_url or self.env.abs_href.base
    745743        if not url.startswith(local_url):
    746744            return tag.a(tag.span(u'\u200b', class_="icon"), text,
    747745                         class_="ext-link", href=url, title=title or None)

I haven't looked closely at the consequences of the change, but I plan to do so.

Last edited 10 years ago by Ryan J Ollos (previous) (diff)

comment:12 by Ryan J Ollos, 10 years ago

In [12855], removed an attribute that was schedule for removal, and also scheduled two attributes for removal.

in reply to:  11 comment:13 by Ryan J Ollos, 10 years ago

Replying to rjollos:

#11539 was opened to address some more complex issues in trac.wiki.formatter, but it looks like trunk/trac/wiki/formatter.py@12785:419-422#L410 could be removed immediately.

Removed in [12861].

Since env.abs_href.base is set here, can the following change be made now?

I made the change in a separate changeset in case it needs to be rolled back, but it appears to be okay per the testing I've done: [12862]. For reference, the code was implemented in [4734/trunk/trac/wiki/formatter.py].

It looks like the following JavaScript code can be removed (see [4003]): browser:/trunk/trac/htdocs/js/trac.js@12459:170-183#L167, so I went ahead and removed it in [12863].

comment:14 by Ryan J Ollos, 10 years ago

API Changes: modified (diff)

comment:15 by Ryan J Ollos, 10 years ago

comment:10:ticket:6374 suggests that trunk/trac/templates/macros.html@12661 and trunk/trac/templates/macros.rss@12661 were intended to be removed in Trac 1.0. They were deprecated in Trac 0.12. I propose to remove them on the trunk for Trac 1.2.

comment:16 by Ryan J Ollos, 10 years ago

API Changes: modified (diff)

Removed macros.html and macros.rss in [12889].

comment:17 by Ryan J Ollos, 10 years ago

trunk/trac/ticket/web_ui.py@12826:116-128#L113 was scheduled for removal in Trac 1.0, so I propose to remove it in this ticket.

comment:18 by Ryan J Ollos, 10 years ago

API Changes: modified (diff)

Change from comment:17 committed in [12962].

comment:19 by Ryan J Ollos, 10 years ago

API Changes: modified (diff)

comment:20 by Ryan J Ollos, 10 years ago

In [13473]: Removed import that should have been removed in [12606].

in reply to:  18 comment:21 by Ryan J Ollos, 8 years ago

Replying to Ryan J Ollos:

Change from comment:17 committed in [12962].

Additional change in r15847, merged to trunk in r15848.

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 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.