[TurboGears] Re: Unified html generation

2005-11-02 Thread [EMAIL PROTECTED]

I would say, don't take the DRY to extreme. This is a typical case
where you may need to do it in two seperate places. There are the has
js and no js situation one needs to handle.

I end up modify the ajax_tables example which scrapes the layout
generated from Kid then subsequently display the update with JSON. This
way, a js disabled brower still see the content as usual but the js
version just make the experience a bit better. The layout is still done
in Kid though I may add more things to the js side when the dojo kits
have better table/grid.

wavy davy wrote:
 Heya all.

 First post, cracking good framework, am much taken with it. It Does
 Things Right(TM). Props, Kevin et al.

 I have a question of best practice in TurboGears:

 I've got a method (Root.page()), w/kid template (page.kid) that spits
 out a full html document to the browser. I then want to update a
 section of that page using AJAX-funkyness. In my case I want to
 AJAX-update the contents of a table depending on user choices.

 AFAICS, the recomended way of doing this seems to be request a JSON
 data structure, then construct the table out of that in javascript. I
 don't like this because you have two seperate locations where you have
 to specify how to construct the table HTML, i.e. in the kid template
 and in the javascript (bye-bye DRY)

 I would prefer to use kid to do all my HTML generation ('cos its damn
 good at it, and 'cos javascript isn't). I think I want to be able to
 call a method via an AJAX request that returns the kid-generated HTML
 (as opposed to JSON), and swap this directly into the DOM.

 I can think of a few ways of doing this:

 a) specifying a ajax parameter flag on the AJAX call, and using
 tg_template in Root.page() to change the template to generate only be
 the part I want (i.e. the table). This requires an additional template
 with just the table in it, again breaking the DRY concept. You could
 use py:def/py:match to alleviate some repetition, but I don't like the
 idea of an extra one line file.

 b) using the AJAX request to grabbing the whole HTML document and using
 the DOM API to extract just the table part via id, and use that to
 update the live page. This seems a little clumsy and bandwidth
 inefficient, but requires no parameters or extra templates.

 c) have an extra method that returns just the table HTML. You could use
 this in the AJAX request, and you could also use it in the original
 Root.page() method
 and associated template.

 So far, I'm opting for c), but is there a better way to do it? Any
 thoughts?
 
 -- 
 wavy davy



[TurboGears] Re: TurboGears forms first look

2005-11-02 Thread Kevin Dangoor

On 11/1/05, Ian Bicking [EMAIL PROTECTED] wrote:

 Kevin Dangoor wrote:
  You can instantiate a form like this:
  myform = TableForm(widgets=[
  widgets.TextField(name),
  widgets.TextField(address),
  widgets.TextField(age, default=0,
  validator=validators.Int())])

 Isn't that just begging to be...

 class myform(TableForm):
 name = widgets.TextField()
 address = widgets.TextField()
 age = widgets.TextField(default=0, validator=validators.Int())

 ?

I don't think so. In this example, I'm not looking to create something
that creates forms (a class), I'm looking for a form itself (an
instance).

Kevin


[TurboGears] Re: TurboGears forms first look

2005-11-02 Thread Kevin Dangoor

On 11/1/05, Jeff Grimmett [EMAIL PROTECTED] wrote:
 On 11/1/05, Kevin Dangoor [EMAIL PROTECTED] wrote:

  For anyone wondering why I've been somewhat quieter than normal... we had
 guests over the weekend, and...

 You have a life outside of Python code? Where'd you download THAT?  ;-)

