Unfortunately I have no expirience in screencasting, and my English is
buggy.

Debugging/logging tool is very useful thing for web development. I
really like this one in Symfony framework (it is included to Symfony
and made with JavaScript, screenshot -
http://www.symfony-project.org/blog/2008/08/27/new-in-symfony-1-2-customize-the-web-debug-toolbar).
For Django there is third-party module Django Debug Toolbar (http://
rob.cogit8.org/blog/2008/Sep/19/introducing-django-debug-toolbar/).

I think the most valuable things that this type of tools can show for
developer are: accessible report to server-side logs pre request, info
about queries executed during request and maybe some cache stats and
variables list.

Firebug (http://getfirebug.com/) is the most popular Firefox extension
for web developent, very handy and well-built. It implements
JavaScript console, DOM traversing, JS-debugging and lot more. FirePHP
(http://www.firephp.org/) is another extension that uses Firebug
interface and resources and therefore requires Firebug for work. You
can see demo here (Firefox with both extensions required, open and
enable Firebug console to see output) - 
http://www.firephp.org/Examples/PHPArchitect/.
In two words, FirePHP allows you to output log messages that you
passed from PHP code, displays executed db queries, stack trace of
exceptions, etc. It requires of using PHP class FirePHPCore/
FirePHP.class.php. Firepy (documentation and screenshot -
http://code.google.com/p/firepy/wiki/Documentation) is the
implementation for Python of the server-side FirePHP library, but it
uses the same Firefox extension (FirePHP). And it includes Middleware
for using with Django, but you can easily adopt it for any Python
framework.

How-to for using FirePHP with web2py:
1) Open Firefox, install Firebug, FirePHP addons:
https://addons.mozilla.org/ru/firefox/addon/1843,
https://addons.mozilla.org/en-US/firefox/addon/6149. Restart browser.
2) Download http://www.box.net/shared/dtm0dhgze9 and extract 'firepy'
folder.
3) Open directory with your current web2py application, and copy
'firepy' folder into 'modules' directory of application.
4) Edit first file in 'models' folder in your application (via web- or
desktop-editor). Place these lines in top of the file:

import sys
sys.path += ['applications/%s/modules' % request.application]
from firepy.web2py import start_firepy
start_firepy(globals())

5) Edit some controller file and add this line to some controller
function: logging.debug([1, {"asdf":(123, 2, "3")}, "3"])
6) Click on bug icon on bottom status line of Firefox. This will bring
up panel. Check the checkbox "Console" and click "Apply settings".
Ensure that tab "Console" is showing.
7) Navigate from browser to this application/controller/function. And
now you should see your logging output in console ([1, {"asdf":(123,
2, "3")}, "3"]). If controller executes some db queries, then console
will contain some info about them (sample screenshot
http://firepy.googlecode.com/files/firepy.png). This is very
interesting to know raw SQL-queries (especially for eduction, and for
finding redundant or duplicating queries).

Notice: Logs shows only if you are autorized in admin application.
This check prevents from showing debugging logs for non-
administrators.

One disadvantage of this way is that it requires Firefox. But if you
open your site in other browsers no errors will occur (logging info
passes via HTTP headers). One possible way to support other browsers
is to use Firebug Lite (pure JS implementation of extension) for them
(http://getfirebug.com/lite.html) and modify or extend its code for
adding FirePHP functionality.

BTW, web2py is great, I really was charmed with it. It is most pytonic
web framework and more flexible than most of them (I think it beats
Django as well). Such debugging possibility will be a nice addition
for it.


On 3 июн, 08:10, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I am new to this. I can tell this is very usefull but I do not know
> how to make it work.
>
> Any chance you can make a short video showing it (perhaps using Jing)?
>
> Do you feel it should be included in web2py? How?
>
> Massimo
>
> On Jun 2, 9:04 am, sgtpep <danil.m...@gmail.com> wrote:
>
>
>
> > Source files were updated in archive. Some issues were fixed. And also
> > logs shows in console now if you are authorized in admin application.
> > I forgot to mention what features of frepy are ready for working with
> > web2py:
> > - server-side logging using logging module
> > - db query logging (!) with timing and multiple databases support
> > Custom exception handler are not working yet because web2py owerrides
> > it with own one.
>
> > On 2 июн, 10:02, sgtpep <danil.m...@gmail.com> wrote:
>
> > > Hi, web2pyers!
> > > Everyone knows Firebug, the perfect webdeveloper tool. There is also
> > > FirePHP addon for using Firebug facilities for server side debugging/
> > > logging. And recently I found firepy (http://code.google.com/p/
> > > firepy/). It makes available to use FirePHP with Django.
> > > I have added a bit of code to firepy source for making possible to use
> > > it with web2py.
> > > Here it is (sorry, I have no time to commit it to firepy or web2py
> > > distribution, mayby later):http://www.box.net/shared/dtm0dhgze9
>
> > > For using place firepy folder to modules directory of your application
> > > and add these lines of code at the begining of your models code:
> > > import sys
> > > sys.path += ['applications/%s/modules' % request.application]
> > > from firepy.web2py import start_firepy
> > > start_firepy(globals())
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to