[TurboGears] Re: rough testing doc

2005-11-06 Thread The Impaler

Hi,
I tried adding your code in the test module. First I got an error
saying setup_module() should have an additional argument. I added the
argument. Now I am pass that error but I am getting:

AttributeError: Dummy instance has no attribute 'headerMap'

Makes me woder - does Dummy need to extend something from cherrypy?

Regards, 
Vlad



[TurboGears] Presentation of TG

2005-11-06 Thread william

Since the begining (5 years) I'm following the different presentations
held at the Fosdem (www.fosdem.org).
(For those who don't know this is the major event discussing about Open
Source Software in Belgium)

This is a 2 days (and totally free) event that attract people from all
around the world.

The next session will be in February 2006 and I would like to see a
session on Turbogears.
Several projects have seen their comunity increased after the Fosdem.


Unfortunately, the dates are the same as for the PyCon in USA... It
will not be possible to convince Kevin to be at Fosdem
(already tried).

Thus we have 2 options:
1) someone is ready to make it (skills to talk in public and good
skills of TG)
or
2) I do it my self.

small remark: all speech must be in English.

For the 2), I don't have problems to talk in front of +-400 people in
English (and
I'm playing with CP since 2.0, and I've made ProjectMgt (but it's quite
simple), ...)
but then, I'm looking for 1 or 2 who can help me to make a good
presentation.



William



[TurboGears] byPagename again

2005-11-06 Thread reportlabrobin

I'm just starting with TG and am attempting to follow the tutorial by
hand.
My Page objects seem to lack the byPagename method. I have created the
Frontpage object and get the following when using tg-admin.

eg
C:\Tmp\wiki20tg-admin sql sql
Using database URI sqlite:///C|/tmp/wiki20/wiki20_sqlite
CREATE TABLE page (
id INTEGER PRIMARY KEY,
pagename VARCHAR(30),
data TEXT
);


C:\Tmp\wiki20tg-admin shell
Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]
on win32
Type help, copyright, credits or license for more information.
(InteractiveConsole)
 p=Page(pagename=FooFoo,data='mydata')
 p.byPagename
Traceback (most recent call last):
  File console, line 1, in ?
AttributeError: 'Page' object has no attribute 'byPagename'
 ^Z

I get an equivalent error when trying to access the Front page



[TurboGears] template performance question

2005-11-06 Thread Jonathan Mark

Hello from a TurboGears newbie.  It's cool!

I have a question about performance of template processing
I tried an informal speed comparison of Kid vs. Cheetah in my
TurboGears test app.
Using Cheetah, I found that the total time spent in request handling is
7 times faster than using the equivalent Kid template (0.40 seconds vs.
3.06 seconds).

Is this expected?  Are there any tricks to get Kid to go faster?
I think the design of Kid is nice and elegant but it looks like
performance would be an overriding factor for me.

My test application runs under mod_python.  Each request fetches 350
rows from SQLite and produces an HTML table with 3 data fields
displayed per row.

(If the answer is OK so use Cheetah then, I'll have another question
about how Cheetah can be interfaced with CherryPy, given that I want to
send the response incrementally to the web client.  Cheetah has a
callback model (using the trans parameter to respond()) while CherryPy
expects the page handler to return an object (cherrypy.response.body)
over which CherryPy can iterate.  It is not obvious to me how these
models can be plugged together.)

Thanks for any comments or advice,

Jonathan



[TurboGears] Re: template performance question

2005-11-06 Thread [EMAIL PROTECTED]

Haven't tried Cheetah but Kid does take a bit of time when I tried to
ask it to generate a table of similar size.

