ANN: Django sprint in Washington DC area, August 1st

2008-07-22 Thread Benjamin Slavin
With 1.0 alpha upon us, I thought it would be a good time for an announcement. On August 1st, just under two weeks from now, we will be hosting a sprint in Washington, DC. The focus will be on Django 1.0 beta 1. This marks the first east-coast Django sprint (I think), so we're trying to bring

Re: Signals error - I can't do a import

2007-10-11 Thread Benjamin Slavin
Sounds like a circular import problem. You might want to try this: 8<= sig.py = def thesignal(sender, instance, signal, *args, **kwargs): from mysite.plush.models import Photo assert False, "It got here" 8<= sig.py = Regards, - Ben

Re: filtering by null related object

2007-10-10 Thread Benjamin Slavin
Hi Casey, You may want to take a look at ticket #1050. http://code.djangoproject.com/ticket/1050 - Ben On 10/10/07, Casey T. Deccio <[EMAIL PROTECTED]> wrote: > > Given the following models: > > class ModelA(models.Model): > name = models.CharField(max_length=10) > > class

Re: Effective use of class_prepared signal

2007-10-03 Thread Benjamin Slavin
Malcolm, As always, your expedient and thoughtful reply is appreciated. On 10/3/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > The only thing that is really guaranteed to be loaded sufficiently early > in the process is the settings module (along with the __init__.py file > in the

Effective use of class_prepared signal

2007-10-03 Thread Benjamin Slavin
Hello all, I'm trying to make use of the class_prepared signal to add some functionality to all models. The problem I'm facing is how to properly register my listener. I need to register the listener before any models are prepared, but I can't seem to figure out how to accomplish this. Right

Re: HttpMethodsMiddleware and mod_python (REST)

2007-08-31 Thread Benjamin Slavin
On 8/31/07, David Larlet <[EMAIL PROTECTED]> wrote: > > request.method = request.REQUEST[_MIDDLEWARE_KEY].upper() > > AttributeError: can't set attribute > > Hello David, I don't have a mod_python install I can easily test on, but could you try this for me: request._req.method =

Re: one model per file

2007-07-12 Thread Benjamin Slavin
On 7/12/07, Lic. José M. Rodriguez Bacallao <[EMAIL PROTECTED]> wrote: > the idea here is like Jeremy say, make django think that it has a module or > package named models, here, in __init__.py file I'm telling that the > directory models is a package and for all your models to be accessible to >

Re: Database caching, querysets not evaluating?

2007-07-08 Thread Benjamin Slavin
You may want to take a look here: http://groups.google.com/group/django-users/browse_thread/thread/e4e1e0c017655ad/ On 7/8/07, ejot <[EMAIL PROTECTED]> wrote: > > And continuing this monologue :) ... the separate thread ofcourse > didnt quite work as I intended. I see now that a new

Re: caching between successive calls to model.objects.all()?

2007-07-03 Thread Benjamin Slavin
On 7/2/07, Lawrence Wang <[EMAIL PROTECTED]> wrote: > tell me more about transaction management -- i don't believe i'm using any, > because there's nothing in my settings.py that would seem to apply, but > perhaps i've overlooked something trivial. You can read about it at [0]. You can read

Re: caching between successive calls to model.objects.all()?

2007-07-02 Thread Benjamin Slavin
Hello. You mention you are using the multi-db branch. Do you get this behavior in trunk? What happens if you update a user from within the Django management shell? Does this result in a correct QuerySet from all()? Are you under transaction management in the management shell? If so,

Newforms is_bound determination (was Re: Is it a bug: f.data = data return False instead of True ?)

2007-06-01 Thread Benjamin Slavin
On 6/1/07, olive <[EMAIL PROTECTED]> wrote: > This returns True: > f = myform(data) > f.is_valid() > > while this returns False: > f = myform() > f.data = data > f.is_valid() > > Is it a bug ? Not sure if it should be called a bug or not from a quick look at the source code

Re: Random features in sidebar

2007-05-14 Thread Benjamin Slavin
On 5/14/07, Mordy Ovits <[EMAIL PROTECTED]> wrote: > And (after checking the python docs because I still think in Python > 1.5.2), random.sample() makes even more sense. For those interested, the snippet I posted (#230) has been updated to reflect the results of this discussion. - Ben

Re: ordinal not in range(128) + ezPyCrypto

2007-05-14 Thread Benjamin Slavin
On 5/14/07, Forest Bond <[EMAIL PROTECTED]> wrote: > You mean: > > decrypted_passport = k.decString(base64.b64decode(self.passport)) > self.passport = decrypted_passport > > Right? Yeah... that's the one ;-) Thanks for catching that, Forest. elemental: Looking at this again, I'm still

Re: ordinal not in range(128) + ezPyCrypto

2007-05-14 Thread Benjamin Slavin
Hi elemental, One thing I noticed is that you're doing two base64 encodings (thus the need to decode twice). You have: raw = base64.b64encode(passport) encPassport = k.encString(raw) self.passport = base64.b64encode(encPassport) I'm not familiar with ezPyCrypto, but you might try:

Re: ordinal not in range(128) + ezPyCrypto

2007-05-13 Thread Benjamin Slavin
On 5/13/07, elemental <[EMAIL PROTECTED]> wrote: > UnicodeDecodeError at /register/ > 'ascii' codec can't decode byte 0xb4 in position 0: ordinal not in > range(128) > > For reference, here is the save portion of the model: > > def save(self): > key = ezPyCrypto.key(512) >

Re: Random features in sidebar

2007-05-11 Thread Benjamin Slavin
I've just uploaded a template filter called "several_random" to the django snippets site. [0] If you combine this with orestis's suggestion, I think you'll get what you're looking for. Quick side note: Using the built-in random filter in a template multiple times could give you the same result

Re: Why are my FloatFields strings ?

2007-05-08 Thread Benjamin Slavin
On 5/8/07, Andy Dustman <[EMAIL PROTECTED]> wrote: > Perhaps Django needs a > DecimalField (or NumericField) for fixed-point values? (You might be > working on this; haven't searched bugs.) This has been discussed before and, so far as I can tell, is an active topic of discussion ('Design

Re: Whether 2G RAM dedicated server could support a django site with 190 reqs/sec?

2007-04-27 Thread Benjamin Slavin
On 4/27/07, Nicola Larosa <[EMAIL PROTECTED]> wrote: > You may consider starting with a virtual server, and then moving to > dedicated ones when the traffic warrants it. I second the recommendation to go with a virtual server as a starting point. I've had great success with Slicehost. The

Re: Cannot resolve keyword into field

2007-04-24 Thread Benjamin Slavin
On 4/24/07, Jason McVetta <[EMAIL PROTECTED]> wrote: > Ben posted patches for the management shell and for mod_python. The case > where I am experiencing this bug is running a script from the command line > (or from cron). I tried including his work around code ... > at the beginning of my

Re: Persistance after re-submit for ImageField/FieldField uploads in newforms

2007-04-19 Thread Benjamin Slavin
Of course, the title should read: "Persistance after re-submit for ImageField/FileField uploads in newforms" On 4/19/07, Benjamin Slavin <[EMAIL PROTECTED]> wrote: > Howdy all, > > I'm putting together an application that's using a file upload in > ne

Persistance after re-submit for ImageField/FieldField uploads in newforms

2007-04-19 Thread Benjamin Slavin
Howdy all, I'm putting together an application that's using a file upload in newforms (the target is images). The problem that I'm having is that, when there's a validation error elsewhere in the form, the image is 'lost' and the user has to re-attach it to resubmit. Because Django clears-out

RelativeTime newforms field

2007-04-17 Thread Benjamin Slavin
Howdy all, I'm just wondering if anyone has created a "RelativeTime" field for newforms... What I mean is something that will allow a user to pick values such as 'Now', 'In an hour', 'At noon', 'On Monday', 'Tomorrow morning', etc that will provide a "cleaned" value that's a datetime object.

Re: HTTP faking

2007-04-12 Thread Benjamin Slavin
Jesse, I think that this is a decent idea. One thing that I think would be useful though is for this sort of transform to be transparent... that way templates can be constructed properly and the middleware can handle the transformation. I've put together a quick example combining your code

Re: HTTP faking

2007-04-12 Thread Benjamin Slavin
On 4/12/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > Yes, I can see that, but PUT is idempotent, while POST isn't. It > seems to me that treating one verb as another will at least make HTTP > caching odd. None of PUT/POST/DELETE are cacheable (with the exception of POST with Expires or

Re: Most efficient way to handle two level deep relationships

2007-04-06 Thread Benjamin Slavin
Hi Mike, You'll probably want to check-out select_related. [0] With that feature, you could use: posts = Post.objects.select_related().filter(thread__slug=thread_slug) If the copy of Django you're using is recent enough (I don't know if it's in 0.96), you can use the 'depth' argument... posts

Performing an action on first-save for models with a OneToOneField

2007-04-06 Thread Benjamin Slavin
Howdy, folks, I'm currently trying to perform an action the first time an object is saved for a model that includes a OneToOneField. Normally I'd use the old "check self.id before save" approach, but models with OneToOneFields don't provide that option (they don't have a self.id variable, and

Re: Multiple file upload crashes dev server

2007-03-19 Thread Benjamin Slavin
You might want to throw some logging into your application (Python's logging module). [0] If you use logging, you'll be able to get a better handle on where the problem is actually happening. I've heard of the dev server crashing ungracefully when it encounters an error, but have never seen it

Re: how to use .htc file in django

2007-03-12 Thread Benjamin Slavin
It is not clear to me what you are asking. You will need to provide more information than "I cannot do it correctly". However, your browser interprets the output of Django in the same way as 'normal HTML' and J2EE application HTML output. You should check the HTML generated by your Django

Re: Django over modpython

2007-02-18 Thread Benjamin Slavin
I second the SliceHost VPS recommendation... my experience with them has been nothing but positive. - Ben On 2/17/07, Scott Paul Robertson <[EMAIL PROTECTED]> wrote: > On Sat, Feb 17, 2007 at 04:41:46PM -, akonsu wrote: > > > > www.prgmr.com seem to have affordable VPS hosting. but i

Re: newforms - can't pass variable to custom form

2007-02-12 Thread Benjamin Slavin
You may want to try self.user.email instead of user.email. - Ben On 2/12/07, Silas <[EMAIL PROTECTED]> wrote: > > I've created a newforms custom form in which I'm trying to update a > user's email while making sure no other user currently has the new > email address. Ignoring the fact that I

Re: Use of post_save on newly created objects

2007-02-10 Thread Benjamin Slavin
On 2/9/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > Using the signal system might be overkill here. Can you achieve whatever > you want with your own save() method (remember that you can then call > the model's default save() method after doing your own stuff)? > Malcom, Thanks for the

Use of post_save on newly created objects

2007-02-09 Thread Benjamin Slavin
Howdy all, I was investigating post_save to perform some associated setup for an object after it's created. My only concern is that I can't seem to find any way to check if the object was created on this call to save()... I only want to perform the setup the first time the object is saved.