[TurboGears] Re: Please help debug this toy doXHR MochiKit call...

2008-01-21 Thread Bob Ippolito

On Jan 21, 2008 12:45 AM, wavydavy [EMAIL PROTECTED] wrote:

 On Jan 20, 10:54 pm, [EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:
  I'm trying to get the client to send data to the server with this
  MochiKit/Javascript function
 
  (I got latest SVN source for MochiKit that has doXHR.)
 
  function send_data() {
  var d = doXHR(/chat/print_data,
{method : POST,
 sendContent : queryString({apple :
  orange}),
 });
  d.addCallback(success_handler);
  d.addErrback(failure_handler);
 
  }
 
  I'm trying to send it to the print_data method show below
 
  @turbogears.expose()
   def print_data(self, the_data):
   open(/output_file, w).write(the_data)
 
  Why do I get this error message about wanting more params?

 Try:

 def print_data(self, apple):
 open(/output_file, w).write(apple)

 IIRC, TG strips non-keyword args from query strings when calling the
 controller.

You probably also have to specify 'Content-type':
'application/x-www-form-urlencoded' in the doXHR call so that the
server knows how to parse your data.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Mustn't/Shouldn't MochiKit's doXHR function default to POST not GET?

2008-01-21 Thread Bob Ippolito

On Jan 20, 2008 11:03 PM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:

 In my limited beginner's understanding of REST interfaces and HTML,
 I'm told it is proper to *pull* data from server with HTML GETs
 and to *push* data to server with HTML POSTsis that right?

 If yes, then how come MochiKit's doXHR function defaults to *GET* mode
 since it
 *pushes* data to server?  Shouldn't doXHR default to POST to be prim
 and
 proper?  :)

It only pushes data to the server if you give it data to push. There
are plenty of use cases for just requesting data from the server, it
might even be static data that should be cached (which covers 100% of
the use cases I had when I was originally writing MochiKit).

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: iPhone applications

2007-06-13 Thread Bob Ippolito

On 6/12/07, Diez B. Roggisch [EMAIL PROTECTED] wrote:

 Noah Gift schrieb:
  Anyone thinking about writing something for the iPhone in Turbogears?
  Will that work?

 I doubt it. The Apps will be like the dashboard-widgets in OSX. That is
 Safari-based rendering with special JS-Objects for system access. No
 python/TG in the equation.

That's not how it works. iPhone's only support for 3rd party apps is
bookmarked URLs that point to regular web pages. A web stack is pretty
much a necessary part of the equation. You can't do widgets, just web
pages that act pretty much like a widget.

Presumably it will have some special JS objects or URL schemes, I
haven't seen any docs yet.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: iPhone applications

2007-06-13 Thread Bob Ippolito

On 6/13/07, Lee McFadden [EMAIL PROTECTED] wrote:

 With something like Google Gears a web based iPhone application could
 be taken offline if it's supported.  I can't see there not being
 something similar (if not Gears itself) to handle those times when you
 don't have any connectivity.

The phone is assumed to always have connectivity, either cellular or
wifi. It currently has no support for offline.

 That being said, I still think having no official SDK is a dumb idea.
 The iPhone is running a stripped down OS X for [insert deity]'s sake,
 *not* allowing developers to harness that potential power is just
 silly.

Stripped down OS X is basically speculation. A real issue is that the
phone almost certainly isn't x86 or ppc based so the compilers they
ship would be useless. Perhaps it's some proprietary compiler that
they don't have license to give away to every developer in the Mac
universe, or just something they can't afford to publicly support at
this time.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: iPhone applications

2007-06-12 Thread Bob Ippolito

On 6/12/07, SamFeltus [EMAIL PROTECTED] wrote:

 Doesn't the iPhone have Flash, and if so, what version...

No.

 Don't see many iPhones in Mississippi on the Redneck Riviera...

Or anywhere else for another 17 days.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Javascript Hijacking

2007-04-03 Thread Bob Ippolito

Not really. That exploit only applies to people returning arrays from
server-side stuff and has absolutely no implications whatsoever for
client-side toolkits such as MochiKit. It's mostly FUD.

On 4/2/07, Fred C [EMAIL PROTECTED] wrote:


 This interesting document talks about ajax security and specially
 Javascript Hijacking. I thing those of you who are using Mochikit
 shoud read this. It will help you secure your ajax code.

 http://www.fortifysoftware.com/servlet/downloads/public/
 JavaScript_Hijacking.pdf

 -fred-


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Javascript Hijacking

2007-04-03 Thread Bob Ippolito

Are you sure it's vulnerable? If you return a JSON object, it is not
vulnerable. JSON objects are only valid expressions, not statements,
so they are simply an error when sourced with a script tag.

You are ONLY vulnerable if you [return, an, array] as the outer-most
JSON object.

-bob

On 4/3/07, Paul Johnston [EMAIL PROTECTED] wrote:
 Hi,

 The advisory is relevant to TurboGears, which returns JSON data. If you have
 a JSON method that returns confidential data to a logged on user, a
 malicious website could harvest this. It is not FUD - at least one site I've
 developed was vulnerable. You could harvest the company's internal contact
 list.

 A quick fix at the TG level would be to have JSON controllers only return
 JSON for POST requests.

 Paul



 On 4/3/07, Bob Ippolito  [EMAIL PROTECTED] wrote:
 
  Not really. That exploit only applies to people returning arrays from
  server-side stuff and has absolutely no implications whatsoever for
  client-side toolkits such as MochiKit. It's mostly FUD.
 


  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Javascript Hijacking

2007-04-03 Thread Bob Ippolito

On 4/3/07, Fred C [EMAIL PROTECTED] wrote:


 On Apr 3, 2007, at 12:10 PM, Bob Ippolito wrote:

 
  Are you sure it's vulnerable? If you return a JSON object, it is not
  vulnerable. JSON objects are only valid expressions, not statements,
  so they are simply an error when sourced with a script tag.
 
  You are ONLY vulnerable if you [return, an, array] as the outer-most
  JSON object.

 Are not all JSON objects associative arrays ?


Arrays in JavaScript are not (used as) associative arrays, they are
arrays. That's irrelevant though, this is a syntax issue. Some syntax
is exploitable, and other syntax is not.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: using eval safely?

2007-03-20 Thread Bob Ippolito

On 3/20/07, iain duncan [EMAIL PROTECTED] wrote:

 On Tue, 2007-20-03 at 18:57 -0300, Jorge Godoy wrote:
  iain duncan [EMAIL PROTECTED] writes:
 
   I know one has to be *very careful* using eval with anything that comes
   from a url submission. It would however, but out a lot of conditionals.
   Can anyone tell me if it is safe to eval a string provided I previously
   do a positive match against it with an re containing alphabetical
   characters only? Is there anyway for python to do damage evaling one
   word?
 
  Why don't you use a dictionary?

 That's what I currently have, which is obviously fail safe. But I was
 thinking it would be nice to have one less place to insert new mapper
 objects into the code.

One less place to have an explicit mapping is one more place where you
may have a security hole. The road you're trying to go down is pretty
sketchy.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: More Flashy Python Pages

2007-03-04 Thread Bob Ippolito

On 3/4/07, SamFeltus [EMAIL PROTECTED] wrote:

 Here is another shiny, bandwidth wasting Flash page generated/edited
 by TurboGears.

 http://samfeltus.com/as3/primavera.html

FYI, looks like you've fixed that AS3 exception that I was seeing with
your previous iterations of that app.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Gzip compression of .py and .kid files.

2007-02-27 Thread Bob Ippolito

On 2/27/07, Joshua J. Kugler [EMAIL PROTECTED] wrote:

 On Tuesday 27 February 2007 12:46, Chris Dew wrote:
  I'm new to Python and TurboGears.  I haven't been able to find the
  answer to my question by Googling, possibly because gzip is
  everywhere on the web.
 
  The context of my question is: deploying a TurboGears application onto
  a system with limited (flash) storage.  I am aware of the various
  compressed filesystems available, but I'm considering other
  approaches.
 
  Is it possible to deploy a TurboGears application with all/some of
  it's source .py and .kid files gzipped to save space?

 Python itself can import zipped files (zip, not gzip AFAIK).  I've not tried
 zipped kid files.  I *think* it just overloads python's import routines, so
 it might be able to.

I'd doubt that the templates would work, but the sources would. It's a
non-trivial amount of effort though.

You're probably prematurely optimizing though. Is it work that much
effort to save (if you're REALLY lucky) about 1MB?

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Gzip compression of .py and .kid files.

2007-02-27 Thread Bob Ippolito

On 2/27/07, Chris Dew [EMAIL PROTECTED] wrote:



 On Feb 27, 11:43 pm, Bob Ippolito [EMAIL PROTECTED] wrote:
  On 2/27/07, Joshua J. Kugler [EMAIL PROTECTED] wrote:
 
 
 
 
 
   On Tuesday 27 February 2007 12:46, Chris Dew wrote:
I'm new to Python and TurboGears.  I haven't been able to find the
answer to my question by Googling, possibly because gzip is
everywhere on the web.
 
The context of my question is: deploying a TurboGears application onto
a system with limited (flash) storage.  I am aware of the various
compressed filesystems available, but I'm considering other
approaches.
 
Is it possible to deploy a TurboGears application with all/some of
it's source .py and .kid files gzipped to save space?
 
   Python itself can import zipped files (zip, not gzip AFAIK).  I've not 
   tried
   zipped kid files.  I *think* it just overloads python's import routines, 
   so
   it might be able to.
 
  I'd doubt that the templates would work, but the sources would. It's a
  non-trivial amount of effort though.
 
  You're probably prematurely optimizing though. Is it work that much
  effort to save (if you're REALLY lucky) about 1MB?
 
  -bob

 That's a good point about it being premature optimisation.

 If the (application *and* framework's) .py and .kid files are only
 1.5Mb, I would save 1Mb.  I expect there are more than 1.5Mb of
 files.

 Even 1Mb is good if you've only got 16Mb.  I should have more than
 that, but you're fighting bloat all the way with flash.

 With the work involved, I may be better off storing much of the
 application/framework on some form of compressed (read-only?) loopback
 filesystem.  I was (perhaps naively) hoping that you could set
 USE_GZIP = TRUE in a configuration file.

Well dependent libraries are easy enough if they're egg zip
compatible, you don't have to do anything -- they're already zipped.
You said TurboGears application, not the rest of the stack. Still not
really worth spending much time on though.

A compressed filesystem like squashfs or cramfs is a much easier and
more standard approach to this sort of problem *and* it will compress
things like extensions and executables (which dwarf Python bytecode
most of the time) where any other solution will not. If you truly
constrained to double digit MBs you're going to want (perhaps even
need) to use one anyway for the rest of the OS.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: TurboGears generated MardiGras page

2007-02-26 Thread Bob Ippolito

On 2/26/07, SamFeltus [EMAIL PROTECTED] wrote:

  No need to. I'm not sure what actually the TG-part of all of this is.
 
 It is just an example of TurboGears generated Flash, all created and
 edited in the browser, minus the image editing, done in the GIMP.

 It's value is comedic...  Somewhere in the manual, I read to post
 anything interesting you did in TurboGears...

 As to bandwidth, the page is true to the spirit of Mardi Gras.  It is
 wasteful of bandwidth and resources...  :)

There's a bug in your ActionScript somewhere:

ReferenceError: Error #1069: Property targetx_text not found on
MardiGras2 and there is no default value.
at sunshine_nav4::SunshineNav4/::mouse_up()

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: TurboGears generated MardiGras page

2007-02-26 Thread Bob Ippolito

I'm using the debug player on Mac OS X. Not sure if there is one
available on Linux. There's definitely one for Windows.

I think you can get a debug player with the Flex Builder thing. We're
in Adobe's pre-release program, so I got mine elsewhere...

-bob

On 2/26/07, SamFeltus [EMAIL PROTECTED] wrote:

 PS How did you figure that out, I just have Ubuntu, TG and MXMLC
 compiler?

 On Feb 26, 9:40 pm, SamFeltus [EMAIL PROTECTED] wrote:
  I am reckoning you already know more about the ActionScript in it than
  I do Bob...
 
  :)
 
  Sam the Gardener
 
  On Feb 26, 9:32 pm, Bob Ippolito [EMAIL PROTECTED] wrote:
 
   On 2/26/07, SamFeltus [EMAIL PROTECTED] wrote:
 
 No need to. I'm not sure what actually the TG-part of all of this is.
 
It is just an example of TurboGears generated Flash, all created and
edited in the browser, minus the image editing, done in the GIMP.
 
It's value is comedic...  Somewhere in the manual, I read to post
anything interesting you did in TurboGears...
 
As to bandwidth, the page is true to the spirit of Mardi Gras.  It is
wasteful of bandwidth and resources...  :)
 
   There's a bug in your ActionScript somewhere:
 
   ReferenceError: Error #1069: Property targetx_text not found on
   MardiGras2 and there is no default value.
   at sunshine_nav4::SunshineNav4/::mouse_up()
 
   -bob


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: TGWebServices without TG?

2007-02-20 Thread Bob Ippolito

Wishful thinking would make it as easy to use as something like
XML-RPC. Whether that requires WSDL generation or not, I'm not sure. I
should be able to create *one* instance and call methods on it. I have
a feeling that some SOAP implementations don't even seem to care so
much about types or adhering exactly to the WSDL... at least that
seems to be the case with NuSoap for PHP. It seems to mostly just care
about the order of the parameters.

Whatever you do, don't look to ZSI for an example. I shouldn't have to
create a port to create something else and then create particular
request objects and then maybe someday actually call a method.

If a special message object needs to be created it should be able to
be constructed by kwargs to the method call or by coercing a dict into
whatever. Not by creating an object and setting a whole bunch of
attributes one at a time.

-bob

On 2/20/07, Aaron Bickell [EMAIL PROTECTED] wrote:

 You're right, the client end of soaplib is pretty painful right now.
 Soaplib was initially done for writing web services, and the client
 stuff grew out as an offshoot.  ElementSoap is useful for constructing
 low-level SOAP messages, but I'd like to provide a higher-level API.
 I have started on a wsdl2py, which will (hopefully) make the client
 aspects of this really easy. Any suggestions you have on making the
 client parts of soaplib easier, I'd love to hear them.

 Aaron

 On 2/19/07, Bob Ippolito [EMAIL PROTECTED] wrote:
 
  I did look at soaplib. The API for writing clients is really bad, and
  on top of that I couldn't get it to talk to the service in question.
  The API for writing servers looked fine I guess, but I'm not in a
  position to where I'd ever have or want to create a SOAP service.
 
  elementsoap worked great, eventually, but it doesn't really do
  anything for you beyond shorthand for creating the request
  documents which is probably why it worked.
 
  -bob
 
  On 2/19/07, Mark Ramm [EMAIL PROTECTED] wrote:
  
   I've been using the new soaplib library in a couple of  projects, and
   while I think SOAP sucks, I know that soaplib makes it suck less.
  
   With that said, I'd doubt that soaplib would help with either of your
   problems, as they seem to have been the result of seriously  broken
   soap libraries.  Of course the complexity, ambiguity, and handwaving
   of the SOAP spec in various areas pretty much makes writing broken
   implementations unavoidable.
  
   My point is just that sometimes you have to deal with SOAP, and it
   will be a good thing for Python if we have tools that make SOAP less
   frustrating and painful.
  
   --Mark Ramm
  
SOAP is a total nightmare. It's the most complicated and least
efficient way to do anything.
   
I think I wasted about 10 hours over the past few days trying to
figure out how to put together a SOAP client that would talk to a
poorly implemented SOAP service (written in PHP with NuSoap). Neither
the documentation or the WSDL file were correct and they didn't
provide example code in any language!
   
I eventually managed to get it to work using elementsoap, after
failing miserably with ZSI and SOAPpy. I had to hack in dumping of the
XML back and forth to figure out what was actually happening.
   
This is actually the second time I've used SOAP... the first time was
similarly screwed up -- the service I was talking to was written in C
and didn't actually use an XML parser (nor was it a correct HTTP
implementation). Ugh.
   
