On Friday 29 May 2009, percious wrote:
> I think for those TG1 users who are already using genshi and sa with
> TG1, the portion requiring a rewrite is far less, probably 10-20%.

SA is actually the biggest change. You need to touch every query because the 
SA API changed from object.select(,order_by=[],limit=x) to 
object.query.filter().order_by().limit() ...
Certainly not TG's fault :-)

I think it would be majorly helpful if there was a detailed migration 
document. One can do pretty much the same things with TG2, but the docs just 
don't mention important things like 

what happened to stdvars.py and how do I do the same in TG2

how does one use identity in controllers and templates

The main template is different. With TG1 one found a couple of explanations 
what's where in the main template - TG2 misses that.

How do I inject permanent javascript/css on every controller method? (I know, 
in the base.py file, but the docs don't tell you and you need to figure that 
out by digging for hours)

Why can't the i18n module format dates anymore (or can it?) i18n is not just 
language and messages. Dates, times, money, decimals/number formats all play 
in.  Sure, I can use Babel for that, but no mention about where to get tg's 
locale is a little issue there.

Why doesn't database reflection work "properly" anymore - by properly I mean 
without globals in some method. (actually I figured that one out and sent 
Mark Ramm the changes - which are little and allow for either reflection or 
not in the model/__init__.py without globals and stuff. Don't know if that 
breaks anything though, so I'll leave it up to him and the other core 
developers to check it out)

To sum it up: One sure doesn't expect complete documentation from a .0 
release, but a migration would be much easier with proper documentation.

Read the source is always an option, but to be honest, very few people who 
encounter these issues will be as noisy as I am (because I like TG) - most 
people will just try for a while, fail and walk away to something else. As a 
matter of fact, I got a couple of emails off the list after my little late 
night rant - all of which asking me if I knew something else than TG worth 
exploring...

> For instance.  To provide a shortcut to identity in my template and
> request context, here is what my base controller class looks like:
> Maybe it's just me, but that doesn't seem like a huge change.  The
> identity object now hangs of the context of your request, which allows
> for better multi-database support and solves threading issues that may
> other wise crop up.  And in fact, this code is part of the quickstart,
> so you don't even have to figure it out yourself.

Yes, that is the default. Although the new identity object is majorly 
different and not a Bunch anymore. Basically if you use a lot of 
identity.current.something directives you have to rewrite them. I haven't 
gotten to group memberships yet, so I'll see how that goes the new way.
If I knew where to plug it in, I'd write a wrapper to provide the "old 
style" - and be it just to make migration less painful.

> TG2 _is_ a lot faster (although I have never experienced 2 p/sec with
> TG1).  With a complex genshi template, TW enabled pages are still
> rendering at 33+p/sec.  (Mac OS 10 2.4ghz, 4gb ram) The same pages
> rendered as mako for your default template get roughly 120p/sec.

Actually I just tested the main page of my app with TG2 (got that working 
after 20+ hours). TG2 is about 2 seconds slower than TG1 on the same machine.
It takes about 4 sec. before I get a response on my test system (local 
network, dual Xeon with 8GB memory, SCSI drives). TG1 takes a bit over 2sec. 

My production system takes 1.39 sec to respond (TG1). Most likely due to 
serving static files from a different server via nginx. On my production 
system I can handle about 40k pages a day without it being annoyingly slow - 
everything over 40k pages slows to a crawl (dual dual-core with 4GB memory).

I didn't go into detail why it is so slow, but my guess it's a mix of Genshi 
and SA. The main page has about 40 xi:includes and about the same amount of 
database queries. In total the main page comes in at 72 http requests - I 
know, that's a lot but the site is image heavy and has a lot of 
javascripts/stylesheets. I bet it would help a lot if TG could bundle up 
javascripts and css like Zope does. I think I saw something like that in the 
latest TW version - got to check though.

Just to mention: my setup is SA, TG1.0.4, Genshi, TW
As for migrating to 1.5 - TW doesn't work there anymore. TW changed the 
resource injection method therefor no js or css will be injected anymore. I 
fiddled with that for a while, but basically gave up in favor of waiting for 
TG2.0



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to