[tg-trunk] Re: Suggestions needed for repeating widgets...

2006-03-18 Thread Kevin Dangoor

On 3/17/06, Michele Cella [EMAIL PROTECTED] wrote:

 Ah, the more important question:
 Kevin do you think we should support repeating widgets?

Yes, if you're on the track to a good solution, let's give it a whirl.
Repeating widgets are a common and important thing. They may help for
implementing some cool new views and such for FastData.

Kevin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears Trunk group.
To post to this group, send email to turbogears-trunk@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-trunk
-~--~~~~--~~--~--~---



[TurboGears] Re: Unicode, Identity and decoding_filter problem

2006-03-18 Thread Patrik Blommaskog

I forgot to mention that this problem is when using a Postgres
database. After some further investigation, I find that it works as
expected (with decoding_filter.on = True) when switching to sqlite.
Judging from the SQLObject discussions I found, this seems to be a
well-known but hard to fix problem with SO.

It seems to me to be easy to patch soprovider.py to provide a config
parameter for optionally encoding unicode strings before looking them
up. This is probably what I will end up doing if no better solution is
suggested.

If I want to be able to use non-ascii characters in userId and password
with Identity, are there any alternatives to using decoding_filter.on =
True?


--~--~-~--~~~---~--~~
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: Unicode, Identity and decoding_filter problem

2006-03-18 Thread Jorge Godoy

Patrik Blommaskog [EMAIL PROTECTED] writes:

 If I want to be able to use non-ascii characters in userId and password
 with Identity, are there any alternatives to using decoding_filter.on =
 True?

A while ago, I reported a similar problem with identity but I only wanted
using Unicode in displayName.  I don't believe it is a good thing to have your
login using Unicode (it is a good thing for your password, though).

I haven't solved this problem -- I've just avoided using these for identity
for now...  If you go ahead and make this work, publishing your patch would be
nice (you could write it agains SQLObject trunk and post it to SQLObject's
mailing list, they are very helpful and receptive there).

-- 
Jorge Godoy  [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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] decorator order

2006-03-18 Thread gergo

Hi,

is there any effect on the program (speed?) of the order of a
function's decorators?
What is the recommended order of expose, identity.require, validate,
error_handler?

Gergely MAJOR


--~--~-~--~~~---~--~~
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-18 Thread lateef jackson
I guess my confusion was from my original post where I said:* Application server scale easy as pie, database servers scale like  hernias I should have been more specific that applications server what I meant was TG, PHP where ever the business logic of the code is. Maybe easy as pie was the wrong analogy to use. 
The m/custer technology is what I usually call database proxy. CJDBC was the first time I thought about using a db proxy. This is a really great solution for failover but not for scalability. If I am doing more database transaction persecond I can't just add another database server, I have to buy a bigger database server and if I am using a database proxy and have 3 database server that means I have to buy 3 database servers. You are technically correct database writes don't end up in exactly one place but those write are copied not split up. So now you have every write ending up on every single database node, which only scales if you writes stays the same and your reads increases. All the applications I have worked on reads and write increase as load increases, sometimes you can have a spike in the reads and not the writes it just depends on the applications.
To write in more than one place you have to have the technology to be to load balance the writes. Then reads will need to know what server to go to for what data. I think this would be a blast to code! Fortunatly reads are a majority of most applications especially web applications. Thus why some simple caching is easier and more effective than replication of data.
On 3/17/06, Robin Haswell [EMAIL PROTECTED] 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 buyNah mate you miss my point! Not bigger machines, *more* machines. A DellSC1425 is a pretty low-end piece of kit, the idea is you use multiplemachines.Let's say you have an application that is currently running at 100%
above acceptable capacity. You can solve this problem in basically fourways:1. Buy hardware that is twice as powerful2. 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 lesshassle than 2) and 3) (and less hassle is the TG way!). The trick is tomake option 4 possible by asking questions like What will happen if I
use two app or database servers - or both early on in the buildprocess. 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:1) All my session data is stored in the database, which means from thenon I can implement *all* my persistent storage in an RDBMS.2) My database reads and my database writes are separated and
controllable, so if we need to add replication it's possible to directall writes to the master server and balance reads between the slaves.(Yes I said there are alternatives to the master/slave setup, but in web
apps which are mostly read-heavy it's a pretty good solution anyway).-RobPS. If you're interested in the writing to one place problem, youshould look m/custer(
http://www.continuent.com/index.php?option=com_contenttask=viewid=211Itemid=168).We have our own solution, but in general it's a pretty awesome setup fordatabase scaling through multiple servers.

--~--~-~--~~~---~--~~
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-18 Thread lateef jackson
LiveJournal is an excelent example it is where I stole the idea of using memcache: http://www.linuxjournal.com/article/7451My visions for scaling up is to us url partitioning so that simular data all goes to the same host(s) and have no shared cache. For example if you have a news site all the tech articles could go to one server(s) that had all tech articles in there cache. This makes the invalidation have to iterate over a list of hosts but thems the breaks.
On 3/17/06, Bob Ippolito [EMAIL PROTECTED] wrote:
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 successfulguys (Google and LiveJournal come to mind) are using lots of
relatively cheap servers, rather than small numbers of giantservers.If you design for that, you'll never have a problem so longas you can afford to operate, and that's not so tough of a problembecause the costs are at worst linear.With any other option, the
price to upgrade grows exponentially and there's a ceiling on whatkind 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. cutimmediate hardware costs in half... but you get that anyway if you
wait about a year.It's typically better to expand your service suchthat it maximizes profits, rather than optimize your service tominimize your overhead.There's only so low you can go with cuttingyour overhead.. but there's no well defined ceiling for maximum


--~--~-~--~~~---~--~~
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: decorator order

2006-03-18 Thread Simon Belak

Strictly speaking order can be arbitrary, however all permutations are 
not invariants.
One needs to take into consideration validate and require can alter 
program flow (for invalid inputs). Depending on this branching it is 
possible to construct a situation wherein some permutations are faster 
than others.
Any such optimisations are far from self-explanatory and should, if 
used, be well documented (or even included into project's coding standard).

The standard order is expose, require, validate, error_handler, 
exception_handler.

Some care should be taken with error_handler when used in explicit 
recursive fashion (method being it's own handler). Writing something like:

@expose
@validate
@require
@error_handler(None)
def ...

can lead to a nasty security hole, as for any invalid input require() 
will be by-passed.
I am working on improving this behaviour, suggestions are welcomed.


Cheers,
Simon


gergo wrote:
 Hi,
 
 is there any effect on the program (speed?) of the order of a
 function's decorators?
 What is the recommended order of expose, identity.require, validate,
 error_handler?
 
 Gergely MAJOR
 
 
 


--~--~-~--~~~---~--~~
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] Automatic stripping of HTML tags

2006-03-18 Thread [EMAIL PROTECTED]

Hi!

How can I disable automatic stripping of tags when I want to display a
content from DB which contains html tags.

It turns this:
a href=testtest/a

To this:
lt;a href=testtestlt;/a 

Thanks, Sebastjan


--~--~-~--~~~---~--~~
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] TG Applications in the wild?

2006-03-18 Thread Alan

Are there good examples of TG web applications currently working on the
internet?  It would be great to see how others are using this
framework!

Thanks in advance!


--~--~-~--~~~---~--~~
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] Storing Credit Cards in a db - Encryption Methods ?