I googled for life and ended up buying one on eBay :)


  Today, I checked in the first bit of code for TurboGears' form
  generator. (Aside: if you have any thoughts on naming for the forms
  package, that'd be good. turbogears.forms seems lame.)

 Everything below this is well above my head - I'm really new to web apps -
 but I will comment on this.

 Keep it simple. turbogears.forms is concise, to the point. It tells me
 everything I need to know about what the module will do.

 Not to put too fine a point on it, but consider another fairly popular
 framework that I'll call, uh, knotted for illustrative purposes. Does the
 name  knotted.sandwich.pastrami really tell you a lot about what the
 module does? It may be the heart and soul of tw -- er, knotted's
 authentication system, but it's not too obvious from the name of the module.

OK, that's a fine argument. turbogears.forms it is. I guess I don't
want to get ri.diculo.us with the names anyhow.

I like your example. I think I remember this line in the source for
knotted.sandwich.pastrami:

import pickle

and I just couldn't convince the devs to hold the pickle.

Kevin


[TurboGears] Re: TurboGears forms first look

2005-11-02 Thread Kevin Dangoor

On 11/1/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Basically, something like the FormEncode Schema, with
 appearance/behaviour attributes. I would also like to see it been able
 to init/define from a dictionary, again like Schema.

Can you be more specific about defining from a dictionary? You really
want something ordered for a form to be sure that everything winds up
correctly on the form. (And yes, there are ordered dictionaries, but
i'm trying to figure out what use case is being solved here...)

Kevin


[TurboGears] Re: Unified html generation

2005-11-02 Thread [EMAIL PROTECTED]

I was not referring to standard desktop but for something like
blackberry. Yes, even the layout may need to change for that kind of
device but at least, it functions if there is a no js option.

Jeff Watkins wrote:
 On 2 Nov, 2005, at 5:08 am, [EMAIL PROTECTED] wrote:

  There are the has js and no js situation one needs to handle.

 This is an interesting argument that I see frequently, and being
 something of an Ajaxy nerd, I just don't buy it. The only people who
 *know how* to turn of JavaScript are geeks.

 So if *you* turned it off, you're willing to live back in 1995 and
 probably don't want to use my app anyway.

 On the other hand, if some IT monkey turned off JavaScript for all
 desktops, he's probably locked things down to the point that you
 can't access my app.

 Has anyone actually *seen* statistics on how many people have
 JavaScript turned off?

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

 'I know about people who talk about suffering for the common good.
 It's never bloody them! When you hear a man shouting Forward, brave
 comrades! you'll see he's the one behind the bloody big rock and the
 one wearing the only really arrow-proof helmet!'
 -- Rincewind gives a speech on politics. (Terry Pratchett,
 Interesting Times)



[TurboGears] Re: TurboGears forms first look

2005-11-02 Thread Kevin Dangoor

Since we've all developed forms-based apps in the past, I've been
going more granular than this at this stage. There are things we
*know* we need (this is just a sampling)

* completely customizable appearance (with JavaScript and CSS as needed)
* repeating fields
* validation/repopulation and errors on invalid input
* wizards/multi-page forms

I am certainly working with realistic examples as I'm writing this
code, but I'm not really treading new ground... it's just a different
path in the same area as those who have come before.

And, we're a large enough group now that I'm sure people will speak up
in the places where it falls short. (That's part of the goal of
0.9...)

Kevin

On 11/2/05, Yesh [EMAIL PROTECTED] wrote:

 Example business forms could be.
 RFQ, Quotation, Customer order form, Invoice, Shipping doc, Sales
 return processing form, Purchase order (supplier), Goods recieved
 document (inventory), Supplier invoice (bill), Stock transfer (from to
 inventory locations), AMC (service contract), Service request form,
 Material request form (purchase indent), Expense statement, Credit
 note, Debit note, Journal voucher, Payment voucher, Receipt voucher.

 PS: If this is not the sort of inputs that this topic requires please
 mention.




--
Kevin Dangoor
Author of the Zesty News RSS newsreader

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


[TurboGears] Re: TurboGears forms first look

2005-11-02 Thread Kevin Dangoor

On 11/2/05, Tim Lesher [EMAIL PROTECTED] wrote:
  Widgets

 From what I can tell, TG's widgets sound like more ubiquitous versions
 of Spyce's Active Tags. Is that the case?  What are some of the
 differences?

 Active Tags are the only thing I really miss from Spyce (other than
 errors in .py files not bringing down the server... but more on that
 another time).

Ahh, more prior art to check out. It's been a while since I looked at
Spyce. If memory serves, active tags are kind of like JSP tags. I
should take a closer look though to make sure I'm not missing
something interesting.

  A TableForm displays a label for each field in one column of a table,
  with the field controls in another column of the table. A TableForm
  gives you a submit button for free.

 ...but it doesn't force you to use its submit button, right? Right?

What? You want a different kind of submit button? That's asking a bit
much, isn't it? :)

You can customize the submit button text with a parameter to the form,
and you can also give it a different widget to use for the submit
button.

  Also, since the form knows what the
  submit button was called, it is automatically thrown out. (Someone's
  probably going to say hey! I need that submit button value!...
  widgets are customizable through standard Python means. Subclass and
  override. Piece of cake.)

 Thanks. :-)


  The form will be redisplayed with good values prepopulated and the
  invalid ones thrown out. An error message would be displayed next to
  the age field on the form. And we all heave a sigh of relief that we
  didn't have to do that in validation_error :)

 Not bad so far... what is has_errors (other than something that
 doesn't evaluate to boolean false)? It would be convenient to have it
 be a dict of keys_with_errors:bad_value, and then your 'if' would
 still work.

Right now, it's just a boolean. You can get the keys with errors by
grabbing cherrypy.request.form_errors.keys()

I'm going to guess that most uses of has_errors will just be to punt
to another method.

Kevin


[TurboGears] Re: TurboGears forms first look

2005-11-02 Thread Tim Lesher

On 11/2/05, Kevin Dangoor [EMAIL PROTECTED] wrote:
  ...but it doesn't force you to use its submit button, right? Right?

 What? You want a different kind of submit button? That's asking a bit
 much, isn't it? :)

 You can customize the submit button text with a parameter to the form,
 and you can also give it a different widget to use for the submit
 button.

Right... I meant to type submit button text.

 Right now, it's just a boolean. You can get the keys with errors by
 grabbing cherrypy.request.form_errors.keys()

Hmm... if you can always get the form errors from this attribute,
isn't has_errors redundant? DRY, and all...

--
Tim Lesher [EMAIL PROTECTED]


[TurboGears] Re: TurboGears forms first look

2005-11-02 Thread Kevin Dangoor

On 11/2/05, william [EMAIL PROTECTED] wrote:

 This sounds similar to Quixote Form and widgets.

 Have you look at that ?

Months ago. I just took another look, and you're right there are quite
a few similarities. I think you'll find similarities all over. These
packages are all trying to solve the same problems.

Kevin


[TurboGears] Re: Unified html generation

2005-11-02 Thread [EMAIL PROTECTED]

I was not referring to standard desktop but for something like
blackberry. Yes, even the layout may need to change for that kind of
device but at least, it functions if there is a no js option.

Jeff Watkins wrote:
 On 2 Nov, 2005, at 5:08 am, [EMAIL PROTECTED] wrote:

  There are the has js and no js situation one needs to handle.

 This is an interesting argument that I see frequently, and being
 something of an Ajaxy nerd, I just don't buy it. The only people who
 *know how* to turn of JavaScript are geeks.

 So if *you* turned it off, you're willing to live back in 1995 and
 probably don't want to use my app anyway.

 On the other hand, if some IT monkey turned off JavaScript for all
 desktops, he's probably locked things down to the point that you
 can't access my app.

 Has anyone actually *seen* statistics on how many people have
 JavaScript turned off?

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

 'I know about people who talk about suffering for the common good.
 It's never bloody them! When you hear a man shouting Forward, brave
 comrades! you'll see he's the one behind the bloody big rock and the
 one wearing the only really arrow-proof helmet!'
 -- Rincewind gives a speech on politics. (Terry Pratchett,
 Interesting Times)



[TurboGears] Re: Unified html generation

2005-11-02 Thread Jeff Grimmett
On 11/2/05, Jeff Watkins [EMAIL PROTECTED] wrote:
 There are the has js and no js situation one needs to handle.This is an interesting argument that I see frequently, and beingsomething of an Ajaxy nerd, I just don't buy it. The only people who*know how* to turn of _javascript_ are geeks.
So if *you* turned it off, you're willing to live back in 1995 andprobably don't want to use my app anyway.Let me answer that with one word: Accessability.How does this all parse to web readers for the blind? To get an idea, use Lynx as a browser. You can get a good idea how well your website will fare WRT W3C reccomendations by using Lynx.
I have no data on this, but I suspect that webreaders don't support JS very well, if at all, much like Lynx, as well.I am not saying that accessability issues should rule everything one wants to do - it depends on the audience, of course. But for myself, I am saying that anything that impairs accessability will not be used. If that means I have less blinky goodness on my website, so be it.
I'm not the world's foremost authority on this soft of thing. This guy is pretty close, though: http://diveintoaccessibility.org/Side note: I am not coming down on use of JS as a page builder at all, merely the idea that none of the exceptions are worth your consideration. And there are many ways to address it that do not preclude using AJAX in the main presentation, with alternates available for those that need them. (example: gmail provides an HTML-only interface as an alternative).
-- Things fall apart. The Center cannot hold.- Life as a QA geek, in a nutshell.Best,Jeff 


[TurboGears] Re: Unified html generation

2005-11-02 Thread Kevin Dangoor

On 11/1/05, wavy davy [EMAIL PROTECTED] wrote:
 I would prefer to use kid to do all my HTML generation ('cos its damn
 good at it, and 'cos javascript isn't). I think I want to be able to
 call a method via an AJAX request that returns the kid-generated HTML
 (as opposed to JSON), and swap this directly into the DOM.

Understandable. MochiKit.DOM is very nice, but you wouldn't want to
use it for everything.


 I can think of a few ways of doing this:

 a) specifying a ajax parameter flag on the AJAX call, and using
 tg_template in Root.page() to change the template to generate only be
 the part I want (i.e. the table). This requires an additional template
 with just the table in it, again breaking the DRY concept. You could
 use py:def/py:match to alleviate some repetition, but I don't like the
 idea of an extra one line file.

I haven't experimented with it myself, but Kid has something new in
0.7 (we should have it in TurboGears as well, since we're using Kid
from svn) called layout templates:

http://lesscode.org/projects/kid/ticket/62

This allows you to flip around the template relationship a bit. You
lose the ability to view individual templates in the browser, but if
that's not important to you this may be a good way to go.

Kevin


[TurboGears] Re: Setting different kid forms for validation_error()

2005-11-02 Thread Kevin Dangoor

Hi Steve,

On 11/1/05, Steve Bergman [EMAIL PROTECTED] wrote:

 Kevin Dangoor wrote:

 validation_error is called with the name of the method that had failed
 validation. This allows you to check and then set a different
 tg_template return value.
 
 
 
 Errr, how is that done, exactly?  It does not seem to be as simple as
 setting:

 tg_template=myproject.templates.mytemplate

 or setting turbogears.tg_template to the same.

http://www.turbogears.org/docs/gettingstarted.html#templatechoice

return dict(tg_template=myproject.templates.mytemplate, ...)

If you call another method that uses a different template, that
method's template will be rendered out.

Kevin


[TurboGears] Re: Setting different kid forms for validation_error()

2005-11-02 Thread Kevin Dangoor

On 11/2/05, Kevin Dangoor [EMAIL PROTECTED] wrote:

 http://www.turbogears.org/docs/gettingstarted.html#templatechoice

 return dict(tg_template=myproject.templates.mytemplate, ...)

 If you call another method that uses a different template, that
 method's template will be rendered out.

Which is to say, additionally, if you call another method...

Those are two different ways to get a different template rendered out
from within validation_error.

Kevin


[TurboGears] Re: Lazy updates?

2005-11-02 Thread Kevin Dangoor

On 11/1/05, modmans2ndcoming [EMAIL PROTECTED] wrote:

 I am new to DB dev work, and I was just curious about Lazy updates.

 It seems that a lot of people are concerned about the number to updates
 that are generated using SQLObject.

I'm not sure about *a lot* of people... but there are certainly some.

 Lazy updates allow you to not update the db every time you make a
 change? Why is that important? How often do you change data after you
 update it?

Here's an example:

foo.bar = Hello

results in some SQL like:

UPDATE Foo SET bar = 'Hello' where id=5

That gets sent on to your database server.

Some people are concerned about the amount of traffic to the database
server if you end up not committing those changes.

Kevin


[TurboGears] Re: FormEncode DateConverter?

2005-11-02 Thread Kevin Dangoor

On 11/1/05, Ian Bicking [EMAIL PROTECTED] wrote:

 Steve Bergman wrote:
  AttributeError: 'DateConverter' object has no attribute 'assert_string'
 
 
  Jeff, did you get this figured out?  I'm seeing:
 
  AttributeError: 'PhoneNumber' object has no attribute 'assert_string'

 The assert_string bug was fixed in svn... maybe in a FormEncode release,
 I can't remember.

I'll make sure to update FormEncode for the next release.

Kevin


[TurboGears] Re: Setting different kid forms for validation_error()

2005-11-02 Thread Steve Bergman


Kevin Dangoor wrote:


http://www.turbogears.org/docs/gettingstarted.html#templatechoice

return dict(tg_template=myproject.templates.mytemplate, ...)

If you call another method that uses a different template, that
method's template will be rendered out.
 

Thanks.  I missed that part of the Getting started with TurboGears 
page.  I re-read it this morning and saw that.  Works like a charm.


-Steve




[TurboGears] Re: My first two weeks with TG

2005-11-02 Thread Kevin Dangoor

On 11/1/05, Jeff Grimmett [EMAIL PROTECTED] wrote:
 That's pretty fargin' amazing.

 Kevin and crew are to be commended first of all for getting such a smoothly
 operating package together at this pre-1.0 level, and further commended for
 all the assistance with what are no doubt pretty dumb questions from myself.

 So a big Hee Haw salute to y'all.  (crowd goes sah-LOOT!)

 Just sayin'. This totally rocks.

Thanks, Jeff!

And thanks for sticking it out!

Kevin


[TurboGears] Re: Lazy updates?

2005-11-02 Thread [EMAIL PROTECTED]

More than that. Transaction is one of the big topic on RDBMS. This per
attribute update breaks row level consistency.

Kevin Dangoor wrote:
 Here's an example:

 foo.bar = Hello

 results in some SQL like:

 UPDATE Foo SET bar = 'Hello' where id=5

 That gets sent on to your database server.

 Some people are concerned about the amount of traffic to the database
 server if you end up not committing those changes.
 
 Kevin



[TurboGears] Re: checking permissions

2005-11-02 Thread Kevin Dangoor

On 11/1/05, Benoit Masson [EMAIL PROTECTED] wrote:
 the secured script will fetch identity and read and deliver the img
 content as a file stream...

Note that this isn't hard because of the
cherrypy.lib.cptools.serve_file function:
http://www.turbogears.org/docs/api/cherrypy.lib.cptools-module.html#serveFile

Kevin


[TurboGears] Re: checking permissions

2005-11-02 Thread Kevin Dangoor

On 11/2/05, Kevin Dangoor [EMAIL PROTECTED] wrote:
 On 11/1/05, Benoit Masson [EMAIL PROTECTED] wrote:
  the secured script will fetch identity and read and deliver the img
  content as a file stream...

 Note that this isn't hard because of the
 cherrypy.lib.cptools.serve_file function:
 http://www.turbogears.org/docs/api/cherrypy.lib.cptools-module.html#serveFile

 Kevin



--
Kevin Dangoor
Author of the Zesty News RSS newsreader

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


[TurboGears] Re: Lazy updates?

2005-11-02 Thread Ronald Jaramillo


You can keep and eye on what SQLObject is doing behind your back by  
setting myObject._connection.debug= True, I added support for
monitoring this from within CatWalk, check http:// 
www.checkandshare.com/blog/?p=21 for the details.

Cheers,
Ronald

On Nov 2, 2005, at 4:17 PM, Kevin Dangoor wrote:



On 11/1/05, modmans2ndcoming [EMAIL PROTECTED] wrote:



I am new to DB dev work, and I was just curious about Lazy updates.

It seems that a lot of people are concerned about the number to  
updates

that are generated using SQLObject.



I'm not sure about *a lot* of people... but there are certainly some.



Lazy updates allow you to not update the db every time you make a
change? Why is that important? How often do you change data after you
update it?



Here's an example:

foo.bar = Hello

results in some SQL like:

UPDATE Foo SET bar = 'Hello' where id=5

That gets sent on to your database server.

Some people are concerned about the amount of traffic to the database
server if you end up not committing those changes.

Kevin




Ronald Jaramillo
mail: ronald AT checkandshare DOT com
blog: http://www.checkandshare.com/blog





[TurboGears] Thanks for the wiki updates!

2005-11-02 Thread Kevin Dangoor

A few people have updated the wiki (including cleaning up the front
page!) over the past few days. Thanks a lot for doing this! It's going
to make things a whole lot easier and better when it comes time to
update the docs for TurboGears 0.9.

(By the way, if anyone wants to assist in that effort, let me know and
I'll help you get started...)

Kevin

--
Kevin Dangoor
Author of the Zesty News RSS newsreader

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


[TurboGears] Re: Many-to-Many joins with fields

2005-11-02 Thread Kevin Dangoor

On 11/1/05, Jeff Watkins [EMAIL PROTECTED] wrote:
 I was hoping for a Join type that represented mappings, which seems
 like a *really* common scenario. If it weren't why would Python have
 mapping types?

Hibernate offers a way to do mappings as well.

Ultimately, a decently written patch with tests would likely get accepted.

Kevin


[TurboGears] Re: A beautiful doc on SQLObject

2005-11-02 Thread Kevin Dangoor

On 11/2/05, Rocco [EMAIL PROTECTED] wrote:

 I finded that
 http://www.groovie.org/articles/2005/11/01/how-to-use-database-agnostic-sql-in-sqlobject
 very interesting.

That's a great link and should be a big help for anyone trying to do
more sql-ish things with SQLObject rather than object-y things.
I've added this link to the documentation playground.

Thanks!

Kevin


[TurboGears] Re: Lazy updates?

2005-11-02 Thread Kevin Dangoor

On 11/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 More than that. Transaction is one of the big topic on RDBMS. This per
 attribute update breaks row level consistency.

Not if you're using transactions. Besides, it's easy to update
multiple columns at the same  time if that's what you need to do...
just call instance.set(attr1='foo', attr2='bar')

It's not uncommon to need to update multiple rows (and in different
tables, no less) at the same time, so using transactions is key to
data consistency.

Kevin


[TurboGears] Re: Is there a better way to do a `conditional' then this?

2005-11-02 Thread Kevin Dangoor

On 11/2/05, Jaime Wyant [EMAIL PROTECTED] wrote:

 !--
  I want to `set' the selection based on the character.ascended expression.
 This just seems clunky.
 --
 select py:if=$character.ascended name=ascended
 option  value=True selected=selectedTrue/option
 option value=FalseFalse/option
 /select

 select py:if=not $character.ascended name=ascended
 option  value=TrueTrue/option
 option value=False selected=selectedFalse/option
 /select

Yes, that would be painful to have to do that everywhere... There was
another thread on this recently, which shows that we need to add some
documentation about this.

select name=ascended
option  value=True
py:attrs=selected=std.selector(character.ascended)True/option
option value=False py:attrs=selected=std.selector(not
character.ascendedFalse/option
/select

Kevin


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

2005-11-02 Thread Kevin Dangoor

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

 Howdy!

 I find it pretty great that the 20-minute video and various feature
 show-offs for CatWalk are being done in video.  Realtime
 demonstrations can often have more impact than written descriptions,
 however, I have problems with the choice of medium.

 On my wonderful 64-bit laptop, when I play those quicktime videos I get
 no audio.  On the other hand, I have Macromedia Flash running without a
 problem.  (A feat on 64-bit assisted by a binary version of Firefox).

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.

I am planning to try different codecs to improve compatibility for
Linux users. If I had the money for Sorenson Squeeze, I'd generate
SWFs. Or, if I was using Camtasia on Windows I could likely do it
there as well. Camtasia has other features and is tempting... it's a
pity it's Windows only.

At the moment, I just don't have the time to try and wire up something
like vnc2swf with audio on my Mac.

 With built-in playback features (play, pause, seek bar) and several
 modes of capture (including audio), I wouldn't mind seeing a
 demonstration done using vnc2swf.  Resulting files have the potential
 to be very, very small.

The size, of course, is mostly due to the codec and options chosen.
I've heard good things about H.264, but that requires folks to be
running the latest QuickTime. Sorenson Squeeze is supposed to put
together very good quality, highly compressed swfs. They do have a
Flash-specific version. I might be able to finagle an upgrade from my
old Flash 4 to the latest and then get the Sorenson package for Flash.

It's likely that the next screencast will be QuickTime, but in a more
friendly codec. I'll try to check it with VLC first to make sure that
a broad audience can watch.

Kevin


[TurboGears] setuptools version conflict =(

2005-11-02 Thread Ronald Jaramillo


Hi list,
In my powerbook I got difficulties running the svn version. After  
update I do python setup.py develop, then it complains about  
RuleDispatch,
I runt easy_install -i http://www.turbogears.org/download/index.html  
RuleDispatch, and a traceback greets me with:


File /usr/local/bin/easey_install, line 7, in ?
... 
pkg_resources.VersionConflict:(setuptools 0.6a6 (/Library/Frameworks/ 
Python.framework/Versions/2.4/lib/python2.4/site-packages/ 
setuptols-0.6a6-py2.4.egg), requirements.parse('setuptools==0.6a5'))


I just did this on my desktop without problems.
Suggestions?
Cheers
Ronald


Ronald Jaramillo
mail: ronald AT checkandshare DOT com
blog: http://www.checkandshare.com/blog





[TurboGears] Re: Is there a better way to do a `conditional' then this?

2005-11-02 Thread [EMAIL PROTECTED]

Thanks for the quick response.  Is `std' a module that is automagically
passed to the kid template?

jw



[TurboGears] Re: Thanks for the wiki updates!

2005-11-02 Thread Jeff Grimmett
On 11/2/05, Kevin Dangoor [EMAIL PROTECTED] wrote:
A few people have updated the wiki (including cleaning up the frontpage!) over the past few days. Thanks a lot for doing this! It's goingto make things a whole lot easier and better when it comes time toupdate the docs for TurboGears 
0.9.This is going to sound incredibly lame, but ... where IS the wiki? I've never seen a url for it.-- Things fall apart. The Center cannot hold.- Life as a QA geek, in a nutshell.
Best,Jeff 


[TurboGears] Re: Lazy updates?

2005-11-02 Thread [EMAIL PROTECTED]

I am sorry that I use the wrong word.

By getting around it, I mean instead of(this I believe is quite common
coding style in python):

obj.attribute_a = something
obj.attribute_b = something_else

it has to be done using .set()

It is the right way for multiple attibute update but I don't think it
is a general usage pattern for python coding, thus the getting around
it. Then there is the case where I need some intermediate variables to
hold the result if I cannot have all the attributes at the same time.
Again in python, it would be something like :

obj.attribute_a = something
...some processing...
obj.attribute_b = something_else because of processing

It now needs to be changed to :

_a = something
...some processing
_b = something_else because of processing

obj.set(attribute_a=_a,attribute_b=b)

Now if I have quite a number of fields, the whole coding changed
because of this behaviour. It ends up that I cannot write to obj
unless I am very sure that everything is done.

I think it really depends on how one use SQLObject. If it is used as
DHH of RoR intended, i.e., the RDBMS is really just a backing store of
object, everything should be fine. But it is still viewed and used(and
shared) with other apps as RDBMS tables, this feature needs some time
to get use to, at least know the consequence of each object attribute
assignment.

Ian Bicking wrote:

 I don't think it's just get around it.  .set() works, and I don't
 think it looks bad or anything.  SQLObject doesn't know what your future
 intentions are for the object, it doesn't know if you will set one
 attribute or 20.

 The alternative -- which is more of a if it were so alternative, not a
 very practical alternative at this point -- is explicit saves.  I don't
 think that is any more concise or easy to use than .set(), since in both
 cases you are defining a set of attributes enclosed in the scope of a
 single update.  .set() uses Python keyword syntax to do the enclosing,
 explicit saves use a contract between the ORM and the programmer (the
 you better run save when you're finished! contract).

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



[TurboGears] Re: Many-to-Many joins with fields

2005-11-02 Thread anders pearson
On 2005-11-01 21:43:52 -0500, Jeff Watkins wrote:

 Since we're left to implement it ourselves, I would suggest making an  
 explicit join object:
 
 Person - Call - PhoneNumber

honestly, this sounds like a *better* approach than some kind of mapping
join type. 

in my mind, if a many-to-many relationship has additional fields on it,
it's no longer a relationship and becomes an entity in its own right. 

i would argue that adding a Join type with additional fields to
SQLObject would be a misfeature. SQLObject isn't preventing you from
normalizing your database. 

-- 
anders pearson : http://www.columbia.edu/~anders/
   C C N M T L : http://www.ccnmtl.columbia.edu/
weblog : http://thraxil.org/


pgpa7tjxDkpRl.pgp
Description: PGP signature


[TurboGears] OT: Development olatform opinions (To Mac...?)

2005-11-02 Thread Jared Kuolt

I've noticed that many in this group are using Apple computers. I've
considered considering the switch before, but since I've been watching
all you guys use it, I'm actually starting the real consideration
process.

If that makes sense.

Anywho, my current setup is an AMD-based machine with FreeBSD 6.0 RC1.
While I love FreeBSD, it doesn't currently like my hardware. The
motherboard may be dying, or the drivers were screwed up from 5.4 to
6.0... I don't know. I just don't want to mess with it anymore.

I'm impressed by Macs for all the same reasons as any other UNIX
fanboy, yadda yadda yadda. However, I have a few minor issues that I'd
like someone to help me out with:

1) Price. I can get a mac mini for cheap, but is that powerful enough?
2) Power. How powerful, really? Especially since I'm considering G4s...
3) The iMac is ugly. Don't even suggest it.
4) Is the G5 worth over $2000? If you say it is, you must be willing
to state that this machine will be good for me for over 2 years!
5) Paying for software? That's tough... Is it worth it? Really?

