Re: Subclassing User class or User class "profiles" recommended for extra attributes?

2010-09-29 Thread Oli Warner
+1 It's been a while since I've seen anything on this and would really like to know if profiles are really here to stay. I do understand the technical issues but I can't see any that can't be circumvented. Something as integral as membership should be more flexible without the need for spanning pe

Caching user_passes_test calls

2010-01-20 Thread Oli Warner
Something I've noticed about the user_passes_test decorator is it does not cache. While I can see data-freshness being an issue (ie if you change a permission and the old result has to expire before the permission is applied) a complex test can cause quite a bit of database IO and slow things down

Re: Moved server, can't log in

2009-12-10 Thread Oli Warner
are other sites on the server). But yes, I am using the sessions framework. On Thu, Dec 10, 2009 at 2:46 PM, brad wrote: > > > On Dec 10, 4:57 am, Oli Warner wrote: > > A couple of days ago I moved a site from one server to another server and > > changed the DNS on the doma

Moved server, can't log in

2009-12-10 Thread Oli Warner
A couple of days ago I moved a site from one server to another server and changed the DNS on the domain so it stayed the same. After the DNS had migrated everybody but me could log in. All other users trying to log into the admin were getting the "Looks like your browser isn't configured to accept

Re: Remote developer opportunity

2009-11-02 Thread Oli Warner
Personally, I think Kashif's information request is pertinent to the opening post and should be replied to in the clear so anybody interested in the first post can also read it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Django with Cherokee web server

2009-10-08 Thread Oli Warner
> > To stick with your analogy, it actually *is* like buying a car and being > surprised you don't get 0-60 in 5 seconds and 80 mpg, but only because > you will only drive it in second gear. And then you blame the dealer.. > Sure. Cherokee's an automatic ;p > >From the way you talk about Apache,

Re: Django with Cherokee web server

2009-10-08 Thread Oli Warner
> > FUD. You just think it is slow and inefficient because you have never > configured it correctly. > Analogy time. Gather round, children. You buy a car. The dealer said it can do 0 to 60mph in five seconds and does 80 miles per gallon. You buy it for these reasons but when you receive it and t

Re: Django with Cherokee web server

2009-10-07 Thread Oli Warner
> > People quite happily run Django on memory starved VPS systems using > Apache/mod_wsgi *with optional nginx front end* for static files. > Apache is woefully slow and inefficient at static serving. A static reverse proxy is not optional for sane people. And I'd rather just admin one server. -

Re: Django with Cherokee web server

2009-10-07 Thread Oli Warner
On Wed, Oct 7, 2009 at 5:34 AM, hcarvalhoalves wrote: > I wanted to know if someone here on the list is using or used Cherokee > with Django, if there's any performance improvements over Apache + > mod_wsgi/mod_python (specially for concurrent requests), and if there > are any gotchas with Django

Re: Something happened, can't log in

2009-09-29 Thread Oli Warner
py if it builds :) Thanks for noticing that! I'll refactor that class so it doesn't rely on StringMorsel (seems fairly pointless anyway) On Tue, Sep 29, 2009 at 4:39 PM, Karen Tracey wrote: > On Tue, Sep 29, 2009 at 11:30 AM, Oli Warner wrote: > >> As this clearly had

Re: Something happened, can't log in

2009-09-29 Thread Oli Warner
sion of something or other that's messing things up. Python: 2.6.2-0ubuntu1 Django: 1.1-2ubuntu1 On Tue, Sep 29, 2009 at 4:30 PM, Oli Warner wrote: > As this clearly had something to do with the session, I just changed the > SESSION_ENGINE to file. Different error, but for the same reaso

Re: Something happened, can't log in

2009-09-29 Thread Oli Warner
e.py", line 43, in _key_to_file return os.path.join(self.storage_path, self.file_prefix + session_key) TypeError: cannot concatenate 'str' and 'StringMorsel' objects Any ideas what a StringMorsel is and why it's jamming up the works? On Tue, Sep 29, 2009 at 11:22 AM, Ol

Something happened, can't log in

2009-09-29 Thread Oli Warner
I've been building a site for a couple of months, on and off. Today when I log in, everything blows up. The core part appears to come from calling request.user. That trickles through the database (I assume to get the actual user object) and detonates with a *InterfaceError: Error binding parameter

Re: Problem running django through fcgi on shared hosting

