473,394 Members | 1,226 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

does python support mvc architecture

Hi
Does python support MVC architecture? Java has register & notify
obsever methods in javax.util . Does python has these functions. If
not then how to register the views with the models & how to notify the
views that the model has been updated??
Jul 18 '05 #1
4 2295
<ke***********@yahoo.com> wrote in message
news:f0*************************@posting.google.co m...
Hi
Does python support MVC architecture? Java has register & notify
obsever methods in javax.util . Does python has these functions. If
not then how to register the views with the models & how to notify the
views that the model has been updated??


I don't know of a notifier class in the standard library,
but it's not all that difficult to write one. This is the
one I am currently using:

-----------------------------------------------------
# module Notify

class Notify(object):
def __init__(self):
self.listenerList = []

def sendMessage(self, event):
for callback in self.listenerList:
callback(event)
return

def addListener(self, callback):
self.listenerList.append(callback)

def removeListener(self, callback):
self.listenerList.remove(callback)
-----------------------------------------------------

callback has to be a callable of some kind,
a bound method is perfectly acceptable and
that's what I use. Works great.

John Roth
Jul 18 '05 #2
"John Roth" <ne********@jhrothjr.com> writes:
<ke***********@yahoo.com> wrote in message
news:f0*************************@posting.google.co m...
Hi
Does python support MVC architecture? Java has register & notify
obsever methods in javax.util . Does python has these functions. If
not then how to register the views with the models & how to notify the
views that the model has been updated??


I don't know of a notifier class in the standard library,
but it's not all that difficult to write one. This is the
one I am currently using:

-----------------------------------------------------
# module Notify

class Notify(object):
def __init__(self):
self.listenerList = []

def sendMessage(self, event):
for callback in self.listenerList:
callback(event)
return

def addListener(self, callback):
self.listenerList.append(callback)

def removeListener(self, callback):
self.listenerList.remove(callback)
-----------------------------------------------------

callback has to be a callable of some kind,
a bound method is perfectly acceptable and
that's what I use. Works great.


I can heartily recommend the dispatcher module from Patrick O'Brian.
I'm still using a hacked up version from ActiveState's Python cookbook,
but there's also a newer version on sourceforge.

Thomas
Jul 18 '05 #3
DH
Does python support MVC architecture? Java has register & notify
obsever methods in javax.util . Does python has these functions. If
not then how to register the views with the models & how to notify the
views that the model has been updated??


The one that is closest to Java's implementation is here:
http://jamesthornton.com/eckel/TIPython/code/util/
but see also:
http://sra.itc.it/people/cavada/mvc/index.html
http://sourceforge.net/projects/pydispatcher/

And various python frameworks have Observable support built-in, such as
Twisted, anygui, WCK, etc.
Jul 18 '05 #4
DH a écrit :
Does python support MVC architecture? Java has register & notify
obsever methods in javax.util . Does python has these functions. If
not then how to register the views with the models & how to notify the
views that the model has been updated??

The one that is closest to Java's implementation is here:
http://jamesthornton.com/eckel/TIPython/code/util/
but see also:
http://sra.itc.it/people/cavada/mvc/index.html
http://sourceforge.net/projects/pydispatcher/

And various python frameworks have Observable support built-in, such as
Twisted, anygui, WCK, etc.


http://www.python.org/cgi-bin/moinmo...tionEventModel

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Grant Edwards | last post by:
I've read over and over that Python leaves floating point issues up to the underlying platform. This seems to be largely true, but not always. My underlying platform (IA32 Linux) correctly...
8
by: Brendan | last post by:
Hello, I just tried to use the Windows XP installer for Python 2.5 AMD64 but I get the error message: "Installation package not supported by processor type" I am running Windows XP Pro on an...
113
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside...
34
by: Victor Kryukov | last post by:
Hello list, our team is going to rewrite our existing web-site, which has a lot of dynamic content and was quickly prototyped some time ago. Today, as we get better idea of what we need, we're...
4
by: Arnaud Delobelle | last post by:
Hi fellow python enthusiasts. Having recently acquired a MacBook Pro (Intel Core 2 Duo) which comes with python2.5, I have been installing some modules that I need (PIL, psycopg2, PyXML ...). ...
145
by: Dave Parker | last post by:
I've read that one of the design goals of Python was to create an easy- to-use English-like language. That's also one of the design goals of Flaming Thunder at http://www.flamingthunder.com/ ,...
1
by: M.-A. Lemburg | last post by:
On 2008-07-25 08:13, python@bdurham.com wrote: Yes. But then Intel Itanium is being phased out anyway and the AMD64 build works on both Intel and AMD processors. True.
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.