XML-RPC, url encoded variables, JSON, and anything else REST-ish have
always worked out pretty well for me though.
  
   
  
 
  
 


 --
 http://aaronbickell.net/

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: TGWebServices without TG?

2007-02-20 Thread Bob Ippolito

With soaplib it looks something like this::

action = {urn:something}someAction
request = SoapRequest(action)
SoapElement(request, login_hash, string, login_hash)
SoapElement(request, affiliate_id, string, str(affiliate_id))
SoapElement(request, offer_id, string, str(offer_id))
SoapElement(request, start_date, string, start_date)
SoapElement(request, end_date, string, end_date or '')
SoapElement(request, sub_id, string, sub_id or '')
SoapElement(request, traffic_type_id, string,
str(traffic_type_id or ''))
SoapElement(request, sales_only, boolean,
sales_only and 'true' or 'false')
response = self.call(action, request)
# ... parse out response from the XML

On 2/20/07, Aaron Bickell [EMAIL PROTECTED] wrote:

 If you could share what you had to do in ElementSoap, I can try and
 make that easier to do using soaplib.  The long and short of it is,
 nobody really wants to work with SOAP, but sometimes that's what you
 have to do, and my goal with soaplib was to make SOAP no more painful
 than it has to be.  Your input is appreciated.

 Aaron



 On 2/19/07, Bob Ippolito [EMAIL PROTECTED] wrote:
 
  I did look at soaplib. The API for writing clients is really bad, and
  on top of that I couldn't get it to talk to the service in question.
  The API for writing servers looked fine I guess, but I'm not in a
  position to where I'd ever have or want to create a SOAP service.
 
  elementsoap worked great, eventually, but it doesn't really do
  anything for you beyond shorthand for creating the request
  documents which is probably why it worked.
 
  -bob
 
  On 2/19/07, Mark Ramm [EMAIL PROTECTED] wrote:
  
   I've been using the new soaplib library in a couple of  projects, and
   while I think SOAP sucks, I know that soaplib makes it suck less.
  
   With that said, I'd doubt that soaplib would help with either of your
   problems, as they seem to have been the result of seriously  broken
   soap libraries.  Of course the complexity, ambiguity, and handwaving
   of the SOAP spec in various areas pretty much makes writing broken
   implementations unavoidable.
  
   My point is just that sometimes you have to deal with SOAP, and it
   will be a good thing for Python if we have tools that make SOAP less
   frustrating and painful.
  
   --Mark Ramm
  
SOAP is a total nightmare. It's the most complicated and least
efficient way to do anything.
   
I think I wasted about 10 hours over the past few days trying to
figure out how to put together a SOAP client that would talk to a
poorly implemented SOAP service (written in PHP with NuSoap). Neither
the documentation or the WSDL file were correct and they didn't
provide example code in any language!
   
I eventually managed to get it to work using elementsoap, after
failing miserably with ZSI and SOAPpy. I had to hack in dumping of the
XML back and forth to figure out what was actually happening.
   
This is actually the second time I've used SOAP... the first time was
similarly screwed up -- the service I was talking to was written in C
and didn't actually use an XML parser (nor was it a correct HTTP
implementation). Ugh.
   
XML-RPC, url encoded variables, JSON, and anything else REST-ish have
always worked out pretty well for me though.
  
   
  
 
  
 


 --
 http://aaronbickell.net/

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: TGWebServices without TG?

2007-02-20 Thread Bob Ippolito

Er.. elementsoap, of course.

On 2/20/07, Bob Ippolito [EMAIL PROTECTED] wrote:
 With soaplib it looks something like this::

 action = {urn:something}someAction
 request = SoapRequest(action)
 SoapElement(request, login_hash, string, login_hash)
 SoapElement(request, affiliate_id, string, str(affiliate_id))
 SoapElement(request, offer_id, string, str(offer_id))
 SoapElement(request, start_date, string, start_date)
 SoapElement(request, end_date, string, end_date or '')
 SoapElement(request, sub_id, string, sub_id or '')
 SoapElement(request, traffic_type_id, string,
 str(traffic_type_id or ''))
 SoapElement(request, sales_only, boolean,
 sales_only and 'true' or 'false')
 response = self.call(action, request)
 # ... parse out response from the XML

 On 2/20/07, Aaron Bickell [EMAIL PROTECTED] wrote:
 
  If you could share what you had to do in ElementSoap, I can try and
  make that easier to do using soaplib.  The long and short of it is,
  nobody really wants to work with SOAP, but sometimes that's what you
  have to do, and my goal with soaplib was to make SOAP no more painful
  than it has to be.  Your input is appreciated.
 
  Aaron
 
 
 
  On 2/19/07, Bob Ippolito [EMAIL PROTECTED] wrote:
  
   I did look at soaplib. The API for writing clients is really bad, and
   on top of that I couldn't get it to talk to the service in question.
   The API for writing servers looked fine I guess, but I'm not in a
   position to where I'd ever have or want to create a SOAP service.
  
   elementsoap worked great, eventually, but it doesn't really do
   anything for you beyond shorthand for creating the request
   documents which is probably why it worked.
  
   -bob
  
   On 2/19/07, Mark Ramm [EMAIL PROTECTED] wrote:
   
I've been using the new soaplib library in a couple of  projects, and
while I think SOAP sucks, I know that soaplib makes it suck less.
   
With that said, I'd doubt that soaplib would help with either of your
problems, as they seem to have been the result of seriously  broken
soap libraries.  Of course the complexity, ambiguity, and handwaving
of the SOAP spec in various areas pretty much makes writing broken
implementations unavoidable.
   
My point is just that sometimes you have to deal with SOAP, and it
will be a good thing for Python if we have tools that make SOAP less
frustrating and painful.
   
--Mark Ramm
   
 SOAP is a total nightmare. It's the most complicated and least
 efficient way to do anything.

 I think I wasted about 10 hours over the past few days trying to
 figure out how to put together a SOAP client that would talk to a
 poorly implemented SOAP service (written in PHP with NuSoap). Neither
 the documentation or the WSDL file were correct and they didn't
 provide example code in any language!

 I eventually managed to get it to work using elementsoap, after
 failing miserably with ZSI and SOAPpy. I had to hack in dumping of the
 XML back and forth to figure out what was actually happening.

 This is actually the second time I've used SOAP... the first time was
 similarly screwed up -- the service I was talking to was written in C
 and didn't actually use an XML parser (nor was it a correct HTTP
 implementation). Ugh.

 XML-RPC, url encoded variables, JSON, and anything else REST-ish have
 always worked out pretty well for me though.
   

   
  
   
  
 
 
  --
  http://aaronbickell.net/
 
   
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: TGWebServices without TG?

2007-02-19 Thread Bob Ippolito

SOAP is a total nightmare. It's the most complicated and least
efficient way to do anything.

I think I wasted about 10 hours over the past few days trying to
figure out how to put together a SOAP client that would talk to a
poorly implemented SOAP service (written in PHP with NuSoap). Neither
the documentation or the WSDL file were correct and they didn't
provide example code in any language!

I eventually managed to get it to work using elementsoap, after
failing miserably with ZSI and SOAPpy. I had to hack in dumping of the
XML back and forth to figure out what was actually happening.

This is actually the second time I've used SOAP... the first time was
similarly screwed up -- the service I was talking to was written in C
and didn't actually use an XML parser (nor was it a correct HTTP
implementation). Ugh.

XML-RPC, url encoded variables, JSON, and anything else REST-ish have
always worked out pretty well for me though.

-bob

On 2/19/07, Arnar Birgisson [EMAIL PROTECTED] wrote:

 Hi Jonathan,

 Thanks, I'll take a look at that - sounds very promising. I'm
 certainly not a big fan of SOAP myself and I never want to look at
 another WSDL again - they're simply not meant for humans. Soap helps
 though to make interfaces that are very easily used from .NET stuff
 inside the company.

 Very nice post on Elixir btw., hadn't seen that latest one.

 Arnar

 On 2/19/07, Jonathan LaCour [EMAIL PROTECTED] wrote:
 
  Arnar Birgisson wrote:
 
   I know this sounds backwards, but can I use TGWebservices without
   turbogears? In particular can I plug TGWebservices controllers into my
   cherrypy-only project and expect it to work without pulling in the
   whole turbogears stack?
 
  You might want to take a look at the recently open sourced soaplib from
  my employer.  It works great, and is designed to be deployed as a WSGI
  application under any WSGI compliant server, including CherryPy.
 
  You can find soaplib here:
 
   http://trac.optio.webfactional.com/
 
  ...and it can be installed using easy_install.
 
  Best of luck with SOAP :)
 
  --
  Jonathan LaCour
  http://cleverdevil.org
 
 
  
 

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: TGWebServices without TG?

2007-02-19 Thread Bob Ippolito

I did look at soaplib. The API for writing clients is really bad, and
on top of that I couldn't get it to talk to the service in question.
The API for writing servers looked fine I guess, but I'm not in a
position to where I'd ever have or want to create a SOAP service.

elementsoap worked great, eventually, but it doesn't really do
anything for you beyond shorthand for creating the request
documents which is probably why it worked.

-bob

On 2/19/07, Mark Ramm [EMAIL PROTECTED] wrote:

 I've been using the new soaplib library in a couple of  projects, and
 while I think SOAP sucks, I know that soaplib makes it suck less.

 With that said, I'd doubt that soaplib would help with either of your
 problems, as they seem to have been the result of seriously  broken
 soap libraries.  Of course the complexity, ambiguity, and handwaving
 of the SOAP spec in various areas pretty much makes writing broken
 implementations unavoidable.

 My point is just that sometimes you have to deal with SOAP, and it
 will be a good thing for Python if we have tools that make SOAP less
 frustrating and painful.

 --Mark Ramm

  SOAP is a total nightmare. It's the most complicated and least
  efficient way to do anything.
 
  I think I wasted about 10 hours over the past few days trying to
  figure out how to put together a SOAP client that would talk to a
  poorly implemented SOAP service (written in PHP with NuSoap). Neither
  the documentation or the WSDL file were correct and they didn't
  provide example code in any language!
 
  I eventually managed to get it to work using elementsoap, after
  failing miserably with ZSI and SOAPpy. I had to hack in dumping of the
  XML back and forth to figure out what was actually happening.
 
  This is actually the second time I've used SOAP... the first time was
  similarly screwed up -- the service I was talking to was written in C
  and didn't actually use an XML parser (nor was it a correct HTTP
  implementation). Ugh.
 
  XML-RPC, url encoded variables, JSON, and anything else REST-ish have
  always worked out pretty well for me though.

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Non well-formed HTML kid template

2007-02-08 Thread Bob Ippolito

On 2/8/07, venkatbo [EMAIL PROTECTED] wrote:

 Hi all,

 One of the (legacy) apps providing content to my TG-app is
 handing off non well-formed html. I'm unable to get the kid
 template engine to accept the html snippet without runtime
 errors. Following is a sample reflecting some of the violations
 (no closing tags for example):

 ---
 !DOCTYPE html PUBLIC -//W3C//DTD HTML 3.2 Final//EN
  http://www.w3.org/TR/html32.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
   xmlns:py=http://purl.org/kid/ns#; py:extends='master.kid'
   HEAD
 META content=text/html; charset=UTF-8
   http-equiv=content-type py:replace='' /
 TITLENon Well-formed HTML/TITLE
   /HEAD
   BODY

 !-- Non well-formed content from here ... --
 H1Stores/H1
 H2Ratings/H2
 STORES
   DL
 H4Top stores as of: ${now}/H4
 DTA HREF=http://www.amazon.comAmazon/A - Store 1.
 DTA HREF=http://www.circuitcity.comCircuit City/A -
 Store 2.
 P
 DTA HREF=http://www.outpots.comFRY's/A - Store 3.
   /DL
 /STORES
 HR
 H3References:/H3
 OL
   LIA HREF=http://www.cnet.comCNet/A - Reviews.
   LIA HREF=http://www.consumerreports.orgConsumer Reports/A
 - Evals and recos.
 /OL
 !-- ... to here --

   /BODY
 /html
 ---

 I tried all HTML DOCTYPES listed at:
   http://www.htmlhelp.com/tools/validator/doctype.html
 especially HTML 2.0, 3.2 and 4.01. At the controllers, I've specified
 the format as html for the template-including expose() decorator.

 The exception includes, for example:
   ExpatError: not well-formed (invalid token): line 18, column 20
 which is basically that the href urls are not in quotes.

 Does anyone have an idea if its possible to have such ill-formed html
 in a kid template ?

 If not, is tidy (CP filter) the way to go or does one have to use
 regex
 to programmatically clean up all such missing quotes, open-tags-only
 etc.

Try using elementtidy.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: MySQL going to sleep vs Postgresql

2007-02-03 Thread Bob Ippolito

On 2/3/07, iain duncan [EMAIL PROTECTED] wrote:

 Can anyone tell me whether the mysql going to sleep issue also happens
 with postgresql? Or if there are any similar issues for pg?

 I need to deploy a new site on a very tight schedule in the next two
 weeks and the client has a trade show, so it would be A Very Bad Thing
 to have problems keeping the site up. If I cut out some variables by
 using postgresql, I could do the switch, but right now I know mysql a
 lot better.

 I got the cronjob hitting a page technique working with mysql on another
 site, but it rubs me the wrong way. Is it really reliable? Thoughts on
 this issue?

I've never seen any issue like that with PostgreSQL and SQLAlchemy and
TG or Pylons. I've also never used SQLObject and/or MySQL in
production with TG though, so I can't really directly compare them.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Kid bug? And a handy kid trick!

2007-01-29 Thread Bob Ippolito

On 1/29/07, iain duncan [EMAIL PROTECTED] wrote:

 On Mon, 2007-29-01 at 05:54 -0800, Joseph Tate wrote:
 
  iain duncan wrote:
   Hi folks, I found this handy cheat on line to make do without ternary
   operators until py 2.5 is readily available on commodity hosting:
  
   ( answer1, answer2 )[ boolean_condition ]
   - evaluates to answer2 if boolean_condition true, else answer1
 
  I always use (boolean_condition and answer1 or answer2).  I.e. for
  py:attrs={'checked': value==7 and 'checked' or None} for your
  checkboxes.
 
   The = makes kid choke on a bad tag. Seems to me kid should recognize
   that 's inside a py expression should be ignored. Which if does for =
   but *not* =.
  
   The bottom of the traceback I get is:
  
   File /usr/lib/python2.4/site-packages/kid-0.9.3-py2.4.egg/kid/pull.py,
   line 414, in feed
   raise e
   ExpatError: not well-formed (invalid token): line 77, column 81
  
 
  use lt; as your , or reverse the operators and make it so it's
  always doing a greater than operation.  This is even more fun when
  you're dealing with javascript less than operations.

 So if I use lt in the python expression, that gets converted *before*
 the python code runs?

It doesn't get converted... that's just how XML works. Kid templates
are valid XML documents and are parsed as such.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Kid bug? And a handy kid trick!

2007-01-29 Thread Bob Ippolito

On 1/29/07, iain duncan [EMAIL PROTECTED] wrote:


   
use lt; as your , or reverse the operators and make it so it's
always doing a greater than operation.  This is even more fun when
you're dealing with javascript less than operations.
  
   So if I use lt in the python expression, that gets converted *before*
   the python code runs?
 
  It doesn't get converted... that's just how XML works. Kid templates
  are valid XML documents and are parsed as such.
 
  -bob

 Ok, so when we use ?py some code ?, the code can contain those signs,
 but can do no ouput correct?

The semantics for XML processing instructions are different than
attributes. Doesn't really have anything to do with Kid.

 Obviously my understanding of xml parsing was way off, anyone have any
 tips on how they would tackle the original problem then? I want an
 attribute set by a conditional expression from python, preferably
 without having to make a whole conditional tag or element:

 div py:for=thing in things
 my_attrib=pseudocode: x if thing.depth  1 else y 

Personally I'd use thing.depth  1 and x or y, carefully making sure
that x is not False. If it is, you could do something like:
(thing.depth  1 and [x] or [y])[0] which is both short-circuiting
and non-False, just ugly.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: 1.0.1 Status Update

2007-01-21 Thread Bob Ippolito