Anyway, that's the basic jist of my plight. Won't you please help? I'm
asking you guys because you all seem so similar to (yet so much
smarter than) me.

Thanks!
Jared Kuolt


[TurboGears] Re: TurboGears forms first look

2005-11-02 Thread Gunfighter

Name suggestion: TurboForms



[TurboGears] Re: Many-to-Many joins with fields

2005-11-02 Thread Jeff Watkins


This is a better solution for this particular example. However a join  
that is represented as a mapping type is hugely valuable.


On 2 Nov, 2005, at 12:22 pm, anders pearson wrote:

honestly, this sounds like a *better* approach than some kind of  
mapping

join type.


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

Computers, they're just a fad.




[TurboGears] Re: TurboGears forms first look

2005-11-02 Thread [EMAIL PROTECTED]


Kevin Dangoor wrote:
 For anyone wondering why I've been somewhat quieter than normal... we
 had guests over the weekend, and...

 There has been a lot of activity around form generation lately, which
 has been very helpful. There are many different ideas floating around

Hi Kevin I posted a demo of how I personally  deal with form validation
and stuff on the CherryPy users list:

http://groups.google.com/group/cherrypy-users/browse_thread/thread/6fcd3ac9786bac6a/

It's a very primitive way of dealing with it but it could be somewhat
automated... I'm just waiting a bit more to analyze my usage patterns
of it. As of now I like it because it doesn't get at all in your way
and resembles ASP.NET validation handling even if it currently plays at
a much lower level than their system does. Also it doesn't pretend to
compete with Bicking's FormEncode... I would never dare, it's just the
way I like ;-)