Jonathan Mark wrote:
 Hello from a TurboGears newbie.  It's cool!

 I have a question about performance of template processing
 I tried an informal speed comparison of Kid vs. Cheetah in my
 TurboGears test app.
 Using Cheetah, I found that the total time spent in request handling is
 7 times faster than using the equivalent Kid template (0.40 seconds vs.
 3.06 seconds).

 Is this expected?  Are there any tricks to get Kid to go faster?
 I think the design of Kid is nice and elegant but it looks like
 performance would be an overriding factor for me.

 My test application runs under mod_python.  Each request fetches 350
 rows from SQLite and produces an HTML table with 3 data fields
 displayed per row.

 (If the answer is OK so use Cheetah then, I'll have another question
 about how Cheetah can be interfaced with CherryPy, given that I want to
 send the response incrementally to the web client.  Cheetah has a
 callback model (using the trans parameter to respond()) while CherryPy
 expects the page handler to return an object (cherrypy.response.body)
 over which CherryPy can iterate.  It is not obvious to me how these
 models can be plugged together.)
 
 Thanks for any comments or advice,
 
 Jonathan



[TurboGears] Re: byPagename again

2005-11-06 Thread Robin Becker
On 11/6/05, william [EMAIL PROTECTED] wrote:
..With what I see, or you must ask p.pagename,or you must add alternateID=True in your model for the fieldpagename.Only fields having alternateID will respond to the methode
byfieldname (byPagename in your case).Remark the syntax:pagename=StringCol(alternateID=True) -- byPagenameOK that works; I must have miscopied the model.


[TurboGears] how to add a function to std ?

2005-11-06 Thread william