On 1/20/07, Karl Guertin [EMAIL PROTECTED] wrote:

 On 1/20/07, Bob Ippolito [EMAIL PROTECTED] wrote:
  Pylons and TurboGears are practically the same thing if you're using
  SQLAlchemy, since none of the TG admin tools really do you any good in
  that case.

 I know, but I'm comfortable with TG.

I was too... but I've never liked anything about CherryPy. Pylons
gives me all of the good things about TG (that worked with SQLAlchemy
anyway) and gets rid of the parts I didn't like. I am looking forward
to seeing what happens with the next major revision of TG, but as-is I
don't find TG compelling anymore now.

  The internals to Pylons make more sense to me because it's based on
  lighter weight stuff than CherryPy (paste and WSGI). It's also a
  breeze to debug with EvalException.

 There's an option to enable EvalException debugging in TG by setting
 tg.fancy_exception = True, but the CSS was messed up last I checked.

Yeah, there's a big difference between what Pylons has and what TG
has. Pylons has some little additions to EvalException that make it
quite aesthetically pleasing and easy to use. I didn't have nearly the
same experience w/ the EvalException in TG.

  if the TG admin tools were WSGI based then it could be interchangeable
  just like the Buffet template plugins that both frameworks use now.

 I don't know how closely you've been following the planning, but the
 goal is to get TG split back up into reusable components. Alberto has
 started this with ToscaWidgets. I know a number of people expressed
 interest in developing the FastData module into an independent
 project. I'm interested in doing an admin-type project, but the docs
 for 1.0 need to be finished first.

I try and keep up with the list, but I haven't been paying very close
attention. Sounds like the right direction, though.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: 1.0.1 Status Update

2007-01-20 Thread Bob Ippolito

On 1/20/07, Karl Guertin [EMAIL PROTECTED] wrote:

 On 1/20/07, Randall [EMAIL PROTECTED] wrote:
  It's nice to see TurboGears finally pass the 1.0 milestone.  About the
  same time TurboGears started gathering steam, several other frameworks
  either started up or came to my attention in what looked like a Python
  web framework revolution.

 It pretty much was.


  Looks like Django and Pylons (two that I've evaluated) are moving
  along and nearing 1.0 status.  Anyone have enough experience with these
  other frameworks to say how they compare to TurboGears today?

 I use Django when I can do a project using only admin. I prefer
 SQLAlchemy, Genshi, and TG's returning dictionaries to the Django
 equivalents, so I don't use it otherwise. Pylons is recommended if you
 feel that TurboGears makes too many component choices you disagree
 with. Django has better docs than TG, TG has better docs than Pylons
 (last I checked).

Pylons and TurboGears are practically the same thing if you're using
SQLAlchemy, since none of the TG admin tools really do you any good in
that case.

The internals to Pylons make more sense to me because it's based on
lighter weight stuff than CherryPy (paste and WSGI). It's also a
breeze to debug with EvalException. Pylons pretty much covers all of
the functionality I was looking for, in a more straightforward manner
than TG... but the TG community has a lot more momentum. It would
certainly be interesting to see more cooperation between the two, e.g.
if the TG admin tools were WSGI based then it could be interchangeable
just like the Buffet template plugins that both frameworks use now.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: 1.0.1 Status Update

2007-01-20 Thread Bob Ippolito

On 1/20/07, Joshua J. Kugler [EMAIL PROTECTED] wrote:

 On Saturday 20 January 2007 14:10, Karl Guertin wrote:
  Pylons is recommended if you feel that TurboGears makes too many component
  choices you disagree with.

 How does Pylons compare with some of the convenience features of TurboGears
 such as Catwalk and Model Designer?


Doesn't have them. Neither does TG if you're using SQLAlchemy :)

It does have a really good implementation of EvalException for
debugging, which is a LOT more useful than the model design stuff in
my experience.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: CherryPy - send uppercase http response headers?

2007-01-08 Thread Bob Ippolito


HTTP headers are indeed case insensitive by specification. However, I
have worked on commercial projects in the past where the producers or
consumers of HTTP are embedded devices with firmware written in sloppy
C by people that don't really know what the hell they're doing... and
they're tested by hand against Whatever IIS and IE Do, so of course
the firmware works correctly, it's tested!

I'm talking about code that looks like:
if (!strcmp(header, Content-Type)) { ... }

My guess is that Nick has a similarly horrifying scenario on his hands :)

(The particular device I'm remembering to also had a SOAP
implementation which was even more brain damaged. It of course didn't
use an XML parser or generator anywhere).

-bob

On 1/8/07, Elvelind Grandin [EMAIL PROTECTED] wrote:


HTTP Headers are as far as I know case insensitive. so it's a bug in
the older project. I dont think you can force CP into sending
uppercase headers.

On 1/8/07, Nick Murdoch [EMAIL PROTECTED] wrote:

 Hi,

 For compatibility reasons with an older project, I'm trying to get
 CherryPy to return a header in uppercase, eg:
 X-UPPERCASE-TEST: Hello!

 My code for this looks something like this:
 class Root(controllers.RootController)
   @expose()
   def index(self, *args, **kw):
 cherrypy.response.headers['X-UPPERCASE-TEST'] = 'Hello!'

 My problem is that the header is being returned as Title Case by the
 server, and I'm not sure why:

 $ wget -S http://etc.etc.etc:8080/
 ...
   X-Uppercase-Test: Hello!


 Could anyone suggest what's going on here? I'm I'm truly breaking
 standards here I could switch to using Title Case, but it'd be a pain
 to. I'm using TG 1.0b1

 Thanks and regards,

 Nick Murdoch


 



--
cheers
elvelind grandin





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: TG and pylint

2006-12-20 Thread Bob Ippolito


On 12/20/06, Andreas Kostyrka [EMAIL PROTECTED] wrote:


* Steve Bergman [EMAIL PROTECTED] [061219 17:41]:

 In my opinion, Guido's 80 character line limit hurts readability for no
 good reason. (Even old, narrow, dot matrix printers can handle 96-132
 characters/line.)
Well, 80 characters is kind of a standard for us old Unix-heads.

Working with Windows Python developers, using their all-fancy no-use
IDEs, I've noticed that not one even considers so lowly questions like
what is easy to read. IDE developers tend not to care for line
lengths, nor for nice looking intendation.

Actually, to long lines are bad, not just because of scrolling, but
because they are harder to read for humans.

And to summerize one last thing, some unlucky souls might be forced to
read (and in some crazy situations fix) code on the run. This is
usually more of an admin thing, but it exists. And that can mean a
putty session on a Nokia 9500.


80 character lines are great for coding on a laptop. That leaves
plenty of pixels left to stick a couple terminals/editors/browsers
next to each other. I wouldn't be able to get work done effectively if
all of my code had really long lines. Especially web development where
I generally have a psql prompt, debug console for the web server, one
or two browsers, and then the model/controller/template in a text
editor.

The general tenet is that if your code is longer than 80 chars per
line, you're (probably) trying to do too much in one line. [ObjectiveC
wouldBeTheExceptionHere: becauseItsSelectorsAreRidiculouslyVerbose:],
but Python is (generally) concise.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Strange IE problems with loadJSONDoc

2006-12-19 Thread Bob Ippolito


On 12/20/06, Diez B. Roggisch [EMAIL PROTECTED] wrote:


On Tuesday 19 December 2006 18:28, Christian wrote:
 Diez B. Roggisch wrote:
  While my own experiences with IE are rather limited, I presume that e.g.
  dojo which also adds a cachePrevention parameter does so for a good
  reason.

 My guess is that is just for developers who can't set the proper
 response headers (maybe when pulling data from servers they don't have
 control over?).

Might be, but I've seen far too much trouble concerning caching (especially if
you want it to actually happen for certain content) than not to be thankful
about a solution that just works.

  And the advantage is clearly that you can accidentally forget that header
  tinkering (which might get complicated in presence of apache  possibly
  squid in front of your cherrypy-instance), and it still works.

 I suppose there could potentially be issues with other proxies between
 TG--User Agent.

 Forgetting about adding the response header entries seems about as
 likely as forgetting to add the tg_random parameter to the request.  We
 can easily do something about the response forgetfulness:

If you read my other post about this, you might notice that I patched MochiKit
to do this (configurable) everytime. I'm going to polish that patch a bit
(adding a sequence number to avoid clock-precision issues), maybe it gets
accepted.


I'm not going to accept any patch that changes behavior of the whole
library by setting some variable. It'd have to be a parameter to a
function.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Languages other than python?

2006-12-17 Thread Bob Ippolito

On 12/18/06, Tim Johnson [EMAIL PROTECTED] wrote:

 * Christopher Arndt [EMAIL PROTECTED] [061216 21:43]:
 
  Tim Johnson schrieb:
   Additionally, the co-owner of our little company works in perl.
   (and both of us being naturally lazy - try to avoid javascripting :-))

   Hi:

  My opinion is that you cannot do any serious web programming (using the 
  browser
  as the GUI that is) today, without using JavaScript.

   I agree.

  The good thing is, if you
  use MochiKit, JavaScript feels almost like Python :-)

   That's really good to hear. Furthermore:

   My interest in Turbogears was cultivated by an article in Linux
   Journal. What I liked about the article was that it appeared that
   Turbogears was *not* a black box.

   I see that there is a mochikit module for perl. And if I have
   to use rebol, I'm hoping that I can find a way to use mochikit
   as a resource for rebol too...

MochiKit is a JavaScript library. It doesn't have anything to do with
any other language beyond inspiration for the design of the library.

I think you're confused about how these things work...

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Mochikit IE innerHTML problem

2006-12-17 Thread Bob Ippolito

On 12/18/06, iain duncan [EMAIL PROTECTED] wrote:

 On Mon, 2006-18-12 at 02:10 -0200, Jorge Godoy wrote:
  iain duncan [EMAIL PROTECTED] writes:
 
   I was under the ( possibly mistaken ) impression that the following was
   legal mochikitness:
  
   $(element_id).innerHTML = Foobar;
  
   But it seems to be choking ie ( though I could be wrong there too, as I
   am new to debugging js on ie, oh it's fun! )
  
   Is something wrong with the above? Better way to do that? Works fine on
   firefox.
 
 
  If 'Foobar' fixed and known in advance?  What type of element is 
  element_id?

 Ok, I've established that getting the element is working, it's changing
 it's text child by doing

 .innerHTML = Foobar

 that is not working. In this case, the element in question is an input
 box in a form. On Firefox, I can change the text in the input that way,
 but IE won't let me.

input tags don't have innerHTML, that's why it's not doing anything.

$(input).value = foo;

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Mochikit IE innerHTML problem

2006-12-17 Thread Bob Ippolito

On 12/18/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Every kit needs library functions like

 function setText(node, text) {
 node = $(node);
 clearElement(node);
 node.appendChild(document.createTextNode(text));
 return node;
 };

 function clearElement(node) {
 node = $(node);
 while(node.hasChildNodes  node.hasChildNodes())
 node.removeChild(node.firstChild);
 return node;
 };

 I do not know if MochiKit has functions that perform this, but you
 should use the Approved DOM Method rather than setting innerHTML
 directly (though it seems this ought to work...)

That isn't even relevant to the question, but MochiKit does that just
fine with appendChildNodes and replaceChildNodes. Strings are
automatically converted into text nodes.

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Mochikit IE innerHTML problem

2006-12-17 Thread Bob Ippolito

On 12/18/06, iain duncan [EMAIL PROTECTED] wrote:

   Ok, I've established that getting the element is working, it's changing
   it's text child by doing
  
   .innerHTML = Foobar
  
   that is not working. In this case, the element in question is an input
   box in a form. On Firefox, I can change the text in the input that way,
   but IE won't let me.
 
  input tags don't have innerHTML, that's why it's not doing anything.
 
  $(input).value = foo;

 Thanks Bob, that fixed that problem. Guess I should really be learning
 to use mochikit with all the browsers at the same time and not just
 trying stuff out randomly, Firefox is making me a lazy programmer! :/

s/mochikit/javascript/. This is basic DOM and HTML stuff. innerHTML
means literally what it says. There is no HTML inside an input tag,
they're empty. Why would you expect innerHTML to change the value
attribute?

Not that innerHTML has anything to do with MochiKit anyway. It's not
really used anywhere at all.

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Events, IE and Mozilla...

2006-12-16 Thread Bob Ippolito
On 12/16/06, José de Paula Eufrásio Júnior [EMAIL PROTECTED] wrote:
 So, I guess everybody comes to that someday...

 I did some nice onclick and onchange and onsomething javascript
 functions last night. They work great on Mozilla. IE don't even
 returns an error.

 I started trying to figure out something on the code. Kid converts all
 'onclick o ONCLICK, but on a dummy html file, IE seems to be case
 insensitive (as I said, I started testing everything).
 One thing that didn't work was that in IE, if I put the javascript
 function inside quotes , it doesn't work (at least, the alert
 function don't).
 But Kid doesn't allow me to make a template with
 onclick=function(param), it complains about malformed (x)html (and it
 is, indeed).

 I searched the google oracle and seems that there's a lot more about
 this event business between the browsers, mainly about using
 javascript to setup event handlers instead of using the onclick,
 onstuff. So, if anyone can point me some directions, I would be
 grateful.

This is exactly why MochiKit.Signal exists. Have you looked at it?

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: What do people use for accepting credit cards?

2006-12-14 Thread Bob Ippolito

Most of the payment gateways I've looked at in the past two years
support something text or XML based over HTTPS. Having an Python
specific API available makes it a little easier and/or more obvious,
but it's definitely possible to write your own without that much
hassle. For example. USA ePay uses a simple HTTP POST:
http://www.usaepay.com/topics/api.html

Some gateways require you to use some binary extension module, but
those have a C API that you could at least wrap with something like
Pyrex. I doubt I'd use one of those gateways though.

-bob

On 12/14/06, Ian Wilson [EMAIL PROTECTED] wrote:

 Yeah wow get me on this thread.  I am trying to use Authorize.net.  I
 had to just follow their api docs to connect but it seems to work(at
 least in test mode so far).  I had really no choice because the
 company was already using Authorize.net.  Does paypal have an API you
 could just implement?

 -Ian


 On 12/13/06, vinjvinj [EMAIL PROTECTED] wrote:
 
  I've narrowed it down to trustcommerce and paflow pro from paypal?
  Trustcommerce has a python interface, but I can't find any python
  interface for paypal's offering.
 
  Thanks for your suggestions.
 
  Vineet
 
 
  
 

 


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: sqlalchemy and run_with_transaction

2006-12-13 Thread Bob Ippolito

On 12/7/06, Dennis Muhlestein [EMAIL PROTECTED] wrote:

 This is more of a best practice question:

 I find having the framework manage the database session for you OK  95%
 of the time.  What do you do in the other 5% of the time?

 Example 1:  I have certain credit card processing methods that require
 commits to the database before and after the card is processed.
 Example 2: I have some methods that require no database interaction.
 (So why create a session? .. also.. how much overhead is there in
 creating the session?)

 Anyone have any best practice ideas for situations like this?


I just wrote different controller classes that stuck the right (or no)
db connection in the context for each request. I have one for
read-only, one for read/write, and one that doesn't hit the db at all.
To do this I had to write my own transaction management stuff of
course.

I eventually switched from TG to Pylons for that app, but I'm using
the same strategy with that framework.

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Upload Progress Bar?

2006-12-13 Thread Bob Ippolito

On 12/14/06, Daniel Haus [EMAIL PROTECTED] wrote:


 Ian Charnas schrieb:

  Olli, thanks for writing.  In addition to the link Lee gave you, I
  wanted to mention that I'm almost done with a short HOWTO on how to do
  a really great ajax file-upload with a progress bar using TG. Give me
  two more days and it will be ready!

 Any news on that?


It's probably worth looking at SWFUpload, which does this all client side:
http://labb.dev.mammon.se/swfupload/

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: nl2br after JSON request

2006-11-17 Thread Bob Ippolito

On 11/17/06, Karl Guertin [EMAIL PROTECTED] wrote:

 On 11/17/06, chiangf [EMAIL PROTECTED] wrote:
  Does anyone know how to do this?

 Do it server side and send the text with the br already in place. I
 haven't tried it in JS, but I'd imagine you'd have to at least
 innerHTML the result into the DOM node to get it to process.

The problem with innerHTML is that you have to ensure that it's
escaped correctly... otherwise you might unintentionally cause the
browser to attempt to parse a tag or character entity. If you're
working with text that has newlines in it and not br tags then you
probably aren't dealing with HTML and you shouldn't trivially treat it
as such.

Doing it with DOM is easy enough, though. This function returns an
Array of alternating strings and br tags that you could use with
appendChildNodes or whatnot.

var dom_nl2br = function (str) {
var res = str.split(/\n/);
for (var i = res.length - 1; i  0; i--) {
res.splice(i, 0, BR());
}
return res;
};

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Mixing Dojo in with mochikit and gears

2006-11-16 Thread Bob Ippolito

On 11/16/06, iain duncan [EMAIL PROTECTED] wrote:

 I got it working ok, but I'm curious as to hear what more experienced
 Gears developers think this. Is bringing Dojo in even a good idea or am
 I just going to be forcing people to download too much? I really like
 the mochikit pythonish api and linguistic features, and I wonder if
 maybe I should just build my filterable table out of the sortable table
 already on the mochikit site. Seems like dojo is pretty big, and
 mochikit is already big, and I know it's mochikit I wouldn't want to
 drop. On the other hand, maybe it's stupid not to use their fancy
 widgets that already exist.

 Gah, so many choices. Makes me want to go write pic assembly or
 something.  ; )