2009-08-14 Thread Oli Warner
e: > > Thing is I already got my bluehost account for other projects, so > getting another host kills my budget. Also the contract is running for > another good 10 months so switching now isn't an option either. I only > recently started django coding, so now I have to use what I

Re: Problem running django through fcgi on shared hosting

2009-08-14 Thread Oli Warner
I apologise in advance for a reply that isn't going to seem immediately useful. Don't host django sites on shared systems that don't wont help users host their sites with them. Seriously. I've tried both Dreamhost (did it!) and Bluehost (failed miserably). You spend hours, if not days, hacking aro

Re: how much python do i need to know to learn/use Django?

2009-08-14 Thread Oli Warner
I'd take the Django course. Python is possibly one of the easiest languages to step into. You will see new constructs, you will see funny-looking methods of doing things, but they all make relative sense. I would suggest going out and getting the Python Pocket Reference (O'Reilly - Mark Lutz).

Re: Python noob tuples question

2009-05-22 Thread Oli Warner
On Fri, May 22, 2009 at 4:44 PM, CrabbyPete wrote: > if I start with PEOPLE = (('john','adams')) how do I add the > subsequent tuples? > Simple. Tuples are immutable (cannot be modified) so you don't contain your little tuples in a big tuple, you use a list. list = [] list.append(('my','tuple')

Re: Django version

2009-05-20 Thread Oli Warner
If you have shell access, you can run this from ./manage shell (but you could easily print it out from your code onto your pages too) import django django.VERSION On Tue, May 19, 2009 at 6:47 PM, VidrSan wrote: > > How can I see django version on my web-server? Just python's code, > beaucause I

Re: Email form

2009-05-18 Thread Oli Warner
e mapping obscure field names to > descriptive labels, and when you generate the email, do a bunch of > lookups to convert the field names to labels. > > Aneesh > > On May 18, 11:14 am, Oli Warner wrote: > > I've made a couple of forms that are basically supposed to dump th

Email form

2009-05-18 Thread Oli Warner
I've made a couple of forms that are basically supposed to dump their content into an email and send that on. My forms both inherit this class: class EmailForm(forms.Form): def sendemail(self, fromAdd, toAdd, subject, keys=None): body = '' if not keys: keys = self.cleaned_data

Re: Django, FCGI, Cherokee. Spawning PHP Processes and detaching?

2009-04-30 Thread Oli Warner
You're a fair way down this route already but I'll tell you what I would do faced with a similar situation: 1. Set up a local-only site inside Cherokee with my PHP and have it output the results in a nice format (I'd use JSON) 2. Use urllib2 and simplejson to pull the data back into Djang

Re: Can I use the django test server for this?

2009-04-21 Thread Oli Warner
You could, but as you say you would have to script it to daemonise. If resources are what's putting you off running something like Apache, you should know there are plenty of lightweight servers that are simple to get up and running, even on desktop machines. Just to state my position: I would fi

Re: Webpy vs Django

2009-04-21 Thread Oli Warner
ho asks you to compare an apple to an orange. I'll stop waffling now and go back to work. On Tue, Apr 21, 2009 at 12:23 PM, Kenneth Gonsalves wrote: > > On Tuesday 21 April 2009 16:43:09 Oli Warner wrote: > > And I was going to say that the probable benefit of Django (over Webpy) &

Re: Webpy vs Django

2009-04-21 Thread Oli Warner
I can't speak for Webpy (having never used it) but I can tell you I'd have Django's babies if I could. I guess I do and they're websites... ... Anyway. I wanted to apologise for the frankly unneccessary and otherwise useless comments you've had so far. Framework evaluation is a tough thing and I

Re: Django Deployment Methods: Survey (via DjangoSites)

2009-04-07 Thread Oli Warner
Please add Cherokee to the server choices and SCGI to the method choices. I can't edit my sites (accurately) until you have. On Tue, Apr 7, 2009 at 10:15 AM, Ross Poulton wrote: > > There are quite a few different ways to deploy Django applications so > that the big wide world can see them. I'm

Re: Django db profiler

2009-04-03 Thread Oli Warner
See: http://www.djangosnippets.org/snippets/93/ On Fri, Apr 3, 2009 at 8:22 AM, Masarliev wrote: > > In zend framework there is php profiler that shows every mysql Query > in firebug console, but I can't find something similar in django. > > > > --~--~-~--~~~---~--~-

Re: How Do I Extend Model form

2009-04-02 Thread Oli Warner
I'm not entirely sure why you want to do this (so please excuse me if this doesn't apply) but you should know that you're allowed more than one django Form inside a single HTML element. So you can easily have several ModelForms (or mix them with regular Forms) inside a single tag. I hope that m

