| Trees | Indices | Help |
|
|---|
|
|
object --+
|
core.Component --+
|
object --+ |
| |
core.ComponentManager --+
|
Environment
Trac environment manager.
Trac stores project information in a Trac environment. It consists of a directory structure containing among other things:
| Nested Classes | |
|
Inherited from |
| Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|||
| Static Methods | |
|
Inherited from |
| Class Variables | |
abs_href = <trac.util.lazy object at 0x7f41cce585d0>
|
|
anonymous_session_lifetime = <IntOption [trac] "anonymous_sess
|
|
base_url = <Option [trac] "base_url">
|
|
base_url_for_redirect = <BoolOption [trac] "use_base_url_for_r
|
|
conf_dir = <trac.util.lazy object at 0x7f41cce58450>
|
|
database_initial_version = <trac.util.lazy object at 0x7f41cce
|
|
database_version = <trac.util.lazy object at 0x7f41cce58410>
|
|
db_exc = <trac.util.lazy object at 0x7f41cce58350>
|
|
href = <trac.util.lazy object at 0x7f41cce58590>
|
|
htdocs_dir = <trac.util.lazy object at 0x7f41cce58490>
|
|
log_dir = <trac.util.lazy object at 0x7f41cce584d0>
|
|
log_file = <Option [logging] "log_file">
|
|
log_format = <Option [logging] "log_format">
|
|
log_level = <Option [logging] "log_level">
|
|
log_type = <Option [logging] "log_type">
|
|
plugins_dir = <trac.util.lazy object at 0x7f41cce58510>
|
|
project_admin = <Option [project] "admin">
|
|
project_admin_trac_url = <Option [project] "admin_trac_url">
|
|
project_description = <Option [project] "descr">
|
|
project_footer = <Option [project] "footer">
|
|
project_icon = <Option [project] "icon">
|
|
project_name = <Option [project] "name">
|
|
project_url = <Option [project] "url">
|
|
required = True
|
|
secure_cookies = <BoolOption [trac] "secure_cookies">
|
|
shared_plugins_dir = <PathOption [inherit] "plugins_dir">
|
|
templates_dir = <trac.util.lazy object at 0x7f41cce58550>
|
|
| Properties | |
|
db_query Return a context manager ( ~trac.db.api.QueryContextManager) which can be used to
obtain a read-only database connection.
|
|
|
db_transaction Return a context manager ( ~trac.db.api.TransactionContextManager) which can be used
to obtain a writable database connection.
|
|
|
env Property returning the Environment object, which is often required for functions and methods that take a Component instance. |
|
|
setup_participants List of components that implement ~trac.env.IEnvironmentSetupParticipant
|
|
|
system_info_providers List of components that implement ~trac.env.ISystemInfoProvider
|
|
|
Inherited from |
|
| Method Details |
|
|
Initialize additional member variables for components. Every component activated through the Environment object gets three member variables: env (the environment object), config (the environment configuration) and log (a logger object).
|
This section is used to enable or disable components
provided by plugins, as well as by Trac itself. The component
to enable/disable is specified via the name of the
option. Whether its enabled is determined by the option value;
setting the value to The option name is either the fully qualified name of the components or the module/package prefix of the component. The former enables/disables a specific component, while the latter enables/disables any component in the specified package/module. Consider the following configuration snippet: {{{ [components] trac.ticket.report.ReportModule = disabled webadmin.* = enabled }}} The first option tells Trac to disable the
[wiki:TracReports report module].
The second option instructs Trac to enable all components in
the To view the list of active components, go to the ''Plugins''
page on ''About Trac'' (requires See also: TracPlugins |
Create the basic directory structure of the environment, initialize the database and populate the configuration file with default values. If options contains ('inherit', 'file'), default values will not be loaded; they are expected to be provided by that file or other options. |
|
Return a database connection from the connection pool
:deprecated: Use :meth:`db_transaction` or :meth:`db_query` instead.
Removed in Trac 1.1.2.
`db_transaction` for obtaining the `db` database connection
which can be used for performing any query
(SELECT/INSERT/UPDATE/DELETE)::
with env.db_transaction as db:
...
Note that within the block, you don't need to (and shouldn't)
call ``commit()`` yourself, the context manager will take care
of it (if it's the outermost such context manager on the
stack).
`db_query` for obtaining a `db` database connection which can
be used for performing SELECT queries only::
with env.db_query as db:
...
|
Generator that yields information about all known users, i.e. users that have logged in to this Trac environment and possibly set their name and email. This function generates one tuple for every user, of the form (username, name, email) ordered alpha-numerically by username.
|
Return a database connection for read purposes.
See `trac.db.api.get_read_db` for detailed documentation.
:deprecated: Use :meth:`db_query` instead.
Will be removed in Trac 1.3.1.
|
Return the version control repository with the given name,
or the default repository if The standard way of retrieving repositories is to use the methods of RepositoryManager. This method is retained here for backward compatibility.
|
Return the current version of the database. If the
optional argument In practice, for database created before 0.11, this will
return Since: 0.11 |
Implemented to only allow activation of components that are not disabled in the configuration. This is called by the ComponentManager base class when a
component is about to be activated. If this method returns
|
|
Deprecated: Use the query and transaction context managers instead. Will be removed in Trac 1.3.1. |
| Class Variable Details |
anonymous_session_lifetime
|
base_url_for_redirect
|
database_initial_version
|
| Property Details |
db_queryReturn a context manager
( Example:
with env.db_query as db:
cursor = db.cursor()
cursor.execute("SELECT ...")
for row in cursor.fetchall():
...
Note that a connection retrieved this way can be "called" directly in order to execute a query:
with env.db_query as db:
for row in db("SELECT ..."):
...
If you don't need to manipulate the connection itself, this can even be simplified to:
for row in env.db_query("SELECT ..."):
...
Warning:
after a |
db_transactionReturn a context manager
( Example:
with env.db_transaction as db:
cursor = db.cursor()
cursor.execute("UPDATE ...")
Upon successful exit of the context, the context manager will
commit the transaction. In case of nested contexts, only the
outermost context performs a commit. However, should an
exception happen, any context manager will perform a rollback.
You should not call Like for its read-only counterpart, you can directly execute a DML query on the db:
with env.db_transaction as db:
db("UPDATE ...")
If you don't need to manipulate the connection itself, this can also be simplified to:
env.db_transaction("UPDATE ...")
Warning:
after a |
envProperty returning the Environment object, which is often required for functions and methods that take a Component instance.
|
setup_participantsList of components that implement~trac.env.IEnvironmentSetupParticipant
|
system_info_providersList of components that implement~trac.env.ISystemInfoProvider
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Wed Jul 5 01:52:00 2023 | http://epydoc.sourceforge.net |