You're only going to get a good answer if you state specifically what
you're trying to accomplish. If you just want a filterable table, it's
probably trivial to build one with just MochiKit. However, if it's
easier to do so with Dojo, then maybe you should just use Dojo.

The goal really is to do the least amount work possible, and worry
about the consequences when they matter. Optimizations require very
specific information, and I don't really see enough here to make a
recommendation one way or the other.

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Mixing Dojo in with mochikit and gears

2006-11-16 Thread Bob Ippolito
On 11/16/06, Karl Guertin [EMAIL PROTECTED] wrote:

 On 11/16/06, José de Paula Eufrásio Júnior [EMAIL PROTECTED] wrote:
  my questions are less subtle:
  http://core.eti.br/2006/11/16/turbogears-mysql-and-utf-advice-needed/

 Options:

 * Use SA, it's not THAT much more verbose but the declarations live in
 three places
 * Drop Wordpress and use Postgres
 * Upgrade your virtual machine (I don't know any virtual hosts that
 don't allow upgrades)

   The goal really is to do the least amount work possible, and worry
   about the consequences when they matter. Optimizations require very
   specific information, and I don't really see enough here to make a
   recommendation one way or the other.
 
  On the same line of questioning: it's better to use the new 1.4
  mochikit or the standart TG 1.3 + scriptaculous to get the yummy
  visual effects? Is mochikit 1.4 stable enough?

 The only problem I've had with 1.4 has been with Signal and I'm not
 sure if that was a bug or me mis-reading the docs, so I haven't
 reported it. I use my own effects library but people have been using
 the scriptaculous port for months and I don't remember any issues
 coming up on the list.

You should report it anyway. If you did something wrong, then it might
be something we can fix with better docs.

MochiKit in the trunk is almost always more stable than the past
release. Except for new features, it's all bug fixes. We don't tend to
break things very often.

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Django comparison, was Who are the core TurboGears developers?

2006-11-14 Thread Bob Ippolito

On 11/14/06, iain duncan [EMAIL PROTECTED] wrote:

  Since then however, my impression is that Django is growing faster
  than TurboGears based on the number of subscribers to their mailing
  list and I wonder if that is because they have more people who are
  working on and in the framework full time.

 I would not put much stock in mail list subscribers as indicative of
 what you should use, that is more a result of marketing and initial
 first impression. By that same token we should all go back to PHP, the
 community is massive and their docs are amazing. Easy to learn does not
 necessarily mean powerful. ; )

  And you have to keep in mind that Gears is not one project so there
 exist mailing lists also for SQLObject, SQLAlchemy, Kid, Genshi,
 CherryPy, etc. I have now used both enough to appreciate some strengths
 and differences of each, which really have nothing to do with how well
 marketed the two platforms are.

 At root, I would say ( as does the Django lead, Adrian ) that Gears has
 a more unixy approach, whilst Django is more like a mac. Of course
 Adrian and I differ on which of those is cooler ( and I own a mac
 too!) ; ) Below are my personal opinions, to be taken with much salt.

 Results of Django being an all-in-one package that came from an
 initially closed source application:
 - docs are currently better organized
 - code base is more uniform and cohesive, more tightly integrated
 - initial impression of a new user is going to be better
 - easier to get up and running
 - more narrowly focused to the initial problem field, in this case a CMS
 aimed for high volume relatively low complexity sites where
 non-developers need a good admin, but that admin can be very generic
 - simple text based templating language, great for non coders and
 situations where templating is mostly a presentation *design* issue
 - one mailing list, one dev list, one core dev community ( this has a
 lot of pros and cons, I believe the cons are bigger, YMMV )

 Results of gears being more modular and following the unix style of
 lots of small tools integrated:
 - IMHO a more flexible, cleaner, modular architecture
 - much less group think, therefore much more critical analysis of
 architecture decisions and future directions, at the current expense of
 dev speed
 - much better integration with third party options ( sqlalchemy, other
 template engines, mochikit )
 - harder to use template language that is better for coders doing DOM
 manipulation
 - harder to learn, more scattered docs, more difficult to get going as
 there are more components to wrap your head around
 - appropriate for a much broader problem set, especially for complex
 applications that require a lot of customization. Customizing the Django
 admin is not fun, I tell you! And once you get past what most people
 want to do most of the time, the django docs stop looking so hot.
 - a more open approach to open source development, which I believe to be
 a better long term approach even if it is not as fast moving currently.
 I think the gears approach will attract a larger dev base in the long
 run.

 As someone who will be doing a lot of work with these tools, I'll
 continue learning both, but I will almost certainly do any complex
 application development in Gears. on the other hand, if a friend told me
 they needed to a basic CMS with an admin intergface for a client on a
 cheap budget and they had to learn the framework fast, I'd tell them to
 learn Django ( and then look at gears later). I believe the gears payoff
 to be a bit further down the learning curve, again a lot like linux.
 Once you learn grep and awk and bash and regular expressions, gui's
 start to look like pretty lame ways to get things done. ;)

 My two cents as a recent convert. I'm always interested in hearing
 critical analysis of both sides. ( Though you won't see much of that on
 the Django list, frankly. )

It's probably also worth mentioning Pylons, which pretty much does the
same thing as TurboGears, but does a better job at being unixy. I've
been playing with both Pylons and TurboGears lately, and I definitely
have to say that Pylons really gives TG a run for its money.

The big pros are:

1. WSGI, not CherryPy. Easy to plug in or write middleware, easier to
get to the metal.
2. Routes, not CherryPy. Far better control over URL dispatch.
3. Their customized EvalException integration is *awesome*. Debugging
is terribly easy, and it's easy on the eyes (unlike raw EvalException,
which is ugly and less usable).
4. A public directory that covers the whole webroot rather than /static.
5. Easier to add stdvars, just stick them in project.lib.helpers

The things that TurboGears does better, in my experience:

1. Unicode. Pylons doesn't really touch it, but it's easy to code
something up that deals with decoding the request params (or
cut+paste). I'm sure they'll fix this soon though.
2. DB integration. Pylons doesn't really have any, but it's really
easy to write your own. 

[TurboGears] Re: Wiki 20 tutorial rewrite completed, comments appreciated

2006-11-13 Thread Bob Ippolito

On 11/11/06, Karl Guertin [EMAIL PROTECTED] wrote:

 After two months worth of comments, I've rewritten the 20 minute wiki 
 tutorial.

 http://docs.turbogears.org/1.0/Wiki20/Page1

 The primary enhancement is that I've added contextual lines in the
 examples, which will hopefully reduce the confusion over where to
 insert stuff.

 Since nobody is going to get through a written tutorial in 20 minutes,
 I've taken the opportunity to expand the explanations to provide some
 background information and links to places where you can find more
 information on topics the tutorial glosses over. I've tried to take
 special care to explain more exotic Python constructs to language
 newcomers, as we do seem to be getting a number trying to work through
 the tutorial.

 Finally, I've modified the ajax portion to use MochiKit's connect()
 functionality to demonstrate proper technique. Remember folks, setting
 onclick attributes is not good style and killing my open in new tab
 middle click annoys me greatly.

The only real comment I have is that the $(...) stuff is superfluous,
and could easily be confused with Kid's ${}. You almost never need to
use $() unless you're directly screwing with the DOM. Everything that
takes DOM objects should take a string identifier, and connect is no
exception.

Also, e.preventDefault() is probably better said as e.stop().
Normally when you do preventDefault you also want stopPropagation, and
that's what stop does. Though it shouldn't make a difference in this
case.

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Dictionaries and kid

2006-11-11 Thread Bob Ippolito

On 11/11/06, iain duncan [EMAIL PROTECTED] wrote:

 When we send stuff to kid, it gets them as a dictionary. What if we want
 to send a dictionary in the dictionary? I am able to get kid to
 dereferrence the first level ok,

 ie, the items in the cart are themselves dictionaries, with the name as
 the key.

 for item in cart.item
 ${item}   -- key name of my sub dictionary,
 ${item['quant']}   -- error
 ${item.quant}   -- error

 Is there a way to have nested dictionaries passed to kid or will I need
 to redesign the container?

That doesn't have anything to do with kid, but how dictionaries work.
Iterating over a dictionary gives you its keys. If you want the (key,
value) pairs then use for key, value in cart.item.iteritems().

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Dictionaries and kid

2006-11-11 Thread Bob Ippolito

On 11/11/06, iain duncan [EMAIL PROTECTED] wrote:

 On Sat, 2006-11-11 at 16:38 -0800, Bob Ippolito wrote:
  On 11/11/06, iain duncan [EMAIL PROTECTED] wrote:
  
   When we send stuff to kid, it gets them as a dictionary. What if we want
   to send a dictionary in the dictionary? I am able to get kid to
   dereferrence the first level ok,
  
   ie, the items in the cart are themselves dictionaries, with the name as
   the key.
  
   for item in cart.item
   ${item}   -- key name of my sub dictionary,
   ${item['quant']}   -- error
   ${item.quant}   -- error
  
   Is there a way to have nested dictionaries passed to kid or will I need
   to redesign the container?
 
  That doesn't have anything to do with kid, but how dictionaries work.
  Iterating over a dictionary gives you its keys. If you want the (key,
  value) pairs then use for key, value in cart.item.iteritems().

 Ah, because in kid, I'm iterating in Python ( which I should have
 known!) I will confess my head has been spinning when switching between
 js and python and js turned pythony. :/

Well, JavaScript iterates over objects the exact same way that Python
iterates over dicts ;)

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Dictionaries and kid

2006-11-11 Thread Bob Ippolito

On 11/11/06, iain duncan [EMAIL PROTECTED] wrote:


 
  Well, JavaScript iterates over objects the exact same way that Python
  iterates over dicts ;)

 Does that mean that if you want to use ajax to keep essentially mirrors
 of your object on the server and the client end, a python dictionary is
 the best way to go? Sub class a dictionary?

That's pretty much irrelevant. Subclassing dict is generally a bad idea though.

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: JSON and SQLObject

2006-11-08 Thread Bob Ippolito

On 11/8/06, Jason Chu [EMAIL PROTECTED] wrote:
 On Tue, 07 Nov 2006 22:55:29 -0800
 iain duncan [EMAIL PROTECTED] wrote:

 
  On Wed, 2006-08-11 at 02:43 -0400, Jorge Vargas wrote:
   On 11/7/06, chiangf [EMAIL PROTECTED] wrote:
   
   
My question is whether there is any way to access myfk.secondname
from javascript?
   
   you could also write a jsonify rule (see json.py) that will make
   your myTable objects fetch this info but be aware of what your doing
   because you may be pulling out half your db if there is a big join
 
  Could one use mochikits logging facilities to check on how much is
  being passed via JSON?
 
  I love that logger Bob! =)
 
  Iain

 If you're using firefox, I'd check out firebug
 (http://www.joehewitt.com/software/firebug/).  It lets you inspect
 XMLHttpRequests.


It's also a console for MochiKit.Logging, and provides an interactive
JS interpreter among other things.

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: New Project: Turbogears or Djano?

2006-11-07 Thread Bob Ippolito

On 11/7/06, Lee McFadden [EMAIL PROTECTED] wrote:

 On 11/6/06, iain duncan [EMAIL PROTECTED] wrote:
 
  Some thoughts of my own, open for comment:
 
 8 *snip* 8

  - Django docs are very good, better right now than gears. I had some
  inexcusable problems with the gears tutorials because things are out of
  sync. I know Kevin said that is a major concern and is being addressed.
  At the moment, I think the initial experience of trying both out is
  going to favour Django. Of course the initial experience of linux vs mac
  ( a comparison Adrian made ) favours macs, but now that I have put in
  the time to really learn linux, I much prefer the *nix interoperability
  approach.

 Documentation is definately where we are lagging and there is a lot of
 work going into making the docs better.  There is a lot of work to do,
 but we will get there in the end.  Doc sprints are in the works and
 anyone in the community can also contribute their own documentation
 and comments at http://docs.turbogears.org/

 
  If there were a url mapper on CherryPy and even some decent scaffolding
  aimed at the end user for both SQLObject and SQLAlchemy admin
  interfaces, I think I would do all my work in gears. Anyone know if
  these are in the works?
 

 CherryPy 3 has the ability to use arbitary url mappers (or
 'dispatchers') which should be available in TG 1.1 making the use of
 Routes et al a breeze.  In fact, there's already a RoutesDispatcher
 included with CP3 :)

 Using CP2's `default` method you can build your own mappers or use
 something like Routes[1].  Granted, it's a little more difficult than
 it should be at times to get everything in Routes working with CP2
 (since I last used it...  please correct me if this is no longer the
 case), but it is possible with a little work.

 With regards to the scaffolding for SO and SA - FastData (currently in
 Alpha and also due in 1.1 i believe) will be the scaffolding that
 you're talking about.  So, once 1.1 is out you should have everything
 you need and wish for in TG. :)

 [1]: http://routes.groovie.org/

If you don't want to use CherryPy crap you might as well pick
something like Pylons. I recently converted a SQLAlchemy+Genshi+TG
project to SQLAlchemy+Genshi+Pylons and it actually ended up being a
bit less code.

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Starting gears, genshi, sqlalchemy

2006-11-07 Thread Bob Ippolito

On 11/7/06, iain duncan [EMAIL PROTECTED] wrote:


  Anyway, support for what we have now -- SO + Kid -- is better tested and
  adapted to TG.  But you shouldn't find any shortcomings with SA + Genshi.

 Ok. I'll stick with kid for now.

Migrating from Kid to Genshi is trivial anyway. You pretty much just
change the filename and the namespace declaration and you're done.
Genshi is just a better implementation of the same thing (and then
some).

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Doing threading 'properly'

2006-11-05 Thread Bob Ippolito

On 11/5/06, Ben Sizer [EMAIL PROTECTED] wrote:

 Jorge Godoy wrote:
  Ben Sizer [EMAIL PROTECTED] writes:
 
   You were probably clear, but I don't know much about the detail of
   database transactions and so on. But even if I drop down to the
   database level and make the update directly, can I be sure that the
   correct values propagated up to SQLObject in the other threads?
 
  In a standard TG application, the way it is designed in 1.0+ you should be
  safe on every exposed method.  It starts a transaction that reads data from
  the DB.
 
  I believe that the only way you'll guarantee that it works for you is 
  writing
  a small test case.  One thread modifies data and the other reads it.

 It's not really possible to use test cases for synchronisation problems
 though. They might work 1 times in testing and then fail the
 10001st time when the instruction interleaving differs slightly, due to
 the system load being higher, or some cache being more or less full,
 etc.

 If you know which methods are synchronised and which ones aren't, then
 it's possible to prove whether it will always work or not.
 Unfortunately I don't have this sort of information and I was hoping
 someone here would.