following the documentation
(http://www.turbogears.org/docs/gettingstarted.html#predefined), we see
how to add a variable.

My question is:
How to add a new functions (with input parameters) into std ?


Let's take an example:
I would just have a simple function that will return a text if the
condition is true:
something like:
def conditionaltext(cond,text):
if cond: return text
else: return None

The objectif is to have template with tables like:
table
tr py:for=i,data for enumerate(datalist)
py:attrs=class=std.conditionaltext(i%2,'odd')
 td.../td
/tr
/table



Thanks

William

---
http://www.opensource4you.com



[TurboGears] Re: how to add a function to std ?

2005-11-06 Thread Tim Lesher
On 11/6/05, william [EMAIL PROTECTED] wrote:
following the documentation(http://www.turbogears.org/docs/gettingstarted.html#predefined), we seehow to add a variable.My question is:
How to add a new functions (with input parameters) into std ?
Since functions are first-class objects in Python, there's no difference.

def conditionaltext(cond,text):
if cond: return text
else: return None

def add_conditionaltext(variables):
 variables['conditionaltext'] = conditionaltext

view.variableProviders.append(add_conditionaltext)
-- Tim Lesher [EMAIL PROTECTED]


[TurboGears] Identity: delete cookie on browser close

2005-11-06 Thread [EMAIL PROTECTED]

Hi,

I'm just playing with the identity part of TurboGears and found that I
don't know how to set the identity cookie to last only until the
browser is closed.

Reading some code I found identity.session.timeout, but setting this to
0 just invalidates the login cookie inmediately.

Have I missed some obvious way to do this?



[TurboGears] Re: template performance question

2005-11-06 Thread Jeff Grimmett
On 11/6/05, Jonathan Mark [EMAIL PROTECTED] wrote:
Is this expected?Are there any tricks to get Kid to go faster?I think the design of Kid is nice and elegant but it looks likeperformance would be an overriding factor for me.One thing I've noticed is that if I am in 'development' status I see a lot of templates being recompiled on access. I don't know if this is true of a 'production' environment or not, but if Cheetah makes no distinction maybe this has something to do with it. Or it might be a dead end.  
-- Things fall apart. The Center cannot hold.- Life as a QA geek, in a nutshell.Best,Jeff 


[TurboGears] Re: Advice on mixing transactions and exceptions

2005-11-06 Thread DaveS


 More proper would be:

 hub.begin()
 try:
 do stuff
 except:
 hub.rollback()
 raise
 else:
 hub.commit()


 Though of course in the else: block you could commit or rollback based
 on some flag, if you didn't want to automatically commit.

 --
 Ian Bicking  |  [EMAIL PROTECTED]  |  http://blog.ianbicking.org

That looks like nice and simple - I like it.
No one seems to be including hub.end() in their examples.  I wondered
if this step is optional or if bad things would happen if I skiped it.

-- 
DS



[TurboGears] Re: how to add a function to std ?

2005-11-06 Thread william

Works nicely. 

Thanks Tim.



[TurboGears] Re: Choice of video capture software and medium.

2005-11-06 Thread Matthew Bevan

 Have you tried VLC by any chance? It may not work with the codec that
 I've used for this incarnation of the video. I'm not sure, but VLC
 plays an awful lot of files.

VLC in their features list does not mention QuickTime, so I will assume
it uses the same technology that mplayer does - that is, it utilizes
emulation of Windows codecs under foreign systems.  Again, that isn't
going to cut it for my loverly 64-bit system.

Experimenting with mplayer-bin under Gentoo it seems to work, but
suffers from interesting problems due to linking against odd library
versions.  (For example, mine is unable to deal with spaces in names,
no matter how quoted or escaped I make it. ;)



[TurboGears] Re: Identity: delete cookie on browser close

2005-11-06 Thread Sean Cazzell

No, you haven't missed anything - it isn't possible right now without
changes to the identity code.  The good news is the identity code is
still under heavy development and this sort of thing will be easy to do
in the near future (by 1.0 for sure).

For now, you could delete this line in
identity.filter.send_identity_cookie:

cookies[self.provider.identity_cookie]['expires']= timeout


Sean Cazzell

On Sun, 2005-11-06 at 08:05 -0800, [EMAIL PROTECTED] wrote:
 Hi,
 
 I'm just playing with the identity part of TurboGears and found that I
 don't know how to set the identity cookie to last only until the
 browser is closed.
 
 Reading some code I found identity.session.timeout, but setting this to
 0 just invalidates the login cookie inmediately.
 
 Have I missed some obvious way to do this?
 



[TurboGears] unicode parameters

2005-11-06 Thread jak137

Hi,
Is it possible to configure TurboGears so that my controller functions
get its parameters as unicode strings. Right now controlers return a
dictionary with unicode values and after Kid I got properly utf-8
encoded HTML. But the input from forms on the page is returned as uft-8
encoded strings that I have to manualy decode. This is rather not
consistent. Do I miss some obvious way to do this?



[TurboGears] Re: Identity: delete cookie on browser close

2005-11-06 Thread Jeff Watkins


This raises an interesting point: I think the Identity framework  
should have separate time-out values for the cookie and the identity  
session. I think the cookie should default to not having a time out,  
hence it will be deleted when the browser quits. The identity session  
will still have a 20 minute lifetime.


There are a number of other little tweaks I want to add to the  
Identity framework's:


* Ability to specify the host and path for the cookie
* Ability to tie a session cookie to the visitor's IP address
* Adding the current identity to the variable provider for template  
access


I got distracted with other work this weekend, but I'd like to get  
these features included in the next few days.


On 6 Nov, 2005, at 4:39 pm, Sean Cazzell wrote:



No, you haven't missed anything - it isn't possible right now without
changes to the identity code.  The good news is the identity code is
still under heavy development and this sort of thing will be easy  
to do

in the near future (by 1.0 for sure).

For now, you could delete this line in
identity.filter.send_identity_cookie:

cookies[self.provider.identity_cookie]['expires']= timeout


Sean Cazzell

On Sun, 2005-11-06 at 08:05 -0800, [EMAIL PROTECTED] wrote:

Hi,

I'm just playing with the identity part of TurboGears and found  
that I

don't know how to set the identity cookie to last only until the
browser is closed.

Reading some code I found identity.session.timeout, but setting  
this to

0 just invalidates the login cookie inmediately.

Have I missed some obvious way to do this?





--
Jeff Watkins
http://newburyportion.com/

Not everything that can be counted counts, and not everything that  
counts can be counted.

-- Albert Einstein




[TurboGears] Re: TurboGears Books

2005-11-06 Thread Tim Lesher
On 11/4/05, Mark Ramm [EMAIL PROTECTED] wrote:
 I think that's more pessimistic than necessary; publishers won't necessarily beat down the door, but the first step would be a pitch. I've only flirted in the lightest way with book authoring (or maybe just
 slightly less lightly with writing articles for pay), but the obstactles didn't seem insurmountable.However, an author is required, which probably means someone here.You can't find technical ghostwriters ;)