Lorenzo



[TurboGears] Re: OT: Development olatform opinions (To Mac...?)

2005-11-02 Thread modmans2ndcoming

Wait until after they change the CPUs to Intel if you are a new user.
THe hardware is faster from the reports I am hearing and it is
certainly more future proof, on top of that you can boot any other OS
you like or run them in a VM environment with no emulation.



[TurboGears] Re: Many-to-Many joins with fields

2005-11-02 Thread anders pearson
On 2005-11-02 09:27:11 -0800, [EMAIL PROTECTED] wrote:
 
 I am confused again. How would you design this :
 
 Invoice -- Payment
 
 where each invoice can have multiple payments and each payment can pay
 multiple invoice. Isn't it natural to have a tuple (invoice, payment,
 amount) which is a join and also have attribute that is essential ?

i'm not sure i understand your example. what would the underlying
database tables look like?

what i'm saying is that if you have a table like

  foobar
  
  foo_id
  bar_id

then SQLObject handles that just fine with

  class Foo(SQLObject):
   bars = RelatedJoin('Bar')

  class Bar(SQLObject):
   foos = RelatedJoin('Foo')

but if you want the join table to look like:

  foobar
  --
  foo_id
  bar_id
  some_other_field

you should use something more like:

  class Foo(SQLObject):
  bars = MultipleJoin('FooBar')

  class Bar(SQLObject):
  foos = MultipleJoin('FooBar')

  class FooBar(SQLObject):
  foo = ForeignKey('Foo')
  bar = ForeignKey('Bar')
  some_other_field = StringCol()

-- 
anders pearson : http://www.columbia.edu/~anders/
   C C N M T L : http://www.ccnmtl.columbia.edu/
weblog : http://thraxil.org/


pgpVu7AG04wgY.pgp
Description: PGP signature


[TurboGears] Re: TurboGears forms first look

2005-11-02 Thread Kevin Dangoor

Hi Lorenzo,

On 11/2/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi Kevin I posted a demo of how I personally  deal with form validation
 and stuff on the CherryPy users list:

I saw your message, but I only looked at the code just now...

The ideas there are fairly similar. Your code looks a bit like
FormEncode, but does not do the two-way conversion (to_python,
from_python). Why did you choose to not use FormEncode?

Thanks for the link to your example!

Kevin


[TurboGears] transactions in a forking WSGI server

2005-11-02 Thread Jonathan LaCour


How should I be handling transactions through SQLObject if I am using  
the flup forking WSGI server for deployment and have CherryPy setup  
to not use threads?  I have seen Ian Bicking's previous post  
containing his do_in_transaction routine, but it seems to use  
threading to infer things.


Whats the right thing to do?

  -- Jonathan



[TurboGears] Re: Many-to-Many joins with fields

2005-11-02 Thread [EMAIL PROTECTED]

So I have to maintain the join myself like this ?

foo = Foo.get(1)
bar = Bar.get(1)
foobar = FooBar(foo=foo,bar=bar, some_other_field=x)