Audit the source then. See what kind of locking it tries to do.

The safest thing to do of course is to only send immutable objects
across threads, or deep copies of mutable objects (message passing).
Pretty hard to screw that up.

-bob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Startup/restart time

2006-11-02 Thread Bob Ippolito

On 11/2/06, Jorge Godoy [EMAIL PROTECTED] wrote:

 Tim Lesher [EMAIL PROTECTED] writes:

  Would anyone object to a patch to implement this?

 Having a fallback (the current behavior) for non-optimized OSs and then
 having this optimization would be nice...  But, again, it will only solve
 things for development and probably only if you use just a few external tools.

 Having a good perfomance on production is more worth spending time than saving
 seconds of development...  (Yes, I understand that in 300 restarts it can save
 you 5 minutes... :-P)


I dunno about that. As long as production performance is good enough,
I'd rather just get the development done faster. I could spend all
that extra time optimizing when I actually need to!

Development speed and ease of use is also very important to selling
TurboGears.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: jsonify javascript references

2006-11-02 Thread Bob Ippolito

On 11/2/06, Diez B. Roggisch [EMAIL PROTECTED] wrote:

 Hi,

 I'm trying to build a nice widget-wrapper around the YUI-component lib.
 Things are nice and smooth except for one thing: the components can get
 effects as arguments, basically a constructor and some arguments.

 Now this is what the generated JS looks like:

 resizepanelwin = new YAHOO.widget.Panel(resizepanelwin,
 {visible: false,
   effect: {duration: 0.25, effect:
 YAHOO.widget.ContainerEffect.FADE},
 constraintoviewport: true,
 draggable: true, width: 23em,
 modal: false, close: true,
 underlay: none, fixedcenter: true} );


 as you can see, the effect.effect is a string. Yet it should be rendered
 without quotes, so that the eval will evaluate it to the
 constructor/callable.

 Any suggestion on how to make that happen?

You don't, that's not JSON. You need to process it in JavaScript to
get the objects you want.

result.effect.effect = eval(result.effect.effect);

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: jsonify javascript references

2006-11-02 Thread Bob Ippolito

On 11/2/06, Diez B. Roggisch [EMAIL PROTECTED] wrote:

 Bob Ippolito schrieb:
  On 11/2/06, Diez B. Roggisch [EMAIL PROTECTED] wrote:
  Hi,
 
  I'm trying to build a nice widget-wrapper around the YUI-component lib.
  Things are nice and smooth except for one thing: the components can get
  effects as arguments, basically a constructor and some arguments.
 
  Now this is what the generated JS looks like:
 
  resizepanelwin = new YAHOO.widget.Panel(resizepanelwin,
  {visible: false,
effect: {duration: 0.25, effect:
  YAHOO.widget.ContainerEffect.FADE},
  constraintoviewport: true,
  draggable: true, width: 23em,
  modal: false, close: true,
  underlay: none, fixedcenter: true} );
 
 
  as you can see, the effect.effect is a string. Yet it should be rendered
  without quotes, so that the eval will evaluate it to the
  constructor/callable.
 
  Any suggestion on how to make that happen?
 
  You don't, that's not JSON. You need to process it in JavaScript to
  get the objects you want.
 
  result.effect.effect = eval(result.effect.effect);

 Okay. I can use that. However, because I didn't think of that
 possibility, I dug into the simplejson code and introduced a
 JSLiteral-class that can wrap a string to simply pass it through without
 encoding.

 I do like that better than your proposed solution for a simple reason:
 it's simpler :)

 Now - your comment implies that JSON is specfied in a certain way, which
 doesn't allow for this. Ok. But I think that I have a real usecase here.
 Especially when there are situations where one can't control the
 javascript that will use the JSON-output (which I'm capable of, in this
 case, but other cases one can't), it might save one from larger troubles.

That's simply ridiculous. If the script expects JSON, then it isn't
going to require things that are impossible with JSON!

 Are you adamant about not putting it into simplejson?

There is absolutely no way I will add features to simplejson that
encourage people to produce documents that are not valid JSON.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: modifying cherrypy.response.headers

2006-11-02 Thread Bob Ippolito

On 11/2/06, evan [EMAIL PROTECTED] wrote:

 Hi All,

 From previous posts it would appear that to modify the response headers
 all I should have to do is to import cherrypy and to set the
 cherrypy.response.headers dictionary.  But when I attempt to do that I
 get the following:

 cherrypy.response.headers['Cache-Control'] = 'max-age=120'
 TypeError: object does not support item assignment

cherrypy.response.headerMap['Cache-Control'] = 'max-age=120'

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: last chance for PyCon talks!

2006-10-31 Thread Bob Ippolito

On 10/30/06, Kevin Dangoor [EMAIL PROTECTED] wrote:

 Tomorrow (Halloween) is that last day to submit talk proposals for
 PyCon 2007 (in Dallas)! It's a great event, and I'd certainly
 recommend it. Good crowd to hang around with lots of smart people who
 know all kinds of stuff. You won't believe the things you learn just
 by being in the same room as Bob Ippolito. Or Phillip Eby. Or Ian
 Bicking. If we're lucky, the elusive but wonderfully prolific Mike
 Bayer might be in attendance. So, hopefully some folks will propose
 talks, but it would be good for you to at least be there!


Actually I'm not sure I'll be at PyCon 07. Not a huge fan of the new
venue and I haven't submitted any proposals this year.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: how to retrieve cherrypy REQUEST informations

2006-10-30 Thread Bob Ippolito

On 10/30/06, Jose Soares [EMAIL PROTECTED] wrote:

 I would like to know how to retrieve the cherrypy informations like
 the query_string of url, the server_url, the authenticated_user,
 cookies, etc.
 Something like the Zope REQUEST.

Googling for cherrypy request would've answered your question.

http://docs.cherrypy.org/api-reference#request

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Preventing simultaneous database access from replicated TG servers

2006-10-30 Thread Bob Ippolito

On 10/30/06, Stuart Clarke [EMAIL PROTECTED] wrote:

 On Mon, 2006-10-30 at 22:26 -0300, Jorge Godoy wrote:
  Stuart Clarke [EMAIL PROTECTED] writes:
 
   I have a script which accesses the DB, and which can be started in the
   background from my TG web application (The script also uses my app's
   model).  I want to prevent this script from being simultaneously
   executed more than once.  Problem is, the web app may be replicated
   across a number of load-balanced servers.  So, what mechanism can I use
   to prevent simultaneous execution.  The only things shared by my
   replicated apps would be the DB server, and memcached.
 
  Use a table with a flag.  Check that before starting and if it's there, 
  abort
  the execution.  If it's not, then start your operation by setting the flag 
  so
  that no other instance of the script can be run.

 *** The test-and-set operation isn't atomic though, is it?  Which still
 leaves the door (slightly) open for simultaneous executions.

 Might be the best possible solution, however.

It depends on how your DB works and what your workers are supposed to do.

For example:

[A] BEGIN;
[B] BEGIN;
[A] SELECT locked FROM locktable; (false)
[A] UPDATE locktable SET locked='t';
[B] SELECT locked FROM locktable; (false)
[B] UPDATE locktable SET locked='t'; (BLOCKED)
[A] -- Do some work
[A] UPDATE locktable SET locked='f';
[A] COMMIT;
[B] -- locked is set to 't' because B is no longer blocked
[B] -- Do some work
[B] COMMIT;

The work ends up done twice, because [B] can not know that the lock
was ever acquired. It does see a consistent view of the database
though, because it had to wait for the row lock to be released by [A]
before it has a chance to do its update. Which view of the database it
sees depends on the isolation level though.

If you want [B] to fail you need to use two transactions. One to
acquire the lock, one to do the work. You also need to use a locking
select or they'll *both* succeed in updating the lock table and bad
things will happen.

[A] BEGIN;
[B] BEGIN;
[A] SELECT locked FROM locktable FOR UPDATE; (false)
[B] SELECT locked FROM locktable FOR UPDATE; (BLOCKED)
[A] UPDATE locktable SET locked='t';
[A] COMMIT;
[B] -- SELECT returns 't' so we can bail here
[B] COMMIT;
[A] BEGIN;
[A] -- Do work
[A] UPDATE locktable SET locked='f';
[A] COMMIT;

Using something other than a boolean in there can make sense so you
can track which process performed the lock and when, so you can
force-release the lock eventually. [A] might not have completed the
transaction.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: kid drives me crazy

2006-10-28 Thread Bob Ippolito

On 10/28/06, Christoph Zwerschke [EMAIL PROTECTED] wrote:

 Michael Steinfeld wrote:
  so if I was to do something like
 
  import calendar, itertools
 
  month = calendar.monthcalendar(2006, 10)
  days =  [i for i in itertools.chain(*month)]

 You don't need to build a list here; simply pass the iterator.


and if you were to build a flattened list from an iterator of
iterators, the sane way would be much different..

month = calendar.monthcalendar(2006, 10)
days = [day for week in month for day in week]

or imperatively:

month = calendar.monthcalendar(2006, 10)
days = []
for week in month:
days.extend(week)

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: MochiKit and CallLater

2006-10-27 Thread Bob Ippolito

On 10/27/06, percious [EMAIL PROTECTED] wrote:

 Sorry.  I probably posted this too early.  I got it figured out.  You
 need to send CallLater a function pointer, not func()

JavaScript doesn't have macros, so a literal function call is *never*
the right thing to do if the computation should be deferred in some
way.

I find it interesting that MANY people expect that magically
callLater(0.5, foo()) should perform foo() after 0.5 seconds, even
though that this behavior doesn't happen in ANY other common language
or framework that I've seen.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: File upload - how to get filename?

2006-10-27 Thread Bob Ippolito

On 10/27/06, Robin Haswell [EMAIL PROTECTED] wrote:

 I need to get the filename of an uploaded file from CherryPy. I can't
 write this to a different (known) file because I don't seem to be able
 to get a filename out of os.tmpfile(). I need the filename to pass to
 pysqlite2 - I'm uploading sqlite databases which need to be read. If
 anyone can let me know how to get the filename of an uploaded file (I
 assume it's some temp file), or any other solution to my problem, it
 would be very much appreciated.

 I don't really want my own method of generating temp filenames - I'd
 prefer to leave symlink attack prevention to the professionals.


The temporary files created during file uploads
(tempfile.TemporaryFile instances) do not have names on all platforms,
you will have to create a new file and copy the data into it.

You can get a named temporary file out of the tempfile module
(tempfile.NamedTemporaryFile).

Something like this probably would work::

def upload_form(self, formfile):
import tempfile
import shutil
from pysqlite2 import dbapi2 as sqlite

newfile = tempfile.NamedTemporaryFile()
shutil.copyfileobj(formfile.file, newfile)
newfile.flush()
con = sqlite.connect(newfile.name)

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: kid drives me crazy

2006-10-27 Thread Bob Ippolito

On 10/27/06, Michael Steinfeld [EMAIL PROTECTED] wrote:
 Duh, right after I clicked send I saw the mistake. don't need to put quotes
 around '0' and it works.

In other words, it helps to pose the question correctly if you want to
get correct suggestions!

 however it screws up my layout but I don't know why it screw up my table
 cells. Argh.. !! kid is a pain, I don't know Geshi, but hopefully it won't
 hurt as much.

Genshi wouldn't really be much different in this case. You just need
to understand how DOM-based templating is supposed to work. One bonus
is that your output HTML will be much cleaner (because it has to be,
in order to be a valid template). Ideally you should modernize the
rest of it (use css and classes instead of old school bgcolor, align,
etc.)

This should be a literal translation, which is ugly, but would be much
less ugly using classes:

td py:for=day in days py:attrs=day and {'bgcolor': '#29558D',
'align': 'middle'} or {'bgcolor': '#ee'}
a class=links href=day.py?day=${day} py:if=day${day}/a
/td

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: MySQL or Postgres for a production site?

2006-10-20 Thread Bob Ippolito

On 10/20/06, Adam Jones [EMAIL PROTECTED] wrote:


 Chris Cioffi wrote:
  Hello all,
 
  I'm designing a site for some clients and I'm wondering if MySQL or
  Postgres would be more desirable.
 
  The site, as far as they've decided so far, will be transaction
  oriented and contain financial data.  They are expecting 1000
  concurrent users, possibly more, over time.

 Mark has a good point about using tg-admin sql create to make the
 database. You can always get the generated sql code and hand modify it
 for the install. It should work without further input after that.

 
  This will be a brand new site so there aren't any legacy issues right now.
 
  I'm more familiar with MySQL but I'm leaning towards Postgres b/c it
  has better transaction support and b/c I'm going to start using Trac
  (which seems to prefer Postgres over MySQL.)

 Are you planning on using Trac on the same systems as this site? If not
 I would suggest spending a little time playing with Postgres before you
 commit to it. (insert bad transaction/commit/rollback pun here)
 Administering a Postgres system is significantly different from working
 with MySQL. If the issues Trac has with MySQL are not showstoppers I
 think you can probably get MySQL to do what you want here with less
 fuss since you already know it.

Trac also doesn't need either, it works fine with SQLite most of the time.

In my experience, PostgreSQL is a lot easier to develop for and is far
more reliable than MySQL.

However, it's not as easy to administer and tune for performance (but
I've definitely seen it outperform MySQL when tuned properly, but
that's highly application dependent). It's also not as straightforward
to replicate. In general I would lean towards what you know how to
use... if you use MySQL for a large production site and you don't know
what you're doing, you *will* screw it up. Same thing for PostgreSQL.
Caveat emptor.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Python DB-API 2.0 instead of SQLObject/SQLAlchemy

2006-10-19 Thread Bob Ippolito

On 10/19/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 I would like to be able to use SQLObject or SQLAlchemy for my tg
 project, but since my older database, Sybase 9, is only accessible
 through mxODBC, I do not think I have much choice.

 What do I have to worry about in creating custom model classes so that
 eveything else in the tg stack just works, like widgets, etc.

 Do I just need to implement an SQLObject like interface for each of my
 model classes since they are typically derived from the SQLObject class
 anyway?  I would do this just using normal python DB-API calls.  I know
 it's not as fancy as the ORM tools, but if its all I got, its all I
 got.

SQLObject supports some version of Sybase. You should probably look
into making that work with Sybase 9 instead of writing a half-baked
clone of SQLObject's functionality.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Data for globalization

2006-10-18 Thread Bob Ippolito

If the project is free, then you don't need money to pay for the
server. There's plenty of places that will host open source software
for free such as Google Code, SourceForge, etc...

-bob

On 10/17/06, GinTon [EMAIL PROTECTED] wrote:

 I'll follow your advices although I'll have to thinking how earn some
 money to pay the sever.

 Thanks Jorge!


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: [Slightly OT] Installing Python/Postgresql/etc on Mac OSX

2006-10-12 Thread Bob Ippolito

On 10/12/06, Rune Hansen [EMAIL PROTECTED] wrote:


 On 12. okt. 2006, at 02.22, [EMAIL PROTECTED] wrote:

 
  I recently got a Mac Pro and I'm a little confused on the best way to
  install Open Source apps. I'm used to using Ports on FreeBSD and
  Synaptic/Apt on Ubuntu. Because of this, I'm thinking of using
  MacPorts
  to install Python instead of MacPython. I like the idea of
  installing/updating all my OS apps through a central repository.
 
  However, two things give me pause.
  1) I read
  http://www.mail-archive.com/pythonmac-sig@python.org/msg05879.html
  where it was implied that the MacPorts version of Python was not
  Mac-ish enough? Being a beginner with a Mac, I don't know what that
  even means. I'm guessing it has to do with how the build integrated
  with the OS. Also, MacPython is linked on the official Python site.
  2) I'm not sure about the quality and up-to-date-ness of the MacPorts,
  uh, Ports. I trust FreeBSD Ports and Ubuntu's repos because of the
  scrutiny they're under.
 
  So if anyone could give me some pros and cons that would be great. If
  they're pretty much equivalent i'll go with MacPorts since I can
  install everything through it. Python/Apache2/Postgresql/etc.

 I've gone through every conceivable python configuration on OS X and
 I've settled (for the last year or so) on the official .dmg packaged
 python.
 The one thing you need to be aware of is that you must make sure that
 python packages which installs scripts to /path/to/some/bin really
 installs to /usr/local/bin - either that or add /Library/
 Frameworks/Python.framework/Versions/Current/bin to your $PATH.