2006-03-18 Thread citizenkahn

I'm working on an ecommerce site and I'd like to securely store credit
cards.  Does anyone know of a good solid two way encryption method in
python?


--~--~-~--~~~---~--~~
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: Automatic stripping of HTML tags

2006-03-18 Thread isaac


On Mar 18, 2006, at 10:06 AM, [EMAIL PROTECTED] wrote:


 Hi!

 How can I disable automatic stripping of tags when I want to display a
 content from DB which contains html tags.

 It turns this:
 a href=testtest/a

 To this:
 lt;a href=testtestlt;/a

 Thanks, Sebastjan

${XML(your_stuff_here)}


--  
...if you swear that there's no truth and who cares / How come you  
say it like you're right? --Bright Eyes, _We Are Nowhere and It's Now_




--~--~-~--~~~---~--~~
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: Storing Credit Cards in a db - Encryption Methods ?

2006-03-18 Thread citizenkahn

Let me guess... the answer is Kuchling, right?

http://www.amk.ca/python/code/crypto.html


--~--~-~--~~~---~--~~
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: TG Applications in the wild?

2006-03-18 Thread Kevin Dangoor

Hi,

The best known example out the on the net is

http://diggdot.us

I know of others who are working on products and some who have
internally deployed applications. One of those is supposed to be open
sourced before too long, so that should be a nice example that's
coming up.

Kevin

On 3/18/06, Alan [EMAIL PROTECTED] wrote:

 Are there good examples of TG web applications currently working on the
 internet?  It would be great to see how others are using this
 framework!

 Thanks in advance!






--
Kevin Dangoor
Author of the Zesty News RSS newsreader

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

--~--~-~--~~~---~--~~
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: Storing Credit Cards in a db - Encryption Methods ?

2006-03-18 Thread citizenkahn

wow, getting the cyptography stuff up and running was interesting.  On
linux, its pretty simple, on windows it was less so...

I chose to go with the Heiko Wundram's yawPyCrypto because Kuchling
said that it was a similar attempt that exposes more functionality
than ezPyCrypto does while still being as easy to use.  and I figured
he'd be right about that as he is the PyCrypto author.

How To Overview Linux/Win

