refactoring 'view' code

8 views
Skip to first unread message

Barry

unread,
Feb 28, 2011, 11:49:41 AM2/28/11
to django-lfc
One of the limitations of LFC is that everything considered 'content'
hits the same view code (base_view) in views.py. That function then
decides what to do with it, and one thing it does early on is to see
if the object is a 'Portal' object and if so it dispatches to the
portal view function.

Testing an object's class and calling a function based on that? Smells
like object-orientation done wrong. The object itself should have a
'view' method, and the main view code should just call that. It would
be much neater. Something like:

# Get the obj (passed by LFC Middleware)
obj = request.META.get("lfc_context")
obj.view(.....)

Now the rest of the view code is in the base class for content types
or Portal types, and it means content types can override the view code
and do neat things - for example you could have a 'Redirect' content
type that just did an http redirect to another URL. This would then
appear in the navigation, have the LFC permissions etc, but when the
user clicks it they bounce off to another location. I can't see a way
of doing that with the current view code and content type
implementation. There are hacks to do it but they get messy...

Kai D seems very quiet on LFC these days - shame, it looks better than
django-cms in many ways.

Kai Diefenbach

unread,
Feb 28, 2011, 12:15:20 PM2/28/11
to djang...@googlegroups.com
Hi, 

Sounds good so far. 

Please consider  to fork LFC on bitbucket and send me a pull request.

Kai D seems very quiet on LFC these days - shame, it looks better than
django-cms in many ways.

Yes, but I'm still here. The reason for being quite is to much payed work at the moment. As soon as I'm through it the development of LFC and LFS will go on. This will be in two months at the latest I think.

Kai

--
IQ++
Tel: +49 361 / 6636700
Fax: +49 361 / 6636702
Mail: kai.die...@iqpp.de
Web: http://www.iqpp.de
Skype: kai.diefenbach

Barry

unread,
Mar 7, 2011, 10:50:17 AM3/7/11
to django-lfc


On Feb 28, 5:15 pm, Kai Diefenbach <kai.diefenb...@iqpp.de> wrote:

> Sounds good so far.
>
> Please consider  to fork LFC on bitbucket and send me a pull request.
>
> > Kai D seems very quiet on LFC these days - shame, it looks better than
> > django-cms in many ways.
>
> Yes, but I'm still here. The reason for being quite is to much payed work at the moment. As soon as I'm through it the development of LFC and LFS will go on. This will be in two months at the latest I think.

Great to hear from you! Maybe the project needs some sponsors?

In a way it would be paid work for me, since we want to use it for
our web site, and that's mine and my technicians' jobs - but we have a
zillion other things to do as well. Darn users.

Might get some programming time this week.

Barry
Reply all
Reply to author
Forward
0 new messages