[personal profile] tymofiy
def url2store(retailerID, address):
	"""
	Given a store's name & address, url2store() queries the db and returns
	the indicated store.
	"""

qs = Store.objects.filter(retailer=retailerID)
	logging.warning('url2store(): found %d stores for retailer #%s' %
			(qs.count(), retailerID))

numStores = qs.count()

if numStores == 0:
		return None
	elif numStores == 1:
		return qs[0]
	else:
		#  More than one store with this name; have to search for the address.
		#  First we need to break it back down into it's constituent parts…
		#  Далі йде розбір урла на шматки вручну, без регекспів.

Читаючи таке я аж перестаю відчувати себе ідіотом. Одне тільки непокоїть — чи не замало грошей попросив за те щоб вичистити ці Авгієві конюшні.

If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Tags