The installer adds that to your $PATH by default.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: SA sends sql queries to stdout while in production mode

2006-10-10 Thread Bob Ippolito

On 10/10/06, Jorge Godoy [EMAIL PROTECTED] wrote:

 Gary Doades [EMAIL PROTECTED] writes:

  Ah, I had to set sqlalchemy.echo = False and that seemed to cure the 
  problem.

  0 is False
 False
  False is False
 True
 

 That makes sense. ;-)

Well is tests for object identity. It's strange that the
configuration file cares either way though, traditionally anything
that coerces to False should be fine (e.g. empty list, empty string,
None, 0, 0.0).

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: How can I know each computer from another with CP and TG?

2006-10-08 Thread Bob Ippolito

MAC addresses don't leave the LAN.

You have two exactly three options:
1. Stick all of the state in the URL (or a session ID).
2. Keep all of your state (or a session id) in forms and make sure
that every link is a form submit (using GET instead of POST would be
an ugly variant of 1).
3. Stick state or a session id in a cookie.

Pick one. There aren't any other options.

-bob

On 10/8/06, Adam Jones [EMAIL PROTECTED] wrote:

 If one of the project's preconditions is disallowing cookies the only
 other options I can think of are getting the MAC address, having your
 location as an option when signing in, or moving the location to tabs
 inside the program.

 The MAC address solution would be ... interesting. It might be doable
 with a cherrypy filter right when the request is received. The problem
 is that a lot of networks use proxy servers or NAT routers. In either
 of those cases different systems on the network would be
 indistinguishable from each other.

 My suggestion would be to just use a cookie, at the least just to store
 previous computer/location selections.

 -Adam


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Root object created twice? Incomprehensible ...

2006-10-06 Thread Bob Ippolito

On 10/6/06, Steve Holden [EMAIL PROTECTED] wrote:

 I'm hacking away at a first TG application, and I have a controllers.py
 (in a web created with tg-admin quickstart) that looks like this:

 import turbogears
 from turbogears import controllers
 from mimetypes import guess_type
 import os
 import HomePage, \
 Courses, CourseAll, CourseByCity, CourseByNum, CourseCtForm,
 CourseNmForm, CourseShop, CourseShow, \
 DeptHome, DeptLinks, DeptStart, DeptPg, \
 UserEntry

 imdict = {}
 txdict = {}

 class Root(controllers.RootController, HomePage.Home):

  AllCourses = CourseAll.Page()
  Course = CourseShow.Page()
  CourseCity = CourseCtForm.Page()
  CourseByCity = CourseByCity.Page()
  CourseNum = CourseNmForm.Page()
  CourseByNum = CourseByNum.Page()
  CourseStart = Courses.Page()
  DeptStart = DeptStart.Page()
  DeptHome = DeptHome.Page()
  DeptPgPage = DeptPg.Page()
  DeptLinks = DeptLinks.Page()
  NewAccount = UserEntry.Page()
  CourseEnroll = CourseShop.Enroll()
  CourseWaitList = CourseShop.WtLst()
  CourseViewCart = CourseShop.VwCrt()
  CourseDelBook = CourseShop.DlBk()

  def __init__(self):
  print About to initialise the Web.Page ...
  HomePage.Home.__init__(self)

 The print statement went in because I noticed that some messages
 appeared to be duplicated when I started the server. I then modified the
 head of the HomePage module to print out a few details, as it appeared
 to be running twice. It now starts like this:

 print IMPORTING HomePage as , __name__
 import sys, threading
 print Actiev threads:, threading.activeCount()
 if sys.modules['__main__'].importcount 0 : raise NotImplementedError
 sys.modules['__main__'].importcount += 1

 The start program has only had a statement

 importcount = 0


 inserted. Now when I start up my app I see the following:

 C:\Steve\Projects\gspython start-gs.py
 IMPORTING HomePage as  HomePage
 Actiev threads: 1
 IMPORTING Dept
 IMPORTING DeptStart
 About to initialise the Web.Page ...
 IMPORTING HomePage as  HomePage
 Actiev threads: 1
 IMPORTING Dept
 IMPORTING DeptStart
 About to initialise the Web.Page ...
 2006-10-06 17:14:42,977 cherrypy.msg INFO CONFIG: Server parameters:

 So, my question is, how come the HomePage module (along with various
 others) is being executed twice? When I hit CTRL/C to terminate the
 server I also see

 2006-10-06 17:15:40,930 cherrypy.msg INFO ENGINE: Ctrl-C hit: shutting
 down au
 toreloader
 2006-10-06 17:15:40,940 cherrypy.msg INFO HTTP: HTTP Server shut down
 2006-10-06 17:15:40,950 cherrypy.msg INFO ENGINE: CherryPy shut down
 2006-10-06 17:15:41,171 cherrypy.msg INFO ENGINE: Ctrl-C hit: shutting
 down au
 toreloader
 2006-10-06 17:15:41,171 cherrypy.msg INFO HTTP: HTTP Server shut down
 2006-10-06 17:15:41,181 cherrypy.msg INFO ENGINE: CherryPy shut down

 What gives?

The autoreloader starts your app in a subprocess, so it can kill it
and then start it up again.

You're just looking at interleaved output between two different
processes that have both imported your module. Only one of them is
going to actually use it with CherryPy though.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: TurboMail 1.0 released!

2006-10-06 Thread Bob Ippolito

On 10/6/06, Matthew Bevan [EMAIL PROTECTED] wrote:


 Very nice! I look forward to using it. Does it work on both 2.3 and
 2.4?

 I have not tested it in 2.3.  After doing a quick browse through the PQR
 looking for differences related to TurboMail, I can find no reason that it
 wouldn't work in 2.3.  I am unsure, however, if creating classes as
 descendants of object is new in 2.4.

object has been there since 2.2

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: To genshi or not to ...

2006-10-05 Thread Bob Ippolito

On 10/5/06, venkatbo [EMAIL PROTECTED] wrote:

 Have been getting familiarized with TG 1.0b1 for a while now,
 creating kid templates etc... 'am ready to start creating a
 real TG-based app...

 Would you recommend I switch to genshi and write all my
 templates using it or write them as kid templates now, but
 switch later...

I've been playing with Genshi and I haven't noticed any issues at
all... except it's easier to debug when my templates are broken ;)

I'm not sure how well Genshi integrates with all of the widget stuff.
I'm not using any of that.

 If yes to genshi, any idea when it would be included as a
 part of TG

You don't really need it to be part of TG... if it's installed, then
you can use it without any real trouble at all since the Genshi egg is
also a template plugin. To make it default all you have to do is set
this in your config/app.cfg:

tg.defaultview = genshi

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: install problems mac os x power pc

2006-10-04 Thread Bob Ippolito

Click customize when you install Xcode. Look to see if the universal
SDK is checked. I bet it's not. There's nothing wrong with Python on
any machine I've tried it on, but I always make sure I install the
correct set of Xcode packages.

-bob

On 10/3/06, Michael Steinfeld [EMAIL PROTECTED] wrote:

 no. this was a clean install entirely. I installed Xcode right off my
 developer disks that apple sends me everymonth. There was nothing
 botched about anything I did. In fact if you google around a bit,
 other people seem to have this same issue.

 On 10/3/06, Bob Ippolito [EMAIL PROTECTED] wrote:
 
  Sounds like you didn't install the Xcode universal SDK. You need that
  in order to compile software with the binary distros of Python. I
  think it's installed by default these days, but you may have turned it
  off.
 
  -bob
 
  On 10/3/06, Michael Steinfeld [EMAIL PROTECTED] wrote:
  
   Of course I have Xcode installed. Here is an update to the problem and
   it is not unique to me. If anyone else has problems with Apples later
   patches ...
  
   Apples latest Tiger update breaks something, what, I am not exactly
   sure. In order to get Turbogears installed, on OS X 10.4.7+ Do not use
   the python binary pkg. You MUST compile python from source. Then TG
   will install smoothly.
   Took me awhile to figure this out, but after compiling from source
   everything was perfect.
  
  
   If I get some time later this week I will post the problem if I can 
   discover it.
  
   On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
   
Hi...
   
Michael Steinfeld wrote:
 Processing RuleDispatch-0.5a0.dev-r2115.tar.gz
 Running RuleDispatch-0.5a0.dev-r2115/setup.py -q bdist_egg --dist-dir
 /tmp/easy_install-mweWH6/RuleDispatch-0.5a0.dev-r2115/egg-dist-tmp-BmbmrC
 gcc: installation problem, cannot exec 'i686-apple-darwin8-gcc-4.0.0':
 No such file or directory
Some of the packages need a C-Compiler.
You have to go to http://developer.apple.com first and get XCode.
XCode 2.4 is the newest at the moment.
It contains the gcc 4 compiler.
   
   

   
  
  
   --
   -mike
  
   
  
 
  
 


 --
 -mike

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: install problems mac os x power pc

2006-10-03 Thread Bob Ippolito

Sounds like you didn't install the Xcode universal SDK. You need that
in order to compile software with the binary distros of Python. I
think it's installed by default these days, but you may have turned it
off.

-bob

On 10/3/06, Michael Steinfeld [EMAIL PROTECTED] wrote:

 Of course I have Xcode installed. Here is an update to the problem and
 it is not unique to me. If anyone else has problems with Apples later
 patches ...

 Apples latest Tiger update breaks something, what, I am not exactly
 sure. In order to get Turbogears installed, on OS X 10.4.7+ Do not use
 the python binary pkg. You MUST compile python from source. Then TG
 will install smoothly.
 Took me awhile to figure this out, but after compiling from source
 everything was perfect.


 If I get some time later this week I will post the problem if I can discover 
 it.

 On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
  Hi...
 
  Michael Steinfeld wrote:
   Processing RuleDispatch-0.5a0.dev-r2115.tar.gz
   Running RuleDispatch-0.5a0.dev-r2115/setup.py -q bdist_egg --dist-dir
   /tmp/easy_install-mweWH6/RuleDispatch-0.5a0.dev-r2115/egg-dist-tmp-BmbmrC
   gcc: installation problem, cannot exec 'i686-apple-darwin8-gcc-4.0.0':
   No such file or directory
  Some of the packages need a C-Compiler.
  You have to go to http://developer.apple.com first and get XCode.
  XCode 2.4 is the newest at the moment.
  It contains the gcc 4 compiler.
 
 
  
 


 --
 -mike

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Scalability

2006-10-02 Thread Bob Ippolito

On 10/2/06, Stuart Clarke [EMAIL PROTECTED] wrote:

 Thanks for the reply Kevin...

   I want to ask some questions, however, about scalability.  I'm
   developing a web system (the pages of which will be customised on a
   per-user basis), that may grow to be quite popular.  I need to
   implement this, such that it's horizontally scalable in an indefinite
   manner.
  
   OK, so web server replication and load balancing is easy.  My problem
   is with the DB.  I can find several good-looking master-slave DB
   replicators (Slony for PG, for example), but I can't find a suitable
   load-balancing mechanism, especially one that integrates with
   SQLObject
   or SQLAlchemy.
 
  I'm not sure what you mean here. In what way is the ORM involved with
  the database replication? Do you mean from the standpoint of having
  some collection of web servers talk to some specifically collection
  of database servers?

 *** As I see it, there are two problems in using a distributed
 master-slave arrangement for the DB: replication (i.e. mirroring data
 from the master to the slaves) and load balancing (i.e. balancing the
 DB-read load across the slaves).

 Replication is handled by tools such as Slony.  What I need from the ORM
 (or whatever) is a mechanism for load balancing.  I need to be able to
 say: here's my master server (for writing) and here is my list of slave
 servers (for reading).  Please balance the system load appropriately,
 across these servers.  Or I need a hook where I can insert code of my
 own to do this.

 I have a sneaking suspicion that it might be possible in SQLAlchemy, but
 I don't think it will integrate out of the box with TG's Identity
 implementation.

 Plus, I would like to do it in SQLObject, so I can have Catwalk.

 Any suggestions?

Why don't you do load balancing at the DB layer with pgpool or something?

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Scalability

2006-10-02 Thread Bob Ippolito

On 10/2/06, Stuart Clarke [EMAIL PROTECTED] wrote:

 On Mon, 2006-10-02 at 10:04 -0700, Bob Ippolito wrote:
  On 10/2/06, Stuart Clarke [EMAIL PROTECTED] wrote:
  
   Thanks for the reply Kevin...
  
 I want to ask some questions, however, about scalability.  I'm
 developing a web system (the pages of which will be customised on a
 per-user basis), that may grow to be quite popular.  I need to
 implement this, such that it's horizontally scalable in an indefinite
 manner.

 OK, so web server replication and load balancing is easy.  My problem
 is with the DB.  I can find several good-looking master-slave DB
 replicators (Slony for PG, for example), but I can't find a suitable
 load-balancing mechanism, especially one that integrates with
 SQLObject
 or SQLAlchemy.
   
I'm not sure what you mean here. In what way is the ORM involved with
the database replication? Do you mean from the standpoint of having
some collection of web servers talk to some specifically collection
of database servers?
  
   *** As I see it, there are two problems in using a distributed
   master-slave arrangement for the DB: replication (i.e. mirroring data
   from the master to the slaves) and load balancing (i.e. balancing the
   DB-read load across the slaves).
  
   Replication is handled by tools such as Slony.  What I need from the ORM
   (or whatever) is a mechanism for load balancing.  I need to be able to
   say: here's my master server (for writing) and here is my list of slave
   servers (for reading).  Please balance the system load appropriately,
   across these servers.  Or I need a hook where I can insert code of my
   own to do this.
  
   I have a sneaking suspicion that it might be possible in SQLAlchemy, but
   I don't think it will integrate out of the box with TG's Identity
   implementation.
  
   Plus, I would like to do it in SQLObject, so I can have Catwalk.
  
   Any suggestions?
 
  Why don't you do load balancing at the DB layer with pgpool or something?

 *** pgpool is limited to one master, and one slave.  It's scalability is
 therefore quite limited.

 I haven't found any general-purpose tools which can provide unlimited
 (say, 20 slaves) scalability for either MySQL or PostgreSQL.  Does
 anyone know of one?

Well, you only want one master... at least for any of the free
PostgreSQL replication solutions. I always partition my usage between
read-only and read-write connections, so it's rather easy to make that
work.

I'd take a look at SQLRelay, at least until pgpool-II is out.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Scalability

2006-10-02 Thread Bob Ippolito

On 10/2/06, Stuart Clarke [EMAIL PROTECTED] wrote:

 On Mon, 2006-10-02 at 10:45 -0700, Bob Ippolito wrote:
  On 10/2/06, Stuart Clarke [EMAIL PROTECTED] wrote:
  
   On Mon, 2006-10-02 at 10:04 -0700, Bob Ippolito wrote:
On 10/2/06, Stuart Clarke [EMAIL PROTECTED] wrote:

 Thanks for the reply Kevin...

   I want to ask some questions, however, about scalability.  I'm
   developing a web system (the pages of which will be customised on 
   a
   per-user basis), that may grow to be quite popular.  I need to
   implement this, such that it's horizontally scalable in an 
   indefinite
   manner.
  
   OK, so web server replication and load balancing is easy.  My 
   problem
   is with the DB.  I can find several good-looking master-slave DB
   replicators (Slony for PG, for example), but I can't find a 
   suitable
   load-balancing mechanism, especially one that integrates with
   SQLObject
   or SQLAlchemy.
 
  I'm not sure what you mean here. In what way is the ORM involved 
  with
  the database replication? Do you mean from the standpoint of having
  some collection of web servers talk to some specifically collection
  of database servers?

 *** As I see it, there are two problems in using a distributed
 master-slave arrangement for the DB: replication (i.e. mirroring data
 from the master to the slaves) and load balancing (i.e. balancing the
 DB-read load across the slaves).

 Replication is handled by tools such as Slony.  What I need from the 
 ORM
 (or whatever) is a mechanism for load balancing.  I need to be able to
 say: here's my master server (for writing) and here is my list of 
 slave
 servers (for reading).  Please balance the system load appropriately,
 across these servers.  Or I need a hook where I can insert code of my
 own to do this.

 I have a sneaking suspicion that it might be possible in SQLAlchemy, 
 but
 I don't think it will integrate out of the box with TG's Identity
 implementation.

 Plus, I would like to do it in SQLObject, so I can have Catwalk.

 Any suggestions?
   