I agree that the obstacles aren't insurmountable, and I have beenworking on surmounting them!
How far are you along in the process, and what publishers are you considering? 

I put a proposal inquiry in to O'Reilly a while ago, and I'm waiting to
hear back from them. I also have some contacts at Apress and
Que. Maybe we could collaborate, or at least make sure that the
books are complementary.-- Tim Lesher [EMAIL PROTECTED]


[TurboGears] Re: TurboGears Books

2005-11-06 Thread Mark Ramm

  How far are you along in the process, and what publishers are you
 considering?

Well, we are in simalar places, I will send you my phone number off
list, and you can call me tomorow and we can se what we can do.

--Mark


[TurboGears] Re: unicode parameters

2005-11-06 Thread Sean Cazzell

I don't believe you need to enable the EncodingFilter as TG should
encode the output for you.  And rather than using _cpFilterList in your
class, try putting 

decodingFilter.on = True

in your dev.cfg file. Hopefully this works!


Sean Cazzell

On Sun, 2005-11-06 at 14:39 -0800, jak137 wrote:
 Thank you for links.  DecodingFilter from CherryPy would probably solve
 the problem, but I do not use CherryPy directly. My class inherits from
 turbogears.controllers.Root and when I try to add to it filters in the
 way it is done in http://www.cherrypy.org/wiki/UnicodeAware:
 
 from turbogears import controllers
 class Root(controllers.Root):
 _cpFilterList = [DecodingFilter('utf-8'), EncodingFilter('utf-8')]
 
 an exception is a result:
 
 Traceback (most recent call last):
   File pren1-start.py, line 20, in ?
 from pren1.controllers import Root
   File /home/jak/pren1/pren1/controllers.py, line 15, in ?
 class Root(controllers.Root):
   File /home/jak/pren1/pren1/controllers.py, line 17, in Root
 _cpFilterList = [DecodingFilter('utf-8'), EncodingFilter('utf-8')]
 TypeError: default __new__ takes no parameters
 
 So, is it possible to enable decoding in TurboGears without modifying
 the module's source code?
 



[TurboGears] Re: Identity: delete cookie on browser close

2005-11-06 Thread Benoit Masson


By the way:
http://metrocat.org/nerd/ is down I posted a discussion post about  
how to logout a user ? What is the method to remove let the user  
click the logout for removing the user session

Benoit
Le 6 nov. 05 à 23:29, Jeff Watkins a écrit :



This raises an interesting point: I think the Identity framework  
should have separate time-out values for the cookie and the  
identity session. I think the cookie should default to not having a  
time out, hence it will be deleted when the browser quits. The  
identity session will still have a 20 minute lifetime.


There are a number of other little tweaks I want to add to the  
Identity framework's:


* Ability to specify the host and path for the cookie
* Ability to tie a session cookie to the visitor's IP address
* Adding the current identity to the variable provider for template  
access


I got distracted with other work this weekend, but I'd like to get  
these features included in the next few days.


On 6 Nov, 2005, at 4:39 pm, Sean Cazzell wrote:



No, you haven't missed anything - it isn't possible right now without
changes to the identity code.  The good news is the identity code is
still under heavy development and this sort of thing will be easy  
to do

