TracDev/ApiChanges/0.13
0.13 corresponds to the development version of Trac (a.k.a. trunk)
These notes reflect the current status.
Summary
- Prerequisites
- Detailed List of Developer Visible Changes
- Other Modifications made to the 0.12 API
- New in the 0.13 API
Prerequisites
Python 2.4 support has been dropped. Python versions 2.5, 2.6 and 2.7 are supported.
Modified Dependencies
jQuery (bundled)
The bundled version of jQuery is now 1.5 instead of 1.4.4 in Trac 0.12-stable.
See jQuery 1.5 release notes and API documentation.
(TODO upgrade to latest)
Babel (optional)
The internationalization support (i18) for Trac is depending on Babel.
Q: Should we now make Babel a mandatory dependency, as we have a good stable release?
This would allow us to use the Babel API in more places (e.g. #4636, #2182).
A: (cboos) I think having it optional doesn't prevent us to make further use of it when it's available. We just need to use fallback code when it's not (see #2182).
Clearsilver (dropped)
Support for ClearSilver templates has been dropped. In case your plugin was still using .cs templates, PortingFromClearSilverToGenshi is now mandatory.
Genshi (mandatory)
- Genshi 0.7 changed to accepting unicode instances by default, rather than UTF-8 encoded regular str instances. Trac has been updated to override the default back to UTF-8 but plugins that access Genshi directly might raise an error: UnicodeError: source returned bytes, but no encoding specified.
- Genshi 0.6.x is still supported and will likely be a safer alternative. See #10126 for details.
Detailed List of Developer Visible Changes
Component: database backend (3 matches)
| Ticket | API Changes |
|---|---|
| #6348 | * Added the attribute `db_exc` to `Environment` to access DB-specific exception types. * Added the method `get_exceptions()` to `IDatabaseConnector`. |
| #8575 | `trac.db`: Added a method `update_sequence()` to database connections to allow updating table sequences during schema updates. [10114] |
| #9842 | `IDatabaseConnector.init_db()` now accepts an optional schema string, if not provided it is read from the TracIni. |
Component: general (5 matches) |
|
| Ticket | API Changes |
| #8036 | perm: Made meta-permissions cumulative, so e.g. `TICKET_ADMIN` can be extended by plugins. [10417] |
| #9536 | db API makeover by introducing context managers and a shortcut for query execution; see [[TracDev/DatabaseApi#Trac0.13API]] for details |
| #9777 | Provide `pretty_dateinfo` function which displays relative/absolute datetime in the user preferences and `default_deteinfo_format` option. |
| #9836 | config: Added the `ConfigSection` descriptor to define and document configuration sections. [10341] |
| #10245 | trac.web.chrome: `add_script_data()` now also accepts keyword arguments. `add_jquery_ui()` adds the jQuery UI Javascript library. |
Component: i18n (1 match) |
|
| Ticket | API Changes |
| #10038 | trac.wiki.api: `get_macro_description` return a tuple of gettext domain and macro description. The gettext domain is used to translate the description. |
Component: rendering (1 match) |
|
| Ticket | API Changes |
| #9915 | Registered reStructuredText roles and directives can gain access to the Trac environment and rendering context corresponding to the docutils content being processed. |
Component: roadmap (1 match) |
|
| Ticket | API Changes |
| #2182 | * `trac.util.datefmt`: * `format_{date,time,datetime}`, `parse_date` and `get_{date,datetime}_format_hint` takes optionals locale argument (default to None) [10571] * Added `user_time` helper function for `format_*` and `parse_date` functions [10571] * `trac.web.main`: Added `lc_time` property of `Request` class for selecting the date format [10571] |
Component: ticket system (1 match) |
|
| Ticket | API Changes |
| #9935 | The req parameter to Query.execute() is no longer required. |
Component: version control (1 match) |
|
| Ticket | API Changes |
| #9607 | versioncontrol: added `Changeset.get_tags()` [10077] |
Component: web frontend (2 matches) |
|
| Ticket | API Changes |
| #7768 | trac.web.chrome: `add_script()` and `add_stylesheet()` now also accept absolute URLs [10027] |
| #7774 | chrome: `add_script` takes optional charset argument (defaults to 'utf-8'). [10196] |
Other Modifications made to the 0.12 API
Database API Changes
Environment.get_db_cnx is obsolete
Following the deprecation deprecation made in 0.12, using Environment.get_db_cnx for obtaining a database connection is now considered obsolete and its use is heavily discouraged, as that method will be removed in Trac 0.14.
One should now only use the context managers for retrieving a database Connection in read or write mode.
- a read-only Connection can be used to form queries:
a db instance obtained the above way should only be used for executing SELECT queries
with env.db_query as db: ...
- a writable Connection can be used to modify the database content in a transaction:
a db instance obtained the above way can be used to execute INSERT/UPDATE/DELETE queries; they will be committed when the last such automatic transaction in the control flow completes successfully. See DatabaseApi for the full details.
with env.db_transaction as db: ...
Environment.db_query() and Environment.db_transaction() (0.13)
The @with_transaction(env) / @env.with_transaction() decorators introduced in 0.12 remain available, but they're now deprecated as well, as the with syntax is the one to be used. Those decorators will likely be removed in Trac 0.14 as well.
See #8751 for details and related notes about get_db_cnx deprecation above.
New in the 0.13 API
Be sure to have a look at the new ApiDocs (for latest trunk).
work in progress - coverage is not complete yet


