Re: Exposing database Id via URL

2008-07-05 Thread jerry

Thanks Jonthan.

However, I wonder how an md5 string can be squeezed into a 10, or even
6-character field with no concern of (future) collision -- or am I mis-
understanding your db schema?

Sincerely,
Jerry

On Jul 5, 1:57 pm, Jonathan Vanasco [EMAIL PROTECTED] wrote:
 On Jul 4, 8:58 pm, jerry [EMAIL PROTECTED] wrote:

  But how? What encryption/hashing method could be used to transform the
  numeric IDs to something less obvious?

 all my apps have somthing like this in the db:

 table hexkey_types
 id , len , name
 ---
 1, 10, useraccount:hex_id
 2, 6, group:hex_id
 3, 6, assetname:hex_id

 table hexkey
 hex_id primary, hexkey_type (fkey on hexkey_type(id))

 table useraccount
 id , hex_id fkey on hexkey10

 i just create random md5s whenever i make an entry into the db.

 when someone requests i record, i validate to make sure the hexid
 matches for the function ( are we requesting a 10char hex for a user?
 if so check memcached with db failover.  if not , then don't
 bother ).  storing a hex-to-numeric mapping  in memcached makes it
 really low-impact.  and no one knows what my internal mappings are.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Exposing database Id via URL

2008-07-05 Thread Jonathan Vanasco

On Jul 5, 4:06 pm, jerry [EMAIL PROTECTED] wrote:
 However, I wonder how an md5 string can be squeezed into a 10, or even
 6-character field with no concern of (future) collision -- or am I mis-
 understanding your db schema?

You're misunderstanding the concept.

1. md5(random+time) to get a random string with good dispersion.
2. Then truncate to 6/8/10/however many chars I need
3. check for collision, if found goto 1
4. insert into db ( in unique field )

there's no need to reverse mapping or use the md5 as a checksum.  its
just a way to find random numbers.

the strings are just unique ids, they don't have to map backwards and
forwards.  md5 is just a very efficient way to create a reasonably
unique id, and then you can do a quick check for collision.

in terms of large-scale sites, i believe both bebo and imeem both do
this with 6char ids
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: paster shell doesn't work with 0.9.7rc1dev

2008-07-05 Thread Philip Jenvey


On Jul 4, 2008, at 6:29 PM, Olli Wang wrote:


 Hi, I got a traceback when I was trying to enable paster shell with
 the development version.
 Any idea? Thanks.


  File /usr/lib/python2.5/site-packages/Myghty-1.1-py2.5.egg/myghty/
 importer.py
 , line 54, in import_module
return builtin_importer(name, globals, locals, fromlist)
  File /usr/lib/python2.5/site-packages/Beaker-0.9.5-py2.5.egg/beaker/
 ext/googl
 e.py, line 1, in module
from __future__ import absolute_import
 TypeError: import_module() takes at most 4 arguments (5 given)

This is a myghty bug (someone reported about a month ago actually).  
It's overriding builtin's __import__ and not handling the new level  
flag used for absolute imports in 2.5. If you're not using Myghty, the  
easiest way of avoiding this is to uninstall it. Otherwise Myghty's  
trunk will have a fix very soon.

--
Philip Jenvey



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



tests fail because of g

2008-07-05 Thread Jonathan Vanasco

I have several helper classes that use g from pylons

I get tons of errors when trying to run tests ( via python setup.py
nosetests ) as importing those packages causes this:

TypeError: No object (name: G) has been registered for this thread



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