from django.core import serializers

def load():
    listing3 = open( 'sqlite_data/listing.xml')
    listing3_data = listing3.read()
   
    des= serializers.deserialize( "xml", listing3_data )
   
    for each_des in des:
        print each_des
        #check if an object has attribute name 'short_description'
        if getattr( each_dess.object , 'short_description' , ''):
        
            if len( each_des.object.short_description) > 240:
                #Cut off text if it exceeds limit
                each_des.object.short_description =
each_des.object.short_description[:240]
                each_des.save()


