Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1038561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:59:26+00:00 2026-05-16T14:59:26+00:00

Is it possible to do something like using the trac module in Python in

  • 0

Is it possible to do something like using the trac module in Python in order to get a listing of all of the projects in a given directory? If possible it would be nice to get things like the description, too. I can’t seem to figure out how to do it.

Thanks for any help you can provide.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:59:26+00:00Added an answer on May 16, 2026 at 2:59 pm

    You can script something like this:

    import trac.admin.console
    import trac.config
    import os
    
    def _get_project_options(envdir):
        confpath = os.path.join(envdir, 'conf/trac.ini')
        config = trac.config.Configuration(confpath)
        return dict([x for x in config.options(u'project')])
    
    def _get_project_name(envdir):
        admin = trac.admin.console.TracAdmin(envdir)
        if admin.env_check():
            options = _get_project_options(envdir)
            return options[u'name']
        else:
            return None
    
    def iter_trac_projects_from_dir(dirname):
        for which in os.listdir(dirname):
            if not which in ('.', '..') and os.path.isdir(dirname):
                envdirname = os.path.join(dirname, which)
                project_name = _get_project_name(envdirname)
                if project_name:
                    yield (project_name, envdirname)
    
    def get_trac_projects_from_dir(dirname):
        return [pr for pr in iter_trac_projects_from_dir(dirname)]
    

    Then you can use either iter_trac_projects_from_dir or get_trac_projects_from_dir whichever you think is best for you.

    Alternatively you could use the function get_enviroments from module trac.web.main but only as alternative to os.listdir — you would still have to check whether or not each alleged env is really a trac environment. See why:

    >>> import trac.web.main
    >>> env = {'trac.env_parent_dir': 
    ...        '/home/manu/tmp'}
    >>> trac.web.main.get_environments(env)
    {'test': '/home/manu/tmp/test', 'no-a-real-trac-project': '/home/manu/tmp/no-a-real-trac-project', 'test2': '/home/manu/tmp/test2'}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to accomplish something like this using linqtosql? select * from table
Hoping that using something like this demo it is possible to drag items within
I'm using propel master-dev with symfony 2.1. Is possible to write something like that
With using plain C preprocessor macros, is it possible to create something like: INIT_BASE(0x100)
I want to create something like a leaflet/magazine using Latex. Is it possible to
Is it possible to attach a file using mailto: redirect in javascript? Something like
Is it possible to set for(AssociatedControlID) attribute using jQuery? I am trying something like
I'm wondering if the following may be possible using something like jQuery. I've looked
Possible Duplicate: PHP global in functions Using something like this worries me: <? global
Is it possible to to something like this using Spring.NET IoC container? MyClass instance

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.