And to use it :

for x in foo.bars:
  y = Bars.get(x)

that seems to be fine and given the limitation of Related join, may be
this is more versatile.

anders pearson wrote:
 you should use something more like:

   class Foo(SQLObject):
   bars = MultipleJoin('FooBar')

   class Bar(SQLObject):
   foos = MultipleJoin('FooBar')

   class FooBar(SQLObject):
   foo = ForeignKey('Foo')
   bar = ForeignKey('Bar')
   some_other_field = StringCol()

 --
 anders pearson : http://www.columbia.edu/~anders/
C C N M T L : http://www.ccnmtl.columbia.edu/
 weblog : http://thraxil.org/



[TurboGears] Re: OT: Development olatform opinions (To Mac...?)

2005-11-02 Thread Jared Kuolt

Thanks all for your comments so far! Absolutely brilliant!

 If you could list more of your requirements for what you will be using
 the computer for, people can probably give better responses.

I used to be into PC-gaming but my PSP really took care of that. Now I
just mostly do a lot of software development, most of it with
scripting languages; Not a whole lot of compiling for me.

I do multitask like crazy, so I suppose RAM should be a consideration.

A few more questions if you don't mind:

1) Is the dashboard really that cool?
2) How often do unforseen problems occur (BSOD-esque, not hardware failures)?
3) Are refurbished Macs generally good quality?
4) From what I've seen it looks like the first Intel-based macs are
due to arrive in about 6-8 months. Since I'm in need of a new computer
soon, would it be a good idea to get a mini now and wait for the new
Power Mac to make a decision? Or should I just go with a cheap PC
laptop?
5) Mac Mini or iBook or Powerbook? Is the price justified if I'm not
very mobile?
6) Do the iBooks get really dingy-looking?

Again, thanks! And sorry for the attack on the iMac. Just _not_ my thing!

Jared


[TurboGears] Re: OT: Development olatform opinions (To Mac...?)

2005-11-02 Thread [EMAIL PROTECTED]

What kind of multitasking that would need lots of memory ? My lowly
Xbox can handle my development work just fine as most of the time, I am
typing in vi.

Jared Kuolt wrote:
 Thanks all for your comments so far! Absolutely brilliant!

  If you could list more of your requirements for what you will be using
  the computer for, people can probably give better responses.

 I used to be into PC-gaming but my PSP really took care of that. Now I
 just mostly do a lot of software development, most of it with
 scripting languages; Not a whole lot of compiling for me.

 I do multitask like crazy, so I suppose RAM should be a consideration.

 A few more questions if you don't mind:

 1) Is the dashboard really that cool?
 2) How often do unforseen problems occur (BSOD-esque, not hardware failures)?
 3) Are refurbished Macs generally good quality?
 4) From what I've seen it looks like the first Intel-based macs are
 due to arrive in about 6-8 months. Since I'm in need of a new computer
 soon, would it be a good idea to get a mini now and wait for the new
 Power Mac to make a decision? Or should I just go with a cheap PC
 laptop?
 5) Mac Mini or iBook or Powerbook? Is the price justified if I'm not
 very mobile?
 6) Do the iBooks get really dingy-looking?

 Again, thanks! And sorry for the attack on the iMac. Just _not_ my thing!
 
 Jared



[TurboGears] Re: transactions in a forking WSGI server

2005-11-02 Thread Kevin Dangoor

On 11/2/05, Jonathan LaCour [EMAIL PROTECTED] wrote:

  threadConnection is thread-aware; but if you are running single-
  threaded  it doesn't hurt anything to use it.

 So, it should be safe to use your run_in_transaction routine then?
 I will probably make a decorator out of it, but shouldn't this be
 part of TurboGears?

The hub object that you have in your model.py has begin, commit,
rollback and end methods for working with transactions.

 It seems to me that transactions should be on by default, and
 automatically occur in the transaction-per-request model with
 automatic commit and rollback.  Why isn't this the case already?
 Would it be hard to do?  Would it work in both thread-per-request and
 process-per-request models?  This seems like a basic requirement for
 web frameworks.

There was a discussion about this a few weeks back. You don't
necessarily *always* want to be in a transaction, because when you
switch to a transaction you lose your cache. (Though it sounds like
the cache was an issue in your multiprocess environment anyhow).

Enabling a transaction-per-request model should be doable and would be
desirable. There's even a ticket on this:
http://trac.turbogears.org/turbogears/ticket/80

  OTOH, caching with multiple processes and SQLObject can get a
  little hairy.  I can't give a quick answer about that, because I've
  been putting off thinking through the implications for some time :(

 Agreed.  I have caching disabled right now, and I am seeing some odd
 behavior where things don't seem to stick quite properly.
 Specifically, I update a model object, and the interface will
 randomly reflect the change, or not, as I refresh.

 I think its either an issue with how I am handling transactions
 (which is why I asked in the first place), or an issue with SQLObject
 still caching even though I tell it not to (all I did was set ?
 cache=0 at the end of my sqlobject.dburi property in my
 configuration files).

When you start using an SQLObject Transaction, you have a cache
specific to that transaction (if memory serves). So, if you're always
in a new transaction, you should always have a cache just for that
request. that'd be the theory, at least.

Kevin


[TurboGears] Re: Identity Bug Fixed

2005-11-02 Thread Benoit Masson
HO YES !!! thanks you you saved my night I'm agains't a wall since yesterday !!! I thaught I'll became crazy every thing seems so simple in the tutorial and yet nothing work for me !! Thanks for this bug resolution !!!Le 2 nov. 05 à 14:27, Jeff Watkins a écrit :For all of you who've pulled the Identity code out recently, I just fixed with the help of Eli Yukelzon, a small bug which had terrible consequences: you could never log in.This was caused by trying to filter out all the fields on the login form before passing the request on to the destination controller. Well, if you didn't have a named submit button (with either the default name, login, or whatever you set in the config file), I was getting a KeyError and bailing.It's fixed now. I'm not sure how it slipped past my tests (which aren't automated yet), but I apologise for the inconvenience.Jeff --Jeff Watkinshttp://newburyportion.com/Democracy n: A country where the newspapers are pro-American. 

[TurboGears] Re: Many-to-Many joins with fields

2005-11-02 Thread Ronald Jaramillo


Hi,
Ian has a point there, one of the reason Hibernate is doing so much,  
is partly because writing logic in Java is not as fun as doing it in  
Python, so doing as much as possible in a declarative way is  
reasonable in the J2EE world.


Cheers
Ronald

On Nov 2, 2005, at 9:06 PM, Ian Bicking wrote:



Jeff Watkins wrote:

What I'm looking for specifically (and what I really enjoyed in   
Hibernate, which in my book sets the standard for ORMs if you  
hadn't  already guessed) was something like the following:

ImagePlacements
---
article_id: Article
image_id: Image
source_name: String
This would allow me to have the following in my data model:
a= Article.get(1)
mainImage= a.imagePlacements[main]
featureImage= a.imagePlacements[feature]
This simply can't be done with SQLObject today.



Sure it can.  It requires programming.  Programming is okay; we're  
all programmers, right?  Not everything needs to be declarative.


class Article(SQLObject):

def imagePlacements(self, name):
res = list(ImagePlacements.selectBy(article=self,  
source_name=name))

assert len(res) == 1
return res[0].image

Well, that's not ['main'], but instead ('main').  Implementing the  
full dictionary interface would be nice, but a bit more work (not  
much, UserDict.DictMixin handles most of the methods).  I'd like  
SelectResults instances (what selectBy returns) to have a getOne()  
method too, which would handle the assert and whatnot.


A join along these lines would be okay to have; I don't want to  
bring in *every* possible case as a declarative construct, but  
there's certainly room for a few more.  The API might be:


imagePlacements = joins.MappingJoin('ImagePlacements',  
keyColumn='sourceName', resultColumn='image')



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




Ronald Jaramillo
mail: ronald AT checkandshare DOT com
blog: http://www.checkandshare.com/blog





[TurboGears] Re: Many-to-Many joins with fields

2005-11-02 Thread Jeff Watkins


Ronald Jaramillo wrote:


Hi,
Ian has a point there, one of the reason Hibernate is doing so much,  is 
partly because writing logic in Java is not as fun as doing it in  
Python, so doing as much as possible in a declarative way is  reasonable 
in the J2EE world.


Except that selectBy always hits the Database and doesn't seem to cache 
the results. This is similar to the problem with alternate ID columns: 
when you request something by an alternate ID, you're doing query even 
if the object is already in memory -- at least that's what I've been 
able to figure out.


--
Jeff Watkins
http://newburyportion.com


[TurboGears] Re: OT: Development olatform opinions (To Mac...?)