Why don't you do load balancing at the DB layer with pgpool or 
something?
  
   *** pgpool is limited to one master, and one slave.  It's scalability is
   therefore quite limited.
  
   I haven't found any general-purpose tools which can provide unlimited
   (say, 20 slaves) scalability for either MySQL or PostgreSQL.  Does
   anyone know of one?
 
  Well, you only want one master... at least for any of the free
  PostgreSQL replication solutions. I always partition my usage between
  read-only and read-write connections, so it's rather easy to make that
  work.

 *** I'm happy with only one master, and I also wish to partition my
 usage between read-only and read-write connections.  I want to do that,
 however, within a single Turbogears application.  Is this what you do?
 Can you provide some hints on how to do it?  Also, do you know of a way
 to pool your read-only connections to a number of slaves, thereby
 distributing the load (within either SO or SA)?

I'm not currently using any ORM, so using different SA engines for
different queries is trivial. I'm also not currently distributing
among several slaves, but if I had to I would use something like SQL
Relay rather than trying to shove load balancing into my model.

 SQL Relay seems capable of load-balancing across a number of read-only
 DBs.  And it has a drop-in replacement API for PostgreSQL.  It doesn't
 distinguish between master and slaves, however, and so can't
 automatically manage the difference between reading and writing.  Also,
 SQL Relay load-balances on a per-connection basis, which run contrary to
 Turbo Gears' persistent-connection architecture.  Which sucks.  Have you
 any experience with using SQL Relay under Turbo Gears?

The reason you load balance is so that you get better concurrency. For
serial requests one database is going to do just as well (if not
better due to cache effects) than a pool. The way TG and SQL Relay
would interact is fine, because you get different connections for each
thread in the TG pool. Concurrent queries will be sent to different
servers (at the discretion of SQL Relay of course), so load balancing
still does exactly what it's supposed to.

No, I'm not currently using SQL Relay with TurboGears. I might if I
had to scale like that, though I haven't done all of the research to
definitively say that it's the load balancing solution I'd choose.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Scalability

2006-10-02 Thread Bob Ippolito

On 10/2/06, Stuart Clarke [EMAIL PROTECTED] wrote:

 On Mon, 2006-10-02 at 12:19 -0700, Bob Ippolito wrote:
  On 10/2/06, Stuart Clarke [EMAIL PROTECTED] wrote:
  
   On Mon, 2006-10-02 at 10:45 -0700, Bob Ippolito wrote:
On 10/2/06, Stuart Clarke [EMAIL PROTECTED] wrote:

 On Mon, 2006-10-02 at 10:04 -0700, Bob Ippolito wrote:
  On 10/2/06, Stuart Clarke [EMAIL PROTECTED] wrote:
  
   Thanks for the reply Kevin...
  
 I want to ask some questions, however, about scalability.  I'm
 developing a web system (the pages of which will be 
 customised on a
 per-user basis), that may grow to be quite popular.  I need to
 implement this, such that it's horizontally scalable in an 
 indefinite
 manner.

 OK, so web server replication and load balancing is easy.  My 
 problem
 is with the DB.  I can find several good-looking master-slave 
 DB
 replicators (Slony for PG, for example), but I can't find a 
 suitable
 load-balancing mechanism, especially one that integrates with
 SQLObject
 or SQLAlchemy.
   
I'm not sure what you mean here. In what way is the ORM 
involved with
the database replication? Do you mean from the standpoint of 
having
some collection of web servers talk to some specifically 
collection
of database servers?
  
   *** As I see it, there are two problems in using a distributed
   master-slave arrangement for the DB: replication (i.e. mirroring 
   data
   from the master to the slaves) and load balancing (i.e. balancing 
   the
   DB-read load across the slaves).
  
   Replication is handled by tools such as Slony.  What I need from 
   the ORM
   (or whatever) is a mechanism for load balancing.  I need to be 
   able to
   say: here's my master server (for writing) and here is my list of 
   slave
   servers (for reading).  Please balance the system load 
   appropriately,
   across these servers.  Or I need a hook where I can insert code 
   of my
   own to do this.
  
   I have a sneaking suspicion that it might be possible in 
   SQLAlchemy, but
   I don't think it will integrate out of the box with TG's Identity
   implementation.
  
   Plus, I would like to do it in SQLObject, so I can have Catwalk.
  
   Any suggestions?
 
  Why don't you do load balancing at the DB layer with pgpool or 
  something?

 *** pgpool is limited to one master, and one slave.  It's scalability 
 is
 therefore quite limited.

 I haven't found any general-purpose tools which can provide unlimited
 (say, 20 slaves) scalability for either MySQL or PostgreSQL.  Does
 anyone know of one?
   
Well, you only want one master... at least for any of the free
PostgreSQL replication solutions. I always partition my usage between
read-only and read-write connections, so it's rather easy to make that
work.
  
   *** I'm happy with only one master, and I also wish to partition my
   usage between read-only and read-write connections.  I want to do that,
   however, within a single Turbogears application.  Is this what you do?
   Can you provide some hints on how to do it?  Also, do you know of a way
   to pool your read-only connections to a number of slaves, thereby
   distributing the load (within either SO or SA)?
 
  I'm not currently using any ORM, so using different SA engines for
  different queries is trivial. I'm also not currently distributing
  among several slaves, but if I had to I would use something like SQL
  Relay rather than trying to shove load balancing into my model.
 
   SQL Relay seems capable of load-balancing across a number of read-only
   DBs.  And it has a drop-in replacement API for PostgreSQL.  It doesn't
   distinguish between master and slaves, however, and so can't
   automatically manage the difference between reading and writing.  Also,
   SQL Relay load-balances on a per-connection basis, which run contrary to
   Turbo Gears' persistent-connection architecture.  Which sucks.  Have you
   any experience with using SQL Relay under Turbo Gears?
 
  The reason you load balance is so that you get better concurrency. For
  serial requests one database is going to do just as well (if not
  better due to cache effects) than a pool. The way TG and SQL Relay
  would interact is fine, because you get different connections for each
  thread in the TG pool. Concurrent queries will be sent to different
  servers (at the discretion of SQL Relay of course), so load balancing
  still does exactly what it's supposed to.

 I'm not so sure that TG and SQL Relay would play nice with each other.
 AFAIK, SA and SO maintain (within the context of TG) connection pools to
 the DB.  Now, these connections can be created

[TurboGears] Re: Lighttpd as a simple proxy to TG

2006-09-27 Thread Bob Ippolito

On 8/26/06, Damjan [EMAIL PROTECTED] wrote:

 As I said, it's only serving static content, there is no application.
 And lighttpd only uses mod_alias, mod_access, mod_accesslog.

 My point was that the memory leak is not in the core of lighttpd but in
 some of it's modules. Since there is a choice which module to use to
 connect to WSGI applications, we should see what modules have leaks.

mod_proxy definitely leaks. When I attempted to deploy lighttpd, that
was the *only* module I was using (no static content even) and it
leaked memory like a sieve.

nginx does not leak at all (at least for proxy, fcgi, rewrite, static
content). The config language is simpler, and it also uses less memory
and CPU than anything else I've tried (and this is at a load of  500
req/sec at times).

I don't think scgi is a choice with nginx at the moment, but fcgi and
proxying definitely are.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Toolbox breaks in 1.0b1

2006-09-25 Thread Bob Ippolito

On 9/25/06, Jorge Vargas [EMAIL PROTECTED] wrote:

 On 9/25/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
  There is already a ticket for this bug. See
  http://www.mail-archive.com/turbogears-tickets@googlegroups.com/msg01958.html
  .
 
  A possible workaround is to use an other browser for the toolbox.
 
 Did I miss something? there is no browser here or in the ticket could
 you post your finding of browser issues to the ticket?
 http://trac.turbogears.org/turbogears/ticket/1089

There's only one set of cookies per browser per domain. The toolbox
session cookie probably gets stomped on when you login. Sessions suck.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: HTTP line length limit in Firefox

2006-09-18 Thread Bob Ippolito

On 9/18/06, John J Lee [EMAIL PROTECTED] wrote:

 On Mon, 18 Sep 2006, Arnar Birgisson wrote:
 [...]
  I have firefox failing on the following whenever length = 4096:
 
  @expose(json)
  def test(self, len):
 return 'x'*int(len)
 
  FF is failing in a weird manner, loadJSONDoc returns nothing, and if I
  load the url in a new tab it's as if the text is rendered with a white
  font (!).
 
  The HTTP RFC doesn't mention any length limitation and all Safari and
  IE both accept anything like this.

 I doubt this has anything to do with HTTP per se -- surely this has much
 more to do with XMLHttpRequest and the Firefox DOM than HTTP.

 IIRC Firefox creates DOM text nodes with a length limit of around that
 size (4k), instead of creating really big text nodes.  I'm not sure
 exactly what you're doing with your JSON, but perhaps that's the root
 cause of the problem.  If not, then, well... something similar ;-)

Well XHR doesn't fail on 4k+ documents, so it's gotta be a client-side
problem somewhere else. Nothing can be done about this automatically
on the server side because the JSON spec doesn't allow for that kind
of chunking.

Perhaps there's a limitation in firefox's eval() implementation that
only allows for ~4k string tokens? If that's the case, you might be
able to get away with a pure-JavaScript JSON parser, but it'd be
extremely slow.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Mac x86 install problems

2006-09-14 Thread Bob Ippolito

On 9/14/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Has anyone installed Turbogears 1.0b on a Mac x86? I have no problems
 on PPC but no luck on x86 version


Works fine here with universal python 2.4.3. You should probably
mention what problems you had and which Python installation you're
using.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Mac x86 install problems

2006-09-14 Thread Bob Ippolito

On 9/14/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Python 2.4.3  First I had a problem with SQL Object MySQL driver so I
 reloaded. Now I'm getting gcc not found ( Ihave the latest Xcode) when
 trying to load the RuleDispatch


If you're getting GCC not found, you definitely do not have the latest
Xcode installed.

Some of the packages are available in universal binary form here:
http://pythonmac.org/packages/py24-fat/

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Lighttpd as a simple proxy to TG

2006-08-24 Thread Bob Ippolito

One problem with Lighty is that it leaks memory like a sieve [1]. I
audited it for a little bit and I gave up, it's a mess. I'd steer
clear of it, it will quickly ruin your day if you throw a lot of
traffic at it.

The only solution I know of that's extremely high performance that
offers all of the features that you want is nginx [2], but its
documentation is largely in Russian. I can't read Russian, but I was
able to figure it out (the configuration language isn't Russian,
neither is C source). I currently have nginx doing reverse proxy of
over tens of millions of HTTP requests per day (thats a few hundred
per second) on a *single server*. At peak load it uses about 15MB RAM
and 10% CPU on my particular configuration (FreeBSD 6).

Under the same kind of load, apache falls over (after using 1000 or so
processes and god knows how much RAM), pound falls over (too many
threads, and using 400MB+ of RAM for all the thread stacks), and
lighty *leaks* more than 20MB per hour (and uses more CPU, but not
significantly more).

[1] http://trac.lighttpd.net/trac/ticket/758
[2] http://sysoev.ru/en/

-bob

On 8/24/06, venkatbo [EMAIL PROTECTED] wrote:

 Thanks Cliff, for your observations.

 Basically, I needed to provide support for:
   -  HTTP/1.1
   -  SSL (openssl)
   -  (Fast)CGI
   -  chroot()
   -  sessions
   -  static content

 I thought lighty would be providing all except the sessions part,
 which I was hoping to make it disk/file-based. The # of simultaneous
 users will be in the 20's. Initially no db invloved (data coming from
 other backend apps), but may have a db later.

 /venkat


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Web Frameworks Watch: CleverHarold

2006-08-22 Thread Bob Ippolito

On 8/22/06, Karl Guertin [EMAIL PROTECTED] wrote:

 http://www.cleverharold.org/

 CleverHarold is a WSGI framework stack similar to Pylons under
 development by Troy Melhase. Its main claim to fame is that the
 application running in the framework requires no imports from the
 framework (so it works in unit tests, non-web stuff, etc). Publishing
 is handled completely through the wsgi stack, which in turn is
 configured by an ini file. The project makes heavy use of Ian
 Bicking's Paste and provides a look at one possible future for TG.

 Publishing: Object/callable, a-la CherryPy
 Templating: Kid (at the moment), Cheetah second class
 ORM: SQLAlchemy recommended, but no framework ties at all
 Auth: Planned for 0.2, barrel middleware currently recommended

 I mention this here because I follow both Planet Python and this list
 fairly carefully and I hadn't seen it mentioned. I figure it would be
 of interest to others who follow this list.

Maybe nobody cares because it's GPL?

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Web Frameworks Watch: CleverHarold

2006-08-22 Thread Bob Ippolito

On 8/22/06, Jorge Godoy [EMAIL PROTECTED] wrote:

 Damjan [EMAIL PROTECTED] writes:

  You sound as if GPL is evil?

 When it forces you to release your code under the same license it gets a lot
 complicated to maintain your business running unless you always have very
 specific projects.

If it were an appropriate license for libraries, people would use it
as such. Approximately zero other python web libraries are of GPL-like
license to my knowledge. It's a pretty hostile license for a library,
especially when it's against the spirit of everything else it builds
upon (which are mostly MIT-style licensed projects).

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: js options - required input

2006-08-15 Thread Bob Ippolito

To be fair, the right answer is that it really depends on what you
want to do. You shouldn't pick a toolkit before you have a use for it.

-bob

On 8/15/06, samuraisam [EMAIL PROTECTED] wrote:

 MochiKit - mucho pythonic.

 Dojo - mucho... javathonic.

 Prototype - mucho... poor implementation.

 -Sam


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: javascript interpreter

2006-08-06 Thread Bob Ippolito
On Aug 6, 2006, at 7:37 PM, Jorge Vargas wrote:On 8/6/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Is there some way to write some _javascript_ without using a browser,that is, to help me prototype before putting it in a web page?I think I have seen at least one standalone interpreter but cant remenber it's name. but the biggest problem with that will be the same as with plain _javascript_, it works so diferently across all browser that you have to test it in all of them.There are three commonly seen standalone _javascript_ interpreters: Rhino, SpiderMonkey, and JScript. Rhino is Java-based, SpiderMonkey is the same implementation used by Firefox, and JScript is Microsoft's implementation.In the scripts directory of the MochiKit source, there's a copy of Rhino and bootstrap scripts to run a subset of the tests with all three.-bob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups TurboGears group.  To post to this group, send email to turbogears@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/turbogears  -~--~~~~--~~--~--~---



[TurboGears] Re: Comet (aka long lived http connections) Ajax in turbogears

2006-07-02 Thread Bob Ippolito


On Jul 2, 2006, at 2:29 PM, Bram Vandoren wrote:

 Thanks for the answers. I took the twisted aproach because I already
 had some experience with it. I don't use Nevow/Athena but instead use
 Kid, Mochikit and turbojson.

 Arnar Birgisson wrote:
 I'm a bit new to this comet stuff - would I assign each client an ID
 and tag the messages for them specifically (perhaps some messages
 could be tagged for multple or all connected clients) with that ID?
 What if the queue contains a message with a client-id that's not
 connected? Discard the message? Or wait for the client to connect?

 How did the OP (Bran Vandoren) picture this?

 This is how I did it:
 Mochikit opens a connection to the Twisted server. If the 'version' of
 the game map on the client is lower then the one on the server it
 returns an update (JSON) immediately. If it's lower it waits  1 minute
 before returning an answer. If the version of the game map is  
 increased
 in the meantime, the twisted returns the answer immediately. Mochikit
 opens a new connection as soon as it received the previous answer from
 the server.

 It would be great to see these capabilities come to TurboGears with an
 easy to use interface. Especially changing the DOM tree/CSS properties
 directly from within python would be nice (and in the other direction:
 calling python functions from within javascript, off course).