in the near future (by 1.0 for sure).

For now, you could delete this line in
identity.filter.send_identity_cookie:

cookies[self.provider.identity_cookie]['expires']= timeout


Sean Cazzell

On Sun, 2005-11-06 at 08:05 -0800, [EMAIL PROTECTED] wrote:

Hi,

I'm just playing with the identity part of TurboGears and found  
that I

don't know how to set the identity cookie to last only until the
browser is closed.

Reading some code I found identity.session.timeout, but setting  
this to

0 just invalidates the login cookie inmediately.

Have I missed some obvious way to do this?





--
Jeff Watkins
http://newburyportion.com/

Not everything that can be counted counts, and not everything that  
counts can be counted.

-- Albert Einstein






[TurboGears] Re: unicode parameters

2005-11-06 Thread jak137

That has indeed worked. Thanks!

(this line must go to the [global] section rather than be appended at
the end of the file)



[TurboGears] Re: Identity: delete cookie on browser close

2005-11-06 Thread Sean Cazzell

Jeff,

I think I see where you are going with the separate timeouts - that way
the login expires when the browser is closed or the session times out. 

What do you think about resetting the session timeout on each request?
That way the timeout really becomes an idle timeout.  This is how banks
handle sessions and it seems to strike the right balance between
security and convenience.

Can we also add a checkbox to the login form along the lines of
remember my login and then adjust the timeout accordingly?

I would like to be able to set things up so logins expire after ~10
minutes of idle time (or when the browser is closed) if remember login
isn't checked, and expire after some really long period if it is.


Sean Cazzell

On Sun, 2005-11-06 at 17:29 -0500, Jeff Watkins wrote:
 This raises an interesting point: I think the Identity framework  
 should have separate time-out values for the cookie and the identity  
 session. I think the cookie should default to not having a time out,  
 hence it will be deleted when the browser quits. The identity session  
 will still have a 20 minute lifetime.
 
 There are a number of other little tweaks I want to add to the  
 Identity framework's:
 
 * Ability to specify the host and path for the cookie
 * Ability to tie a session cookie to the visitor's IP address
 * Adding the current identity to the variable provider for template  
 access
 
 I got distracted with other work this weekend, but I'd like to get  
 these features included in the next few days.
 
 On 6 Nov, 2005, at 4:39 pm, Sean Cazzell wrote:
 
 
  No, you haven't missed anything - it isn't possible right now without
  changes to the identity code.  The good news is the identity code is
  still under heavy development and this sort of thing will be easy  
  to do
  in the near future (by 1.0 for sure).
 
  For now, you could delete this line in
  identity.filter.send_identity_cookie:
 
  cookies[self.provider.identity_cookie]['expires']= timeout
 
 
  Sean Cazzell
 
  On Sun, 2005-11-06 at 08:05 -0800, [EMAIL PROTECTED] wrote:
  Hi,
 
  I'm just playing with the identity part of TurboGears and found  
  that I
  don't know how to set the identity cookie to last only until the
  browser is closed.
 
  Reading some code I found identity.session.timeout, but setting  
  this to
  0 just invalidates the login cookie inmediately.
 
  Have I missed some obvious way to do this?
 
 
 
 --
 Jeff Watkins
 http://newburyportion.com/
 
 Not everything that can be counted counts, and not everything that  
 counts can be counted.
 -- Albert Einstein
 
 



[TurboGears] Getting Started in Docs page

2005-11-06 Thread Mark Mc Mahon

Hi,

It was such a long time since I have read any of the docs for
TurboGears that I decided to touch on it in my insomniac hours.

Under TurboGears Resources there is a link Getting Started, which in
fact does not link to the getting started Doc but links further down
the same page (where you can find the link to the Getting Started
doc).

I know this is minor but I think that it is a little confusing to
click on this first link and not go to the Getting Started doc (maybe
only because I know it is there somewhere).