2005-11-02 Thread Ronald Jaramillo
I have been running OS X since beta, and shure it has it share of quirkiness, but as a developer this is really a great environment.Part of what it makes it great,  is the (almost) absence of broken windows (a new finder is comming they say =)). Spending my day surrounded by apps like QuickSilver or OmniGraffle ... well paraphrasing Jack Nicholson, it make me want to be a better developer.CheersRonaldOn Nov 2, 2005, at 8:24 PM, Jared Kuolt wrote:Thanks all for your comments so far! Absolutely brilliant! If you could list more of your requirements for what you will be usingthe computer for, people can probably give better responses. I used to be into PC-gaming but my PSP really took care of that. Now Ijust mostly do a lot of software development, most of it with"scripting" languages; Not a whole lot of compiling for me.I do multitask like crazy, so I suppose RAM should be a consideration.A few more questions if you don't mind:1) Is the dashboard really that cool?2) How often do unforseen problems occur (BSOD-esque, not hardware failures)?3) Are refurbished Macs generally good quality?4) From what I've seen it looks like the first Intel-based macs aredue to arrive in about 6-8 months. Since I'm in need of a new computersoon, would it be a good idea to get a mini now and wait for the newPower Mac to make a decision? Or should I just go with a cheap PClaptop?5) Mac Mini or iBook or Powerbook? Is the price justified if I'm notvery mobile?6) Do the iBooks get really dingy-looking?Again, thanks! And sorry for the attack on the iMac. Just _not_ my thing!Jared   Henriksvej 15 2400 København NV +45 22 27 85 11 [EMAIL PROTECTED]  

[TurboGears] Re: transactions in a forking WSGI server

2005-11-02 Thread Ian Bicking


Sean Cazzell wrote:

On Wed, 2005-11-02 at 13:02 -0600, Ian Bicking wrote:

OTOH, caching with multiple processes and SQLObject can get a little 
hairy.  I can't give a quick answer about that, because I've been 
putting off thinking through the implications for some time :(



Ian, if we have caching disabled we are safe, right?  I've been looking
at CacheFactory and it sounds like using the new events system in 0.8
one could implement caching using memcached for multi-process/server
environments.


No, I don't think it's entirely safe.  A definite to-do for 0.8 will be 
a public and documented caching interface.  If a multiprocess 
environment you'll probably want to leave caching on (it's pretty 
important for performance) and then clear the cache at the beginning or 
end of each request.  You can do that with _connection.cache.clear().


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


[TurboGears] Re: Many-to-Many joins with fields

2005-11-02 Thread Ian Bicking


Jeff Watkins wrote:

Ronald Jaramillo wrote:



Hi,
Ian has a point there, one of the reason Hibernate is doing so much,  
is partly because writing logic in Java is not as fun as doing it in  
Python, so doing as much as possible in a declarative way is  
reasonable in the J2EE world.



Except that selectBy always hits the Database and doesn't seem to cache 
the results. This is similar to the problem with alternate ID columns: 
when you request something by an alternate ID, you're doing query even 
if the object is already in memory -- at least that's what I've been 
able to figure out.


Caching is a separate concern, and I think it's bad to mix that into 
what-is-possible discussions.  Caching is an optimization; though an 
important optimization (sometimes), premature consideration of 
optimizations is not good for design.  Plus it sounds like you are 
trying to find new reasons not to like our answers ;)


SQLObject certainly isn't J2EEish, in a whole bunch of ways.  Personally 
I think that's okay; and one some level you must think so too, since you 
are here after all.


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


[TurboGears] Re: transactions in a forking WSGI server

2005-11-02 Thread Benoit Masson


How to stay update ?
I must say I'm a bit fuzzy about the dev/prod config file and the way  
to keep turbogears uptodate and egg development.


As I've already said we're looking for a scalable framework for the  
next 6 month. Meanwhile we're ready to build uppon moving framewaork  
as turbogears seems to be a very nice one. Therefore I started  
testing and developping on 0.9 from SVN. I downloaded it, make a  
setup.py develop and then tg-admin quicktsart. Now I have a  
project with my code init. I supposed this is linked to a specific  
0.9 SVN turbogears version. So what would be the best way of  
maintening my turbogears uptodate ? By the way I kept the trunk  
directory the place i first downloaded it, does update through SVN  
will be suffisent ?


Thanks
Le 2 nov. 05 à 21:47, Sean Cazzell a écrit :



On Wed, 2005-11-02 at 13:02 -0600, Ian Bicking wrote:

OTOH, caching with multiple processes and SQLObject can get a little
hairy.  I can't give a quick answer about that, because I've been
putting off thinking through the implications for some time :(


Ian, if we have caching disabled we are safe, right?  I've been  
looking

at CacheFactory and it sounds like using the new events system in 0.8
one could implement caching using memcached for multi-process/server
environments.


Sean Cazzell





[TurboGears] How to stay up to date ?

2005-11-02 Thread Benoit Masson



OOps sorry I forgot to change the subject in my previous post :

How to stay update ?
I must say I'm a bit fuzzy about the dev/prod config file and the way  
to keep turbogears uptodate and egg development.


As I've already said we're looking for a scalable framework for the  
next 6 month. Meanwhile we're ready to build uppon moving framewaork  
as turbogears seems to be a very nice one. Therefore I started  
testing and developping on 0.9 from SVN. I downloaded it, make a  
setup.py develop and then tg-admin quicktsart. Now I have a  
project with my code init. I supposed this is linked to a specific  
0.9 SVN turbogears version. So what would be the best way of  
maintening my turbogears uptodate ? By the way I kept the trunk  
directory the place i first downloaded it, does update through SVN  
will be suffisent ?


Thanks



[TurboGears] Re: TurboGears forms first look

2005-11-02 Thread David Bernard

Hi,

For my own crud application, I choose to generate kid template (and
checksum) at startup time. Previous templates was erased if the
chechsum of the existing templates (or if no template exists) check the
templates.
Advantages :
* generate templates that could be compiled by Kid
* user could choose to modify the templates, without need to  know the
form/widget framework, and avoid the blank page syndrome
* user could customize widget for a more global impact and don't need
to edit templates
* user could mixed both customization facilities

About Widget, I use the same approach as Kevin except I use the
argument order instead of declare an explicite array =
 myform = TableForm(widgets.TextField(name),
widgets.TextField(address),
widgets.TextField(age, default=0,
validator=validators.Int()))

I also use the 3 parameter key/fieldname, validator only for
widgets used for editing, and default. I define 2 bases types for
widgets :
* Widget : use to display or edit one field
* WidgetsList : use as composite of Widget or WidgetsList
And for the crud, I define 3 families : edit, view, list

About error handling, I choose the had for every field entry in the
dict, a field names 'field_error_' set by editing widget (default is
None), like this the kid template is simple (%(key)s is replaced by the
key/fieldname):
tr py:if=%(key)s_error_ colspan=2
  td class=error py:content=str(%(key)s_error_)/
/tr

I also define based on the TurboEngine code a controller, and the (3)
automatics WidgetsList generators from SQLObject.

Kevin, If your interested I could send you the crudgear draft, and
I'll be happy to help you, like this I could work on my TG application
(night only and often offline) andbe sync with last dev.



[TurboGears] Re: transactions in a forking WSGI server

2005-11-02 Thread Jonathan LaCour


No, I don't think it's entirely safe.  A definite to-do for 0.8  
will be a public and documented caching interface.  If a  
multiprocess environment you'll probably want to leave caching on  
(it's pretty important for performance) and then clear the cache at  
the beginning or end of each request.  You can do that with  
_connection.cache.clear().


I seem to have solved the problem I was seeing earlier, with data  
getting out-of-sync in-between requests.  It looks like either a bug  
in SQLObject, or a misunderstanding on my part, or a bit of both :)   
Remember, I am deploying this behind the flup forking WSGI/SCGI server.


I fixed my problem by creating the following filter:

from cherrypy.lib.filterimport basefilter
from myproject.modelimport hub

class CacheFilter(basefilter.BaseFilter):
def beforeMain(self):
hub.getConnection().cache.clear()   

def beforeFinalize(self):
hub.getConnection().cache.clear()

And then I enabled it globally in the cherrypy configuration.   
Filters are pretty awesome!


Ian, should I have to do this?  Turning the cache off completely did  
*not* seem to solve the problem (?cache=0), whereas this filter did  
solve the problem.


Sorry for slamming the list today with questions :)

  -- Jonathan


[TurboGears] TurboGears / FormEncode / DateConverter / validation problem

2005-11-02 Thread Don Hopkins








Im using TurboGears and its associated entourage of
python modules for a couple of different projects, and I love it! 

Ive read over the code and Im really happy
with how well its all designed. 

Elegant, amazing stuff that fits together very well!

Id like to help out debugging and developing it. 