Doing that with CherryPy should be awfully easy. Just time.sleep(60)  
before sending the answer, each connection has a thread.

However, it's not going to scale very well. You really need a server  
that multiplexes connections if you're going to have long-lived ones.  
Sleeping threads still eat up a large chunk of RAM.

-bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: KID got error while process javascript operator

2006-05-07 Thread Bob Ippolito


On May 7, 2006, at 6:07 AM, Robin Haswell wrote:



 Using comments to wrap something that you want to keep in the  
 document
 is a bad idea.  Sure, it might happen to work with Kid, but I still
 wouldn't do it or recommend it.

 That technique has been recommended for JS since day 1. It's the  
 standard way of hiding JS from
 non-javascript-aware browser. You wrap it in a comment so if your  
 user agent doesn't understand JS,
 it doesn't go printing it everywhere.

It's not standard practice for XML.  Standard practice for XML is to  
use CDATA.  Comments in XML are comments and shouldn't carry anything  
meaningful and shouldn't really be expected to survive some kind of  
document transform.

Either way, I highly doubt any browsers (or other HTML parsing  
software) still exist that have a problem ignoring script tags --  
they've been with us for *over ten years*.  Day 1 was a hell of a  
long time ago.

-bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: KID got error while process javascript operator

2006-05-06 Thread Bob Ippolito


On May 6, 2006, at 2:41 AM, Alberto Valverde wrote:



 On 06/05/2006, at 3:19, Wenjie He wrote:

 Anybody have occur such situation?
 While using javascript operator  in KID template,
 KID can't parse template to html, and raise
 ExpatError: not well-formed (invalid token)

 How can I do a logic and operation in a kid template, instead?

 Changing  to amp;amp should do the trick.

Alternatively, keep your JavaScript out of the template. You really  
shouldn't put anything dynamic in there anyway.

-bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: KID got error while process javascript operator

2006-05-06 Thread Bob Ippolito
On May 6, 2006, at 4:19 PM, David Stanek wrote:On 5/6/06, Robin Haswell [EMAIL PROTECTED] wrote: Nah _javascript_ is fine in templates. All you need to do is place it in !-- -- comments fornon-_javascript_-aware browsers. That includes Kid.I usually use XML comments to hide my _javascript_. It seems like a more natural solution than ![CDATA  ]]. On the other hand, I agree with Bob. Putting your _javascript_ into a .js file is a better solution for _javascript_ that is not dynamically created. Using comments to wrap something that you want to keep in the document is a bad idea.  Sure, it might happen to work with Kid, but I still wouldn't do it or recommend it.-bob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups TurboGears group.  To post to this group, send email to turbogears@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/turbogears  -~--~~~~--~~--~--~---



[TurboGears] Re: Theory: an XML Model library, styled after SQLObject

2006-05-01 Thread Bob Ippolito


On May 1, 2006, at 10:28 AM, Adam Jones wrote:


 I guess the problem I have with this is that normally I get XML from
 someone else, I build databases myself. In that I know exactly what  
 the
 spec is for the database, and unlike XML the absence of data in a
 database column does not also remove it from my schema example. That
 said this would be very useful for authoring.

 What I would like to see is something that can make working with
 existing XML easier. I would like to be able to point some code at an
 xml file and give it an xpath query in exchange for some objects
 representing the result, and use the class' attributes to access/ 
 change
 values from the file.

That's more or less what ElementTree gives you, and you already have  
it if you are using TurboGears since Kid depends on it.

-bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: scriptaculous + mochikit = pain

2006-04-27 Thread Bob Ippolito


On Apr 27, 2006, at 7:55 AM, Karl Guertin wrote:


 On 4/26/06, Mark Ramm [EMAIL PROTECTED] wrote:
 And I keep hearing rumors that Python scripting is comming soon to a
 mozilla browser near you.

 Note that that Python scripting does not mean client area scripting,
 it means chrome level scripting. It'll be a boon if you're developing
 firefox extensions or XUL apps, but I haven't heard anything about
 python making it into the client area.

It'd be a security disaster if it did end up accessible by client  
area scripting, with CPython anyway.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: SQLObject rant: unicode support sucks

2006-04-27 Thread Bob Ippolito


On Apr 27, 2006, at 2:45 PM, Tim Lesher wrote:


 On 4/27/06, Baruch [EMAIL PROTECTED] wrote:
 I still feel that SQLObject is not doing the obvious thing here, it
 should use the UTF-16 encoding from the start especially when it has
 this comment for UnicodeCol: Note: parameters in queries will not be
 automatically encoded, so if you do a query matching a UnicodeCol
 column you must apply the encoding yourself. This will bite the  
 ass of
 anyone who naively uses UnicodeCol's and thinks that his queries will
 just work properly.

 This is just conjecture, but on most Python distributions, the
 internal representation for a ufoo is UTF-8, so that's probably why
 SQLObject defaults to it.

Uh, no.  Totally wrong.  Exactly zero Python representations use  
UTF-8 internally.  They either use UCS-2 or UCS-4.

The reason for the SQLObject default is that UTF-8 is the most likely  
unicode codec for unicode data coming to and from databases (and also  
network traffic).  I know PostgreSQL deals in UTF-8, and I'd guess  
that MySQL is the same.

-bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: SQLObject rant: unicode support sucks

2006-04-27 Thread Bob Ippolito


On Apr 27, 2006, at 7:09 PM, Kevin Dangoor wrote:


 On 4/27/06, Jorge Godoy [EMAIL PROTECTED] wrote:
 test_unicode=# select * from test_unicode_table;
  id | test_column
 +-
   1 | áéíóú
   2 | áéíóú
   3 | áéíóú
   4 | áéíóú
   5 | áéíóú
   6 | áéíóú
 (6 registros)

 Do those characters require more than 1 byte for UTF-8 encoding?

Yeah...

  len(unicodedata.normalize('NFC', u'\xe1\xe9\xed\xf3\xfa').encode 
('utf-8'))
10
  len(unicodedata.normalize('NFD', u'\xe1\xe9\xed\xf3\xfa').encode 
('utf-8'))
15

-bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Is Identity too much? I think so.

2006-04-23 Thread Bob Ippolito
On Apr 23, 2006, at 8:44 AM, Jeff Watkins wrote:On 23 Apr, 2006, at 11:26 am, Alberto Valverde wrote:Also I should note that you don't *need* to undersand how they work in order to *use* them.On the other hand, if you need to understand the code that uses them, you'll NEVER actually know what the code does unless you understand EVERY instance of the generic function. It's impossible to look at the following code any actually know what it does:@generic()def flip_the_frobble(obj):	pass...def clever_function(obj):	flip_the_frobble(obj)What does clever_function actually do? It's impossible to tell, because you have no idea what versions of the generic flip_the_frobble have been created.When languages like C++ offer function overloading, they do it via type inspection. So you can very clearly understand whether the function will be invoked. However, generic functions have no such limitations. I've heard lots of arguments touting that generic functions increase the flexibility of code, and that's certainly true. However, no one has every cited an example that can only be achieved using generic functions. I've yet to hear an explanation similar to: "I've been looking for a way to flip my frobbles for ages, and thanks to generic functions, I now can!"Most generic function instances use a type or identity check as the predicate.  Even with just plain type checking in languages like C++ you can get lost with deep hierarchies where a function matches a class exactly but also one or more of its superclasses.There ARE use cases that are best solved by generic functions (or a poor re-implementation of them):"I've been looking for a flexible way to have a library that can be extended by users, preferably without using adaptation, yet another type registry, or monkey-patching."There are of course no self-contained use cases that are best done with generic functions, but TG needs to offer extensibility to its users without them having to maintain their own fork.-bob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups TurboGears group.  To post to this group, send email to turbogears@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/turbogears  -~--~~~~--~~--~--~---



[TurboGears] Re: [mochikit]How to add onclick attr to DOM?

2006-04-20 Thread Bob Ippolito


On Apr 20, 2006, at 1:34 AM, Henotii wrote:


 I just follow the doc of mochikit, and use A({href:#}, test) to
 add element successful.
 But it seems can't work with A({onclick:test_func()}, test).
 The output html just like this atest/a, and without the onclick.

 Is there something wrong? And how can I add attr like onclick when
 using MochiKit. The mochikit's doc is not very clear in this.

It should work if you use::

 A({onclick: test_func}, test)

-bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Explain the implications of implicit transactions

2006-04-11 Thread Bob Ippolito


On Apr 11, 2006, at 6:50 PM, Kevin Dangoor wrote:

 On 4/11/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I ought to pass object identifiers around for page to page rather  
 than
 object themselves, then re-get the object from the database within  
 the
 next page's code. Is this a correct observation, a necessary pattern?

 I actually think that this is more an observation about use of
 sessions than the implicit transactions. Generally speaking, implicit
 transactions do what you really want to happen anyhow.

 There are no guarantees about putting an SQLObject (or other kind of
 persistent object) into a session. Most persistent objects have some
 kind of association with the connection they were created from. From
 request to request, you can't count on that being the same connection.

 Hanging on to the object id is a good solution, imho.

I don't know the specifics of how sessions work in TG, but there's no  
technical reason you couldn't put SQLObjects in a session correctly  
if sessions were treated kinda like a pickle store.  The session- 
serialization for a SQLObject would simply be a reference to the  
class and the object's id.  When you pull it out of the session from  
some other request, it would simply resurrect that object using the  
current connection.

Personally I prefer the explicit by-identifier way and try and keep  
the state on the client instead of in a session (for a lot of  
reasons) but there's nothing inherently dangerous about the pattern  
that the user tried first (if the pieces fit together properly).

-bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Open Question: Turbogears and scaling...

2006-03-17 Thread Bob Ippolito


On Mar 17, 2006, at 3:17 PM, Robin Haswell wrote:



 my time has a cost and optimisation often buys less performance  
 than,
 say, a Dell SC1425
 Unfortunatly my time is not worth a IBM 64way mainframe (or I  
 would be
 one happy hacker). Bigger machines help but as my comment said before
 this will give you only linear optimization at some point you will  
 need
 _exponential_ optmizaitions. This also depends on the complexity  
 of the
 data relationships that your application needs. You need a machine  
 that
 is 64 times faster buy

 Nah mate you miss my point! Not bigger machines, *more* machines. A  
 Dell
 SC1425 is a pretty low-end piece of kit, the idea is you use multiple
 machines.

 Let's say you have an application that is currently running at 100%
 above acceptable capacity. You can solve this problem in basically  
 four
 ways:

 1. Buy hardware that is twice as powerful
 2. Perform optimisation, caching - etc.
 3. A combination of the 1) and 2)
 4. Buy another similar server and run them both

 In my experience, 4) is always the cheapest option, and requires less
 hassle than 2) and 3) (and less hassle is the TG way!). The trick  
 is to
 make option 4 possible by asking questions like What will happen if I
 use two app or database servers - or both early on in the build
 process. I do this for everything and it's served me right so far :-)
 Part of my personal PHP standard library is some wrappers around  
 session
 management and database handling that means:

Scaling horizontally, what you list as 4, is the only real option.   
There's plenty of public record that shows that all the successful  
guys (Google and LiveJournal come to mind) are using lots of  
relatively cheap servers, rather than small numbers of giant  
servers.  If you design for that, you'll never have a problem so long  
as you can afford to operate, and that's not so tough of a problem  
because the costs are at worst linear.  With any other option, the  
price to upgrade grows exponentially and there's a ceiling on what  
kind of power you can even buy to run an app that is mostly serial.

Good optimizations can do wonders in the short term, e.g. cut  
immediate hardware costs in half... but you get that anyway if you  
wait about a year.  It's typically better to expand your service such  
that it maximizes profits, rather than optimize your service to  
minimize your overhead.  There's only so low you can go with cutting  
your overhead.. but there's no well defined ceiling for maximum  
profits (look at Google!).

-bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Safari and XMLHttpRequest encoding

2006-03-08 Thread Bob Ippolito


On Mar 8, 2006, at 6:49 AM, Jonathan LaCour wrote:


 Write a test case so that other people can see the issue.

 Okay, I created a simple test case as a TurboGears 0.9a1
 application.   It works fine in Firefox, but doesn't work properly in
 Safari.  You can download it at:

  http://cleverdevil.org/testcase.tar.gz

 I definitely could be doing something wrong, but if it works in one
 browser and not another, that leads me to believe that its a bug in
 the browser.

Looks like it's a bug in TG somewhere.. simplejson does the right thing:

  import simplejson
  print simplejson.dumps(dict(text=u'\u00bfHabla espa\u00f1ol?'))
{text:\u00bfHabla espa\u00f1ol?}

but TG does not:

  import urllib
  print urllib.urlopen('http://127.0.0.1:8080/test').read()
{tg_flash:null, text:¿Habla español?}

This is apparently Kevin's fault according to svn blame:

370  kevin class GenericJSON(JSONEncoder):
829  kevin def __init__(self):
829  kevin super(GenericJSON, self).__init__ 
(ensure_ascii = False)

In this revision:
http://trac.turbogears.org/turbogears/changeset/829

Supposedly this helps non-ascii characters through JSON, but it  
doesn't have the intended result.

The right fix for #430 would've been to ensure unicode strings from  
browser input, instead of ensuring potential garbage makes its way  
into the JSON output.  In this case, it would be a change to the way  
URLs (at least the query string) are handled.

This could be fixed by making cherrypy.lib.parseQueryString look at  
the resultant dict for keys that are outside of ASCII and decoding  
them to UTF-8... or it could be done as a filter like the formencode  
NestedVariablesFilter in startup.

-bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: bike shed #1: config extension/dotted names

2006-03-07 Thread Bob Ippolito


On Mar 7, 2006, at 3:47 PM, Ian Bicking wrote:


 Kevin Dangoor wrote:
 So, if there's another trick that we can use to make it look INI- 
 like,
 but still function entirely like a normal Python module, I'm game for
 trying that out. Otherwise, given the constraints above, it sounds
 like people are interested in changing the extension. .pyini?  
 pyc?
 (for python configuration -- just kidding!).

 For this file in particular I don't see any problem with Python  
 syntax,
 or even a funny Python-like syntax (i.e., exec in a funny namespace --
 though I'd be sure to test that in 2.3, since it acts differently on
 this stuff I think).  At least as it isn't advertised as a Python  
 module
 through the .py extension.  Then it's just a matter of aesthetics.  Of
 course, if it is aesthetics then that's a good sign that you can waste
 an unbounded amount of time.  Maybe just do whatever now -- use  
 what you
 have with a new extension -- and add another file extension later  
 if you
 come to hate what you've made ;)

I think that the only difference between 2.3 and 2.4 wrt exec  
namespaces is that you're allowed to use dict subclasses in 2.4.  Not  
that you should..

-bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Safari and XMLHttpRequest encoding

2006-03-07 Thread Bob Ippolito


On Mar 7, 2006, at 5:02 PM, Jonathan LaCour wrote:


 On Mar 7, 2006, at 2:50 PM, Jonathan LaCour wrote:
 Seems like I am the only one busy with email today :)

 Has anyone come up with a workaround to this problem:

  http://trac.turbogears.org/turbogears/ticket/186

 ... its currently causing me great pain!  I filed a bug against
 WebKit's bugzilla, but I would love to find a workaround, if
 possible.

 Isn't this irrelevant for JSON since simplejson escapes everything
 but ASCII?

 Well, I am not entirely sure.  Its possible that the bug I mentioned
 isn't my problem, but I have a controller method that returns some
 unicode strings inside a dictionary.  This controller method is being
 called by loadJSONDoc() on the client side, and the unicode string is
 being placed into a textarea.  On Safari, I see escaped text.  On
 Firefox, I see proper unicode strings.

 So, it seems like this may be the bug I mentioned, but I don't know
 for sure.

Write a test case so that other people can see the issue.

-bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



  1   2   >