All pastes #1954224 Raw Edit

Python minimalist MVC dreams and

public python v1 · immutable
#1954224 ·published 2010-10-04 18:40 UTC
rendered paste body
model = dbmodel.searchTerms = {'cat','cookie','catastrophe'}class view(mvc.views):	def home(doc, loading, suggestionList):		if loading:			doc.body.searchBox = Input(type = 'text')		doc.body.suggestions = Ol(join(map(Li,suggestionList)))class control(mvc.controls):	def home(doc):			def updateSuggestions(searchBoxValue=doc.body.searchBox.value):			if searchBoxValue == '': doc.update(suggestionList=model.searchTerms) 			else: doc.update(suggestionList=Query(model.searchTerms,searchBoxValue))		doc.load = updateSuggestions		doc.body.searchBox.keypress = updateSuggestions		doc.updateOnModelChanges(model.searchTerms, updateSuggestions)#or maybe something like:class control(mvc.controls):	def home(doc):			doc.load = doc.update(suggestionList=model.searchTerms)		doc.body.searchBox.keypress = doc.update(suggestionList=Query(model.searchTerms,doc.body.searchBox.value))		doc.watchForDataChanges(model.searchTerms, doc.lastState)#curious for any level of repetition it is useful to eliminate by better OO / structuring / message passing#really would like to have the most agile web development process