Should this first link be called something like Where to Start or
First Steps with TurboGears or something like that to avoid
confusion?

Anyway no big deal :-)
Thanks
 Mark


[TurboGears] Re: Choice of video capture software and medium.

2005-11-06 Thread Kevin Dangoor

On 11/6/05, Matthew Bevan [EMAIL PROTECTED] wrote:

  Have you tried VLC by any chance? It may not work with the codec that
  I've used for this incarnation of the video. I'm not sure, but VLC
  plays an awful lot of files.

 VLC in their features list does not mention QuickTime, so I will assume
 it uses the same technology that mplayer does - that is, it utilizes
 emulation of Windows codecs under foreign systems.  Again, that isn't
 going to cut it for my loverly 64-bit system.

Actually, VLC does support QuickTime (the MOV container format).

 Experimenting with mplayer-bin under Gentoo it seems to work, but
 suffers from interesting problems due to linking against odd library
 versions.  (For example, mine is unable to deal with spaces in names,
 no matter how quoted or escaped I make it. ;)



I just tried the 20 Minute Wiki with VLC, and it doesn't work. I'm not
surprised that the Apple Animation codec is not supported. However,
if I do future screencasts in QuickTime format with DivX encoding for
the video and AAC for the audio, all should be well. Anywhere VLC
runs, the video should run.

Kevin
--
Kevin Dangoor
Author of the Zesty News RSS newsreader

email: [EMAIL PROTECTED]
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com


[TurboGears] Possible Quick Fix For The 20 Min Wiki Tutorial

2005-11-06 Thread FooManChu

Just starting to get into TurboGears, and so far I am really enjoying
it.

Initially I could not complete the last AJAX section as adding
tg_format=json to my pagelist page did nothing. I ended up tracking
down the problem (I think I'm still new to this) to the dev.cfg
file:
# Allow every exposed function to be called as json,
# tg.allow_json = False

Changing this to
tg.allow_json = True

allowed me to spit out JSON output as described in the tutorial. Not
sure if this is the correct way to solve the problem. Perhaps add a
line in the tutorial to check the config file for this setting? Or if
there is something else that has to be done add that (unless I'm blind
and missed it).



[TurboGears] Re: Choice of video capture software and medium.

2005-11-06 Thread Ian Bicking

Kevin Dangoor wrote:
 On 11/6/05, Matthew Bevan [EMAIL PROTECTED] wrote:
 
Have you tried VLC by any chance? It may not work with the codec that
I've used for this incarnation of the video. I'm not sure, but VLC
plays an awful lot of files.

VLC in their features list does not mention QuickTime, so I will assume
it uses the same technology that mplayer does - that is, it utilizes
emulation of Windows codecs under foreign systems.  Again, that isn't
going to cut it for my loverly 64-bit system.
 
 
 Actually, VLC does support QuickTime (the MOV container format).

It's all about the codecs you have installed.  But I also get really
finicky results using mplayer, vlc, and xine -- each of them plays
things the others won't at times.  I think I played the TG screencast in
xine with win32codecs installed.

-- 
Ian Bicking  |  [EMAIL PROTECTED]  |  http://blog.ianbicking.org


[TurboGears] Unable to open database file

2005-11-06 Thread icylamb

  I am following the 20mins tutorial and I have been going through all
the installation steps for Window. When I came to the step to run
'tg-admin sql create', I have manually edited the dev.cfg file to make
it run in the development mode as well as pointing to the database

sqlobject.dburi=sqlite:///C|Turbo Gears/installation
files/Wiki/wikidata.db

However, I've got this error at this line in its traceback:
 .
 self._conn = sqlite.connect(self.filename, **opts)
 pysqlite2.dbapi2.OperationalError: unable to open database file

I don't understand why it's unable to open the wikidata.db? Do I need
to create this file first before pointing to it or it will
automatically create this file for me after I run tg-admin sql create?

  Please help. Thanks