oh yeah... thanks.

I have head of BeautifulSoup - never used it before.  my pages html are now 
much 
more readable.

Carl K

Michael Trier wrote:
> Make sure you have an __init__.py in that directory.
> 
> Michael
> 
> On 6/29/07, Carl Karsten <[EMAIL PROTECTED]> wrote:
>> Carl Karsten wrote:
>>> Christian Joergensen wrote:
>>>> Carl Karsten wrote:
>>>>> nicely formated template code generates lots of CRs in the resulting 
>>>>> html.  I am
>>>>> trying to figure out how to make the html a bit easier to read.
>>>>>
>>>>> for instance, how can I make this:
>>>>>
>>>>> <td{% if not day.in_month %} class="cal_not_in_month"{% endif %}
>>>>> {% ifequal day.day day.today %} class="today"{% endifequal %}>
>>>>>
>>>>> Not put the CR inside the <td> ?
>>>>>
>>>>> I realize i may be asking for magic, but I am thinking maybe something 
>>>>> like skip
>>>>> the CR for lines ending with %}
>>>> I used something like this once. However, you should think twice before
>>>> adding it on a busy site.
>>> This is just for development.  Once it goes into production I don't care 
>>> what
>>> the html looks like as much.
>>>
>>>> from BeautifulSoup import BeautifulSoup
>>>>
>>>> class BeautifulSoupPrettifyMiddleware(object):
>>>>
>>>>     def process_response(self, request, response):
>>>>
>>>>         if 'text/html' in response['Content-Type']:
>>>>
>>>>             soup = BeautifulSoup(response.content)
>>>>             response.content = soup.prettify()
>>>>
>>>>         return response
>>>>
>>> This will help. Where do I put that code?
>> http://www.djangoproject.com/documentation/middleware/
>>
>> Now to figure out
>> MIDDLEWARE_CLASSES = ( ...
>>      'gtd.adjenda.middleware.bsp.BeautifulSoupPrettifyMiddleware',
>>
>> ImproperlyConfigured: Error importing middleware gtd.adjenda.middleware.bsp: 
>> "No
>> module named adjenda.middleware.bsp"
>>
>> ImproperlyConfigured: Error importing middleware middleware.bsp: "No module
>> named middleware.bsp"
>>
>>
>> Carl K
>>
> 
> > 
> 

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

Reply via email to