How to I iterate over object in a URL from Plone using a python script

**I am using Plone. I have Staff and Faculty objects stored under the following url
http://mysite/yc1/portal_college/
I would like to iterate over all the Faculty Object and make modifications
So far, I have been using QueryCatalog. When I use this and update the object, it changes in the instance of the code that I am running, but it does not change in the ZODB database.
What is the best way of doing this?

My Code:
from AccessControl import getSecurityManager
from StringIO import StringIO
from Products.CMFCore.utils import getToolByName

membership = getToolByName(context, 'portal_membership')
username = context.portal_membership.getAuthenticatedMember().getUserName()

buf = StringIO()

items = list(context.portal_catalog.queryCatalog({
"portal_type":("Faculty"),
"path":"/yc1/portal_college/bbharosay",
"sort_on" : "created" }))

context.manage_setLocalRoles(username, ['Manager', 'Owner','Editor'])

print >> buf, "Found %d items to be Updated" % len(items)
getSecurityManager().checkPermission('View', context)
roles2 = [r['name'] for r in context.rolesOfPermission('View') if r['selected']]

count = 0
for b in items:
obj = b.getObject()

d='dummyvalue'
print obj.getADStatus()
try:
  print obj.getADStatus()
  obj.setFirst_name(d)
  obj.setLast_name(d)
  obj.setTeachingTitle(d)
  obj.setOtherTitle(d)
  obj.setEmail(d);
  obj.setOfficePhone(d)
  obj.setOfficeLocation(d)
  obj.setDept(d);
  obj.setEmployeeType(d)
  obj.setDivision(d)
  obj.setCurrentStatus(d)
  obj.setOrgStatus(d)
  print obj.getFirst_name()
  print '\n'
  print obj.getLast_name()
  obj.setLast_namek('budwa')
  print "obj lastname="+obj.getLast_name()
  modified(obj)
  obj.reindexObject()
except Exception:
  #pass
  print Exception
count=count+1
print count

print 'done'
return buf.getvalue(), printed**

since code formatting in this forum is really crappy and its nearly impossible to read the code, I suggest you to use https://pastie.org or https://gist.github.com or similar and paste the url here.

Isn't this essentially the same questions as Portal Catalog object not updating ?

Please finish that question before posting again.

What is the output? What are you using to list objects? Your code is very weird. I'd be surprised it actually ever ran successfully.

what is the line "modified(obj)" for? What are you doing with manage_setLocalRoles, checkPermission and rolesOfPermission?

Lots of weird stuff going. Please don't double post. Simplify your problem.