Heres a description of a wee problem Im having
with FormEncode:



I installed latest TurboGears 0.8a4, which installed FormEncode
rev 1104



Couldnt get FormEncodes validators.DateConverter
to work, because it was trying to call assert_string, which should have been
defined in FancyValidator, but wasnt. 



So I upgraded to the latest FormEncode rev 1182, which had assert_string.




That fixed the problem with assert_string being undefined,
but led to other problems. 



When I submitted my form with a date in the form of 2005-11-01
19:32:55, and it caused a (handled) validation error (although I think it
should have validated correctly, but it failed to match _day_date_re). 



The validation error was not being handled by TurboGears
correctly, because turbogears controllers.py tries to go raise turbogearsvalid.Invalid(str(errors)),
which causes an error TypeError: __init__() takes at least 4 arguments
(2 given) because the Invalid.__init__ method from formencodes api.py
expects 4 required args self, msg, value, state, error_list=None, error_dict=None.



In summary, I think TurboGears needs to be updated to use
the latest version of FormEncode, and fixed to call the Invalid constructor
with the right arguments including msg, value and state. (value and state
currently missing). Also, I think FormEncodes DateConverter should accept
dates in the form 2005-11-01 19:32:55, which is how they print out
form Python by default. 



 -Don












[TurboGears] Re: Widgets and JavaScript

2005-11-02 Thread Kevin Dangoor

Hi Matt,

Dojo certainly has thought of namespaces.

The Dojo notion of a widget is somewhat orthogonal to the TurboGears
notion of a widget. You could certainly make a TurboGears widget that
is essentially a call to Dojo's. The TurboGears side would be
responsible for getting the data to/from Python. The Dojo side would
be responsible for the display and function of the widget.

Kevin

On 11/2/05, m h [EMAIL PROTECTED] wrote:

 Kevin-

 Any chance of using Dojo?  They have a few widgets.  (And they have
 thought about namespaces)

 matt

 On 11/2/05, Kevin Dangoor [EMAIL PROTECTED] wrote:
 
  One of the interesting challenges of making a widget or component
  style forms framework is handling of JavaScript and CSS that need to
  come along with the widget. Here's an impressive and somewhat
  frightening way to do it:
 
  http://jakarta.apache.org/tapestry/QuickStart/forms.html
 
  The Body component plays a crucial role in Tapestry; it organizes all
  the JavaScript generated when a page renders. It assists components
  with generated unique names for client-side variables and functions,
  and organizes all the JavaScript generated by all the component within
  the page into two large blocks (one at the top of the page, one at the
  bottom). The DatePicker component will not operate unless it is
  enclosed by a Body component.
 
 
  So, Tapestry actually mangles the names in the JavaScript to avoid
  collisions! Wow. I'm thinking of a little simpler and likely more
  obvious solution should problems arise.
 
  What I'm thinking of is allowing each widget to specify some
  JavaScript and CSS that it needs to have. If you're planning to
  distribute your widget to others (or even just generally), you should
  use fully qualified names (like MochiKit does) to avoid naming
  collisions. Name mangling is cool, but I don't think I want to tackle
  that now.
 
  If you use multiple of the same widget on a page, the JavaScript would
  appear once. I also want to make it possible for several widgets to
  share one JavaScript file (which reduces page size and saves server
  roundtrips when there are multiple scripts).
 
  There are three things that I'm working on before I go into the level
  of detail with widgets that I did with the forms:
 
  1) JavaScript/CSS inclusion
  2) Repeating elements
  3) Optional code generation
 
  #3 might not be fully implemented in the first release, but I want the
  basis to be there.
 
  #2 will almost certainly use variabledecode.
 
  If you have any comments on these things, now is a good time.
 
  Kevin
 
  --
  Kevin Dangoor
  Author of the Zesty News RSS newsreader
 
  email: [EMAIL PROTECTED]
  company: http://www.BlazingThings.com
  blog: http://www.BlueSkyOnMars.com
 



--
Kevin Dangoor
Author of the Zesty News RSS newsreader

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


[TurboGears] Re: transactions in a forking WSGI server

2005-11-02 Thread Jonathan LaCour


Ian, should I have to do this?  Turning the cache off completely  
did  *not* seem to solve the problem (?cache=0), whereas this  
filter did  solve the problem.


SQLObject always keeps weak references to objects cached, so  
turning a cache off will not necessarily keep all objects from  
being cached. Reseting the cache at the beginning of the request is  
probably better and faster.


Probably TurboGears could/should do this automatically, when env 
['wsgi.multiprocess'] is true.


I was wrong.  My filter still doesn't seem to fix the problem  
entirely.  There is obviously a bug somewhere... either in my code or  
in SQLObject.


I will make sure to post an update if and when I figure this out!

  -- Jonathan


[TurboGears] Re: Widgets and JavaScript

2005-11-02 Thread David Bernard

In crudgear, Widget have 2 methods :
* xhtmlBody() : return the content to insert into body
* xhtmlHead() : return the content to insert into head

Idem WdgetsList have the same 2 methods, but aggreate the result of the
composite Widget, and for xhtmlHead avoid to insert duplicate value (to
avoid insert twice or more the css, js, ...), because several
TotoWidget could return the same xhtmlHead() but various xhtmlBody()

Currently a widget is a python module + files to copy under static
directory.



[TurboGears] Re: Widgets and JavaScript

2005-11-02 Thread Ian Bicking


Kevin Dangoor wrote:

What I'm thinking of is allowing each widget to specify some
JavaScript and CSS that it needs to have. If you're planning to
distribute your widget to others (or even just generally), you should
use fully qualified names (like MochiKit does) to avoid naming
collisions. Name mangling is cool, but I don't think I want to tackle
that now.


That breaks the relation between server-side code and browser-side code. 
 I like my browser to use names, filenames, and line numbers I 
recognize.  And Javascript isn't really *that* bad for building 
abstractions; there's no need for code generation.  So that's just my 
vote for never, not later, on the name mangling.



If you use multiple of the same widget on a page, the JavaScript would
appear once. I also want to make it possible for several widgets to
share one JavaScript file (which reduces page size and saves server
roundtrips when there are multiple scripts).

There are three things that I'm working on before I go into the level
of detail with widgets that I did with the forms:

1) JavaScript/CSS inclusion


I think it would be good to lean on Javascript more than might 
immediately seem necessary; i.e., to build a Javascript framework for 
forms intead of generating too much ad hoc Javascript for the widgets.


So, for instance, WHAT-WG Web Forms 2.0 defines a bunch of new form 
controls.  Those are a nice place to start -- in many cases some 
Javascript is all that's needed to implemented those HTML extensions, 
and the a date input widget can just generate 'input type=date'.  In 
other cases you can use Kids' matching, potentially, to transform that 
HTML to something browsers like more -- but that shouldn't be necessary.


Another thing I've thought about that's a little simpler is something 
like 'mochi-onload=some_func', and when the document was loaded all 
the elements would be inspected for that attribute, when found doing 
something like:


  eval(el.getAttribute('mochi-onload')).apply(el)

This is a low-impact way of attaching functionality, without getting too 
terribly fancy.



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


[TurboGears] Re: Widgets and JavaScript

2005-11-02 Thread matthew clark
If you use multiple of the same widget on a page, the _javascript_ wouldappear once. I also want to make it possible for several widgets to
share one _javascript_ file (which reduces page size and saves serverroundtrips when there are multiple scripts).
Allowing widgets to share a JS file sounds like a good idea, but be
careful that doesn't limit flexibility, or sacrifice simplicity.
In heavily interactive pages, the user could be loading and submitting
several forms doing very different things. I've found that often
its easier to keep multiple JS files each focused on a specific
task. It almost feels pythonic doing it that way.

And, if you use widgets across several pages, individual JS files will
be cached, saving bandwidth. If you build a JS file for each
page, you'll only be able to cache it for each page. Could cause
bigger downloads.

Now, all that being said, I come from an unstructured web development
environment. Doing things inside the mega framework of TurboGears
could make my comments irrelevant.

matt


[TurboGears] Re: PackageHub does not work for sql create

2005-11-02 Thread Dave Warnock

Ian,

 I want to write web apps in TurboGears that will be used to make cheap
 non dynamic hosting appear a little more dynamic without them needing to
 host their own applications. 
 
 OK... so you either need static publishing (blogger-style), or various
 client-side templating options, like Javascript includes, iframes, etc.
  These are all outside the realm of deployment...

