Re: django, python :: reduce() of empty sequence with no initial value

2009-04-26 Thread tyrrrr
Here is the ultimate solution. class EntryManager(models.Manager): def search(self, search_terms): terms = [term.strip() for term in search_terms.split ()] qs = Entry.objects.all() if terms: q_objects = []

Re: django, python :: reduce() of empty sequence with no initial value

2009-04-22 Thread tyrrrr
Thank you so much! On 22 Apr, 11:25, Karen Tracey wrote: > On Wed, Apr 22, 2009 at 11:08 AM, ty wrote: > > > I might add that it gives me exactly the same error if I try to fetch > > a url with a query in it, for example: > > asdjhakshd/search/?=purple > > asdjhakshd/search/?=monkey_dishwas

Re: django, python :: reduce() of empty sequence with no initial value

2009-04-22 Thread Karen Tracey
On Wed, Apr 22, 2009 at 11:08 AM, ty wrote: > > I might add that it gives me exactly the same error if I try to fetch > a url with a query in it, for example: > asdjhakshd/search/?=purple > asdjhakshd/search/?=monkey_dishwasher > asdjhakshd/search/?=purple+monkey+dishwasher > Those urls don'

Re: django, python :: reduce() of empty sequence with no initial value

2009-04-22 Thread tyrrrr
I might add that it gives me exactly the same error if I try to fetch a url with a query in it, for example: asdjhakshd/search/?=purple asdjhakshd/search/?=monkey_dishwasher asdjhakshd/search/?=purple+monkey+dishwasher On 22 Apr, 11:00, ty wrote: > Yes. I realise that this is exactly the pro

Re: django, python :: reduce() of empty sequence with no initial value

2009-04-22 Thread tyrrrr
Yes. I realise that this is exactly the problem. Do you have some sort of suggestion as to how one might do this? My experience with this manager is calling it from the python shell. I'm not exactly sure how I might do this. Something like if q for term in terms: q_object

Re: django, python :: reduce() of empty sequence with no initial value

2009-04-22 Thread Karen Tracey
On Wed, Apr 22, 2009 at 10:48 AM, ty wrote: > > this is the error: > > reduce() of empty sequence with no initial value > > Request Method: GET > Request URL:http://dsf/search/ > Exception Type: TypeError > Exception Value:reduce() of empty sequ

Re: django, python :: reduce() of empty sequence with no initial value

2009-04-22 Thread tyrrrr
this is the error: reduce() of empty sequence with no initial value Request Method: GET Request URL:http://dsf/search/ Exception Type: TypeError Exception Value:reduce() of empty sequence with no initial value Exception Location: /dsfff

django, python :: reduce() of empty sequence with no initial value

2009-04-22 Thread tyrrrr
Hi I am trying to add a search view to an application I wrote in django but my EntryManager() seems to be getting hung up on the last line of code when django tries to call the url of the search. This EntryManager() (models.py) is excellent for performing searches in the django shell ($ python ma