[Trac] How to find TRAC source code structure?

2010-08-27 Thread Luie Xia
Hi All,

I would like to understand the TRAC source code. But I found it is very 
difficult to understand source code structure. For instance, I could not find 
the main.py code. Does anyone can guide me how to find the main file, and read 
all source codes from there?

Thanks,
Luie



  

-- 
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-us...@googlegroups.com.
To unsubscribe from this group, send email to 
trac-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.



Re: [Trac] How to find TRAC source code structure?

2010-08-27 Thread Matthew Caron

On 08/27/2010 12:45 PM, Luie Xia wrote:

Hi All,

I would like to understand the TRAC source code. But I found it is very
difficult to understand source code structure. For instance, I could not
find the main.py code.  Does anyone can guide me how to find the main
file,


(ma...@e2-06l) ~/workspace/code/trac (master)$ find . -name main.py
./trac/web/main.py
./trac/versioncontrol/web_ui/main.py

I'd expect that trac/web/main.py is the one you seek.


and read all source codes from there?


In the main.py file, I see the following import directives related to trac:

from trac import __version__ as TRAC_VERSION
from trac.config import ExtensionOption, Option, OrderedExtensionsOption
from trac.core import *
from trac.env import open_environment
from trac.perm import PermissionCache, PermissionError, PermissionSystem
from trac.resource import ResourceNotFound
from trac.util import get_lines_from_file, get_last_traceback, 
hex_entropy, \

  arity
from trac.util.compat import partial, reversed
from trac.util.datefmt import format_datetime, http_date, localtz, timezone
from trac.util.text import exception_to_unicode, shorten_line, to_unicode
from trac.util.translation import _
from trac.web.api import *
from trac.web.chrome import Chrome
from trac.web.clearsilver import HDFWrapper
from trac.web.href import Href
from trac.web.session import Session

So, for example, trac.config.py is in trac/config.py.
--
Matthew Caron
Build Engineer
Sixnet | www.sixnet.com
O +1 518 877 5173 Ext. 138
F +1 518 602 9209
matt.ca...@sixnet.com

--
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-us...@googlegroups.com.
To unsubscribe from this group, send email to 
trac-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.



RE: [Trac] How to find TRAC source code structure?

2010-08-27 Thread Lu, Steven (Steven)
Matthew,

I read this file and imported files. But I only see class and function define. 
Not seeing any place called functions. Don't know how the code works.

Thanks,
Steven

From: trac-users@googlegroups.com [trac-us...@googlegroups.com] On Behalf Of 
Matthew Caron [matt.ca...@sixnet.com]
Sent: Friday, August 27, 2010 11:56 AM
To: trac-users@googlegroups.com
Cc: Luie Xia
Subject: Re: [Trac] How to find TRAC source code structure?

On 08/27/2010 12:45 PM, Luie Xia wrote:
 Hi All,

 I would like to understand the TRAC source code. But I found it is very
 difficult to understand source code structure. For instance, I could not
 find the main.py code.  Does anyone can guide me how to find the main
 file,

(ma...@e2-06l) ~/workspace/code/trac (master)$ find . -name main.py
./trac/web/main.py
./trac/versioncontrol/web_ui/main.py

I'd expect that trac/web/main.py is the one you seek.

 and read all source codes from there?

In the main.py file, I see the following import directives related to trac:

from trac import __version__ as TRAC_VERSION
from trac.config import ExtensionOption, Option, OrderedExtensionsOption
from trac.core import *
from trac.env import open_environment
from trac.perm import PermissionCache, PermissionError, PermissionSystem
from trac.resource import ResourceNotFound
from trac.util import get_lines_from_file, get_last_traceback,
hex_entropy, \
   arity
from trac.util.compat import partial, reversed
from trac.util.datefmt import format_datetime, http_date, localtz, timezone
from trac.util.text import exception_to_unicode, shorten_line, to_unicode
from trac.util.translation import _
from trac.web.api import *
from trac.web.chrome import Chrome
from trac.web.clearsilver import HDFWrapper
from trac.web.href import Href
from trac.web.session import Session

So, for example, trac.config.py is in trac/config.py.
--
Matthew Caron
Build Engineer
Sixnet | www.sixnet.com
O +1 518 877 5173 Ext. 138
F +1 518 602 9209
matt.ca...@sixnet.com

--
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-us...@googlegroups.com.
To unsubscribe from this group, send email to 
trac-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-us...@googlegroups.com.
To unsubscribe from this group, send email to 
trac-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.