Re: forming email body

2009-04-02 Thread Oli Warner
Yeah I've used the template engine for this before and it has worked well. No complaints and it's relatively simple: from django.core.mail import send_mail from django.template import loader, Context t = loader.get_template('my/template.txt') send_

Re: adding views to admin site

2009-04-01 Thread Oli Warner
Surely you need an ^admin/myapp/ rule in your main urls.py? (Your myapp/urls.py cannot attach to the /admin/ path because it is locked into the ^myapp path) Or you could switch it around and go for /myapp/admin/ (^admin/...) in your myapp/urls.py Both would be perfectly valid. On Wed, Apr 1, 20

Re: Flatpages variables

2009-04-01 Thread Oli Warner
Same principal stands; you'll need to use middleware to check the current user has what they need on their session and interrupt the request if they don't. If that doesn't make sense, read up on what middleware can do for you. On Wed, Apr 1, 2009 at 4:47 PM, Wiiboy wrote: > > Sorry, should've p

Re: how to django to request a page of the other domain

2009-04-01 Thread Oli Warner
Look at urllib2 (google) You should be able to do something like return HttpResponse(urllib2.urlopen('http://www.your-url.ext/uri')) 2009/4/1 Albert > > cross domain ajax request is not allowed ,so I decide to use proxy on > the server side > but I don't know how to finish this, anyone point m

Re: Is Django right for me?

2009-03-31 Thread Oli Warner
> > Yup. The ORM goes out of its way to make safe strings. You can circumvent > it > > but that's naturally on your head. The Form classes also go a long way to > do > > the same. Forms go some distance further to make validation really simple > > too. > > > > Interesting, thanks. I did not know wh

Re: Is Django right for me?

2009-03-31 Thread Oli Warner
On Tue, Mar 31, 2009 at 12:35 PM, Dotan Cohen wrote: > > > Dotan, I think once you've got your head around some of the key concepts > > (urls, models, template inheritance and forms) and have a first site set > up, > > you'll never ever look back. > > > > Again, I am not interested in the templat

Re: Is Django right for me?

2009-03-31 Thread Oli Warner
Dotan, I think once you've got your head around some of the key concepts (urls, models, template inheritance and forms) and have a first site set up, you'll never ever look back. The Python is the easy bit. It mostly "just makes sense" until you see the crazy-short ways of doing really quite compl

Re: Converting DateTime to UTC

2009-03-26 Thread Oli Warner
Just found http://code.google.com/p/django-timezones/ On Thu, Mar 26, 2009 at 4:56 PM, Oli Warner wrote: > I'm collecting DateTimes in local format. In Hindsight, this probably > wasn't the best idea but it's what I have now. > > I need to output to UTC so people in

Converting DateTime to UTC

2009-03-26 Thread Oli Warner
I'm collecting DateTimes in local format. In Hindsight, this probably wasn't the best idea but it's what I have now. I need to output to UTC so people in multiple timezones can make sense of the data. Is there a nice template tag that will automagically convert my locally-collected date into UTC?

Re: model design issue

2009-03-26 Thread Oli Warner
The true relational way would be to have another Model called JobRunParameter with an FK on Parameter. It's getting a bit silly though and all these look-ups are going to be a pain later on. If Parameter is just a string key/value style thing, I might have simplified things a little and instead of

Re: What's the most scalable Django deployment out there currently?

2009-03-25 Thread Oli Warner
David, slightly off-topic, but you should see some impressive gains if you move your static handling off Apache onto something lighter (Cherokee/Lighttpd/nginx/etc) and reverse-proxy the dynamic stuff through to a localhost-bound Apache. Hell, I use Cherokee for dynamic content too (via django's S

Re: ImageField on ModelForm not working - v1.0.2

2009-03-25 Thread Oli Warner
Well now I feel like a moron! Not only did I forget to pass through request.FILES, but I needed enctype="multipart/form-data" on my too. Thanks to both of you! /me slaps himself with a hefty dose of RTFM --~--~-~--~~~---~--~~ You received this message because you

ImageField on ModelForm not working - v1.0.2

2009-03-25 Thread Oli Warner
I'm having a massive headache. I have a Model called companies with vaious fields but for one form, I want the user to be able to edit two ImageFields and a TextField. "Simple", I thought and quickly made a ModelForm class: class AdminEditForm(ModelForm): class Meta: model = Company