Agreed. I am looking at deploying applications on my server for Churches
to do useful admin type things. Some of these (like the services list)
will then semi dynamically update their web pages, but that process is
separate to the deployment and ui of my web application.

 So for this type of webapp which is going to be free I need to be able
 to host as easily as possible on my textdrive account. I don't want a
 shared database and I don't want to have to create new
 configurations/instances each time a church registers. 
 
 Then you need to programmatically instantiate the applications.  At
 least in Paste Deploy, the configuration files map very closely to
 function calls, so you can construct your own database-driven
 application dispatcher.  You would do this in Python, since you really
 need programming to do this kind of dispatching.  *Possibly* there could
 be a framework for this sort of multi-client install situation; but
 there isn't and probably won't/shouldn't be until lots of people are
 doing it.

Is there not a choice?

a) Do this in Paste Deploy as described above

b) Do this in TurboGears so that I have a custom version of the Hub that
gets connections per request (and caches them) where the connection URI
is to a database calculated from the url.

At the moment b) looks faster to develop as
- so far as I understand it Paste and TurboGears are not fully synced up
- I can get TurboGears working on TextDrive using published HowTos so
that I can take my turbogears app as an egg and install it (using the
Virtual Python trick).
- Choosing b) does not stop me changing my deployment options in the
future when Paste and TurboGears have moved onward a bit (and that key
CherryPy ticket).

Dave


[TurboGears] Re: error upgrading from TG0.8a1 to 0.83a : elementtree ?

2005-11-02 Thread [EMAIL PROTECTED]


I noticed this problem when I tried this:

$ python ez_setup.py -UDf http://turbogears.org/download/ TurboGears
Reading http://turbogears.org/download/
Searching for TurboGears
Reading http://www.python.org/pypi/TurboGears/
Reading http://www.turbogears.org
Best match: TurboGears 0.8a4
Downloading
http://turbogears.org/download/eggs/TurboGears-0.8a4-py2.4.egg
Processing TurboGears-0.8a4-py2.4.egg
creating c:\python24\lib\site-packages\TurboGears-0.8a4-py2.4.egg
Extracting TurboGears-0.8a4-py2.4.egg to c:\python24\lib\site-packages
Adding TurboGears 0.8a4 to easy-install.pth file
Installing tg-admin-script.py script to c:\Python24\Scripts
Installing tg-admin.exe script to c:\Python24\Scripts

Installed c:\python24\lib\site-packages\turbogears-0.8a4-py2.4.egg
Processing dependencies for TurboGears
Searching for TestGears=0.2
Reading http://www.python.org/pypi/TestGears/
Reading http://www.turbogears.org/testgears/
Best match: TestGears 0.2
Downloading
http://www.turbogears.org/download/eggs/TestGears-0.2-py2.4.egg
Processing TestGears-0.2-py2.4.egg
Moving TestGears-0.2-py2.4.egg to c:\python24\lib\site-packages
Adding TestGears 0.2 to easy-install.pth file

Installed c:\python24\lib\site-packages\testgears-0.2-py2.4.egg
Searching for FormEncode=0.2.3dev-r1104
Reading http://www.python.org/pypi/FormEncode/
Reading http://formencode.sf.net
Best match: FormEncode 0.2.3dev-r1104
Downloading
http://turbogears.org/download/eggs/FormEncode-0.2.3dev_r1104-py2.4.
egg
Processing FormEncode-0.2.3dev_r1104-py2.4.egg
creating
c:\python24\lib\site-packages\FormEncode-0.2.3dev_r1104-py2.4.egg
Extracting FormEncode-0.2.3dev_r1104-py2.4.egg to
c:\python24\lib\site-packages
Adding FormEncode 0.2.3dev-r1104 to easy-install.pth file

Installed
c:\python24\lib\site-packages\formencode-0.2.3dev_r1104-py2.4.egg
Searching for cElementTree=1.0.2
Reading http://www.python.org/pypi/cElementTree/
Reading http://www.effbot.org/zone/celementtree.htm
Reading http://effbot.org/downloads#celementtree
Best match: cElementTree 1.0.3-20050812
Downloading
http://effbot.org/downloads/index.cgi/cElementTree-1.0.3-20050812.wi
n32-py2.4.exe?index
error: Unexpected HTML page found at
http://effbot.org/downloads/index.cgi/cElem
entTree-1.0.3-20050812.win32-py2.4.exe?index



[TurboGears] Re: error upgrading from TG0.8a1 to 0.83a : elementtree ?

2005-11-02 Thread Phillip J. Eby


[EMAIL PROTECTED] wrote:
 I noticed this problem when I tried this:

 $ python ez_setup.py -UDf http://turbogears.org/download/ TurboGears

If you have setuptools 0.6a7, you can add
'--allow-hosts=turbogears.org' before the '-UDf' in order to make
setuptools only download files from turbogears.org; this will work
around the problem with effbot.org's link format for the time being.



[TurboGears] Re: OT: Development olatform opinions (To Mac...?)

2005-11-02 Thread Mike Pirnat

On 11/2/05, Jared Kuolt [EMAIL PROTECTED] wrote:

 I do multitask like crazy, so I suppose RAM should be a consideration.

Definitely feed it as much as you can.  The marginal cost of more
memory more than makes up for the regret of not purchasing enough.

 A few more questions if you don't mind:

 1) Is the dashboard really that cool?

Yeah, it's pretty cool, and you can make your own dashboard widgets
without too much pain.  It can get kind of cluttered quickly, though,
unless you have a lot of screen real estate.

 2) How often do unforseen problems occur (BSOD-esque, not hardware failures)?

Haven't run into any since I started with OS X in February 2002.

 3) Are refurbished Macs generally good quality?

Dunno; my Mac hardware has all been purchased new (refurb prices are
often quite close to full price, in my experience, so I tend to go
with new).  I presume they'd have to get cleaned up and be in pretty
good shape, though.  Generally, refurb hardware is reputed to go
through more QA than new hardware.

 4) From what I've seen it looks like the first Intel-based macs are
 due to arrive in about 6-8 months. Since I'm in need of a new computer
 soon, would it be a good idea to get a mini now and wait for the new
 Power Mac to make a decision? Or should I just go with a cheap PC
 laptop?

Mini now.  You know you want to... :-)  Also, with the Intel Macs, I'm
planning on holding off until at least the second or third generation
of them before purchasing, in case there is any wonkiness that needs
to get worked out.

 5) Mac Mini or iBook or Powerbook? Is the price justified if I'm not
 very mobile?

Mini if you think you're not going to be mobile at all, especially if
you already have a display, keyboard, and mouse that you want to
continue using, or would prefer over Apple products.  (I'm considering
the Mini as a way of creating a wife-sanctioned upgrade path that will
eventually let me have a big shiny Apple monitor.)  iBook if you want
to be mobile but don't want to break the bank.  Powerbook if you want
do decadent things like burning DVD's on the beach.

 6) Do the iBooks get really dingy-looking?

A friend's iBook got kind of cruddy and physically unsound, but he
dragged it everywhere with him and didn't take very good care of it,
was pretty casual/careless with how he treated it, etc.  I'm guessing
if you're nice to it, it'll hold together a lot better.

--
Mike Pirnat
[EMAIL PROTECTED]


[TurboGears] Identity and Web2.0

2005-11-02 Thread pierrebai

Since TG now has an official identity framework, I thought I'd share
this link to an interesting presentation about shared cross-site
identity for Web2.0 apps. Maybe it will influence some design
decisions.

http://www.identity20.com/media/OSCON2005/



[TurboGears] Re: OT: Development olatform opinions (To Mac...?)

2005-11-02 Thread Bryan Murdock

On 11/2/05, Jared Kuolt [EMAIL PROTECTED] wrote:
snip/
 4) Is the G5 worth over $2000? If you say it is, you must be willing
 to state that this machine will be good for me for over 2 years!

Do you know what kind of Intel or AMD hardware you can get for
$2000!?!?  And if FreeBSD is giving troubles, might I suggest Linux? 
It's come a lng ways since you chose FreeBSD over it (as if I know
when you last took a look, right?).  Ubuntu or Mandriva are very nice.

There, a little bit of balance in the responses.

Bryan


[TurboGears] Re: 20 minute wiki (newbie error - path /edit was not found)

2005-11-02 Thread Robin Munn

On 11/1/05, Jos [EMAIL PROTECTED] wrote:

 Ok I got it working out... I was using Notepad ++ as my text editor,
 and the indentations were apparently fine, I checked them over and over
 again.

 But after reading that you were so convinced that everything was fine,
 I opened controllers.py in the regular Notepad that comes with windows
 and saw the indententions were all wrong!.

 It's working now, thanks Kevin and Sean!

To me, that sounds suspiciously like a tab/space problem. You may want
to check the settings in your editor and make sure your indents are
being done with spaces rather than tabs. Using tabs, in my experience,
looks like a nice short-term solution, but causes nothing but pain in
the long run...

--
Robin Munn
[EMAIL PROTECTED]
GPG key 0xD6497014