How to programmatically create an Environment?

29 views
Skip to first unread message

Vigneshwaran Raveendran

unread,
Jan 7, 2013, 7:20:29 AM1/7/13
to trac...@googlegroups.com
Hi Trac team,

I have installed Trac and configured it with mod_python. I have my own application that will send a REST call to Trac to create an environment programmatically instead of me using trac-admin everytime.

I looked at the Docs and found that I can write a plugin implementing IRequestHandler and use trac.env.Environment(path, create=True)

But that plugin must already be running in some environment already and I do not want that.

Is there some way I can make a (global) plugin intercept the url request and do my job without needing an environment?

Or is there any other way I can make Trac to create an environment programmatically instead of using trac-admin?

Thank you,
Vigneshwaran

Olemis Lang

unread,
Jan 7, 2013, 11:34:29 AM1/7/13
to trac...@googlegroups.com, Jose Angel Franco Navarro
On 1/7/13, Vigneshwaran Raveendran <vigneshw...@gmail.com> wrote:
> Hi Trac team,
>

:)

> I have installed Trac and configured it with mod_python. I have my own
> application that will send a REST call to Trac to create an environment
> programmatically instead of me using trac-admin everytime.
>

Interesting .

> I looked at the Docs and found that I can write a plugin implementing
> IRequestHandler and use trac.env.Environment(path, create=True)
>

<jfyi>
... or you could also use trachacks:RestOnTracPlugin (once released ;)
to write your own Trac powered REST-ful services
;)
</jfyi>

> But that plugin must already be running in some environment already and I
> do not want that.
>

yes . That's the way Trac works . Request handling is peformed by
environment's IRequestHandler(s) . In its current form the issue
tracker lacks of support for features not related to environments
(e.g. create environment) .

> Is there some way I can make a (global) plugin intercept the url request
> and do my job without needing an environment?
>

You have some options at hand :

- DIY as a stand-alone web app i.e. not a Trac plugin
- Reuse previous solutions offered by some other plugins
(e.g. trachacks:CreateProjectPlugin afaicr )
- Adopt multi-product solutions like Apache™ Bloodhound [1]_
or trachacks:SimpleMultiprojectPlugin . You'd be creating
new (lightweight) products/projects instead of environments , but
they serve to similar purposes , the main difference being
related to DB sharing and isolation .

> Or is there any other way I can make Trac to create an environment
> programmatically instead of using trac-admin?
>

trac.env.open_environment but it seems to me that you should have
figured this out already ... ;)

--
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:

Olemis Lang

unread,
Jan 7, 2013, 11:39:47 AM1/7/13
to trac...@googlegroups.com, Jose Angel Franco Navarro
On 1/7/13, Olemis Lang <ole...@gmail.com> wrote:
> On 1/7/13, Vigneshwaran Raveendran <vigneshw...@gmail.com> wrote:
>
[...]
>
>> Is there some way I can make a (global) plugin intercept the url request
>> and do my job without needing an environment?
>>
>
> You have some options at hand :
>
[...]
> - Adopt multi-product solutions like Apache™ Bloodhound [1]_

oops ! missing link ... o.O

.. [1] Apache™ Bloodhound issue tracker
(https://issues.apache.org/bloodhound/)

[...]

Vigneshwaran Raveendran

unread,
Jan 8, 2013, 6:22:15 AM1/8/13
to trac...@googlegroups.com, Jose Angel Franco Navarro
Hi Olemis,


On Monday, January 7, 2013 10:04:29 PM UTC+5:30, Olemis Lang wrote:
On 1/7/13, Vigneshwaran Raveendran <vigneshw...@gmail.com> wrote:
<jfyi>
... or you could also use trachacks:RestOnTracPlugin (once released ;)
to write your own Trac powered REST-ful services
;)
</jfyi>

That RestOnTrac plugin seems to be an empty repository for 3 years. When are you planning to release it?

Thanks,
Vigneshwaran

Olemis Lang

unread,
Jan 8, 2013, 11:21:53 AM1/8/13
to trac...@googlegroups.com, José Angel Franco Navarro
On 1/8/13, Vigneshwaran Raveendran <vigneshw...@gmail.com> wrote:
> Hi Olemis,
>

:)

> On Monday, January 7, 2013 10:04:29 PM UTC+5:30, Olemis Lang wrote:
>>
>> On 1/7/13, Vigneshwaran Raveendran <vigneshw...@gmail.com <javascript:>>
>> wrote:
>> <jfyi>
>> ... or you could also use trachacks:RestOnTracPlugin (once released ;)
>> to write your own Trac powered REST-ful services
>> ;)
>> </jfyi>
>>
>
> That RestOnTrac plugin seems to be an empty repository for 3 years.

Most of my plugins are empty @ t.h.o because they are hosted elsewhere
considering the fact that I don't use subversion for that purpose .
Hoever , in this particular case its source code is not published
anywhere ... yet .

> When
> are you planning to release it?
>

As part of Apache™ Bloodhound development this is scheduled to be
released in 2013 Q1 . We have a 4 weeks release life cycle so that
means February or March . Something usable might be delivered sooner
than that .

Franco has been added to cc because he will be working to make that
happen immediately after we finish some outstanding tasks e.g. [1]_ ,
but not limited to ...

If you are interested on that plugin we'll be announcing successive
releases via trac-users@... ML .

.. [1] User-defined dashboard contents.
(https://issues.apache.org/bloodhound/ticket/140)
Reply all
Reply to author
Forward
0 new messages