Edgewall Software

MacroBazaar: ListTracProjects.py

File ListTracProjects.py, 350 bytes (added by robert@…, 6 years ago)

Small Macro to list all Trac projects (for easy switching)

Line 
1"""List All Trac Projects."""
2
3import os
4
5def execute(hdf, txt, env):
6
7        DIR = '/home/dev/trac'
8        str = ''
9        i = 0
10
11        for f in os.listdir(DIR):
12                if (i==0):
13                        str = '<a href="/projects/' + f + '" target="_new">' + f + '</a>'
14                        i = i + 1
15                else:
16                        str = str + ' :: ' + '<a href="/projects/' + f + '" target="_new">' + f + '</a>'
17
18        return str + '<br>';