Re: [Trac] How to find TRAC source code structure?

2010-08-27 Thread Olemis Lang
On Fri, Aug 27, 2010 at 1:06 PM, Lu, Steven (Steven)
steven.y...@alcatel-lucent.com wrote:
 Matthew,

 I read this file and imported files. But I only see class and function 
 define. Not seeing any place called functions. Don't know how the code works.


What is it exactly that you wanna know ?

-- 
Regards,

Olemis.

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

Featured article:

-- 
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-us...@googlegroups.com.
To unsubscribe from this group, send email to 
trac-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.



RE: [Trac] How to find TRAC source code structure?

2010-08-27 Thread Lu, Steven (Steven)
Olemis,

I would like to understand the source code flow, and possibly hack the code a 
bit when needed in my machine. I am new to Python. 

Thanks,
Steven

From: trac-users@googlegroups.com [trac-us...@googlegroups.com] On Behalf Of 
Olemis Lang [ole...@gmail.com]
Sent: Friday, August 27, 2010 12:13 PM
To: trac-users@googlegroups.com
Subject: Re: [Trac] How to find TRAC source code structure?

On Fri, Aug 27, 2010 at 1:06 PM, Lu, Steven (Steven)
steven.y...@alcatel-lucent.com wrote:
 Matthew,

 I read this file and imported files. But I only see class and function 
 define. Not seeing any place called functions. Don't know how the code works.


What is it exactly that you wanna know ?

--
Regards,

Olemis.

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

Featured article:

--
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-us...@googlegroups.com.
To unsubscribe from this group, send email to 
trac-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-us...@googlegroups.com.
To unsubscribe from this group, send email to 
trac-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.



Re: [Trac] How to find TRAC source code structure?

2010-08-27 Thread Olemis Lang
On Fri, Aug 27, 2010 at 2:07 PM, Lu, Steven (Steven)
steven.y...@alcatel-lucent.com wrote:
 Olemis,


:o)

 I would like to understand the source code flow, and possibly hack the code a 
 bit when needed in my machine.

My recommendation is to learn about how to write plugins . That's the
way you should start subverting the system . If you really wanna learn
Trac internals beware of the fact that there are a lot of things in
there beyond mere web (e.g. Version Control API, MIME subsystem,
Workflow web , templates, filters , ...) . I've been developing Trac
plugins since some years ago and I still don't know how everything
works , I just have a barely minimal understanding of the things I
care about ... Besides plugins add a whole new bunch of functionality
that eventually may be merged with Trac or you might want to try out .

That's why I'd suggest you to start trying to do something concrete
and research how to do it ... eventually you'll learn

;o)

BTW , everything starts with trac.web.main.RequestDispatcher.dispatch
(take a look at the deploy scripts `trac-admin /path/to/env deploy`
;o)

 I am new to Python.

Ok, ask specific questions about something you want to do and somebody
will answer . ;o)

-- 
Regards,

Olemis.

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

Featured article:

-- 
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-us...@googlegroups.com.
To unsubscribe from this group, send email to 
trac-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.



Re: [Trac] How to find TRAC source code structure?

2010-08-27 Thread Olemis Lang
On Fri, Aug 27, 2010 at 2:22 PM, Olemis Lang ole...@gmail.com wrote:
 On Fri, Aug 27, 2010 at 2:07 PM, Lu, Steven (Steven)
 steven.y...@alcatel-lucent.com wrote:
 Olemis,


 :o)

[...]
 I would like to understand the source code flow, and possibly hack the code 
 a bit when needed in my machine.

 BTW , everything starts with trac.web.main.RequestDispatcher.dispatch
 (take a look at the deploy scripts `trac-admin /path/to/env deploy`
 ;o)


Ha! Another important class is trac.web.api.Request. When I started,
it was tricky because of its lazy instantiation mechanism (e.g.
Request.callbacks) for instance , Request.chrome is not defined
anywhere in the source code. Inside
trac.web.main.RequestDispatcher.dispatch you'll be able to see that it
is really «bound» to trac.web.chrome.Chrome.prepare_chrome_data , and
so on ...

-- 
Regards,

Olemis.

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

Featured article:

-- 
You received this message because you are subscribed to the Google Groups Trac 
Users group.
To post to this group, send email to trac-us...@googlegroups.com.
To unsubscribe from this group, send email to 
trac-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.