1win. Obtain a Winstallable version of pycrypto that doesn't require
win32 sdks and Visual Studio:
http://www.voidspace.org.uk/python/modules.shtml#pycrypto
1lin. Obtain the pycrypto package and install it following the standard
pattern
location: http://www.amk.ca/python/code/crypto.html
 - unpack
 - python setup.py build
 - python setup.py install
NOTE: debian users can just do an apt-get or synaptic for pycrypto

2. Obtain the two yawpycrypto packages yawpycrypto and flatten from
http://yawpycrypto.sourceforge.net/
 both follow the standard pattern
 - unpack
 - python setup.py build
 - python setup.py install

run the test program from the unpacked yaw directory..


Hope this brief overview saves someone some time...


--~--~-~--~~~---~--~~
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: Storing Credit Cards in a db - Encryption Methods ?

2006-03-18 Thread Jorge Godoy

citizenkahn [EMAIL PROTECTED] writes:

 I'm working on an ecommerce site and I'd like to securely store credit
 cards.  Does anyone know of a good solid two way encryption method in
 python?

Do you really need to store the credit card numbers?  At least here it is
illegal and not recommended.  After the transaction has been done, then you
don't need the numbers anymore...  

-- 
Jorge Godoy  [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: TG Applications in the wild?

2006-03-18 Thread Alan

Thanks Kevin.

More examples would be great!  I know it's early days but whatever you
can do to get more showcase projects out in to the open would be
greatly appreciated!


--~--~-~--~~~---~--~~
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] Routing by HTTP Method

2006-03-18 Thread Sean De La Torre
I've written a decorator (attached) that automatically routes requests based on the http request-method type. I found this useful, and figured that there are others out there who will too.Here are a couple of example of how this works:
Example 1: Default Behavior-
The example below works as follows:
1) The target method, edit, is decorated with the http_method_router decorator.
2) When edit is called, it will route all GET requests to edit_GET,
 and all POST requests to edit_POST3) If an unmapped method is used (PUT or DELETE in this case), then
 edit_GET will be called by default.To change the default behavior,
 add the default parameter to the decorator: @http_method_router(default='some_other_method_name')
Sample Code:--
@turbogears.expose()@http_method_router()
def edit(self, *args, **kwargs): pass
def edit_GET(self, *args, **kwargs): pass
def edit_POST(self, *args, **kwargs):
 pass---
Example 2: Alternate mappings-
The example below works as follows:1) The alt_mappings parameter is specified with the mappings for
 the GET and POST requests.
2) All edit GET requests are routed to the show function, and all edit POST requests are routed to the update function.
3) In this case, since no other mappings are declared, and no
 default method was specified, all PUT and DELETE requests will cause a 
cherrypy.NotFound exception to be raised. 
Sample Code:--@turbogears.expose
()@http_method_router(alt_mappings=dict(GET='show', POST='update'))
def edit(self, *args, **kwargs): pass
def show(self, *args, **kwargs):
 passdef update(self, *args, **kwargs):
 pass---Thanks,
Sean
--~--~-~--~~~---~--~~
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  -~--~~~~--~~--~--~---

import cherrypy
from turbogears.decorator import decorator

def http_method_router(default=None, alt_mappings=None):
 Routes requests based on the http request type (GET, POST, PUT, DELETE).

By default, the http_method_router will attempt to forward the request
to the corresponding function_name_http_method function.  For 
example,
if a function named edit is decorated with the http_method_router,
then all GET requests will be routed to the edit_GET function, all POST
requests to the edit_POST function, etc.

If a function cannot be matched to the request, then the router will
first check for a value in the default parameter.  If this is a valid
value, then the corresponding function will be called.  If no default 
value
is specified, then an attempt will be made to route the request to the
function_name_GET function.  If that function does not exist, then a
cherrypy.NotFound exception will be raised.

If you do not want to use the default function_name_http_method
behavior, then alternate mappings can be specified by passing in a
dict of http_method to 'function_name' values in the
alt_mappings parameter.

See the examples below for more information.

Example 1: Default Behavior
-
The example below works as follows:
1) The target method, edit, is decorated with the http_method_router
   decorator.
2) When edit is called, it will route all GET requests to edit_GET,
   and all POST requests to edit_POST
3) If an unmapped method is used (PUT or DELETE in this case), then
   edit_GET will be called by default.  To change the default behavior,
   add the default parameter to the decorator:
   @http_method_router(default='some_other_method_name')

Sample Code:
--
@turbogears.expose()
@http_method_router()
def edit(self, *args, **kwargs):
pass

def edit_GET(self, *args, **kwargs):
pass

def edit_POST(self, *args, **kwargs):
pass
---

Example 2: Alternate mappings
-
The example below works as follows:
1) The alt_mappings parameter is specified with the mappings for
   the GET and POST requests.
2) All edit GET requests are routed to the show function, and
   all edit POST requests are routed to the update function.
3) In this case, since no other mappings are declared, and no
   default method was specified, all PUT and