Пример #1
0
                                article = article
                            )
                            img.save()
                    status +=  '-- Imported images for new story %s<br>' % article.headline
            else:
                if article.headline != story['headline']:
                    article.headline  = story['headline']
                if article.summary  != story['summary']:
                    article.summary   = story['summary']
                if article.body     != story['body']:
                    article.body      = story['body']
                    status += 'updating story: %s <br>' % article.headline
                if article.dateline  != story['dateline']:
                    article.dateline = story['dateline']
                if article.overline  != story['overline']:
                    article.overline = story['overline']

                if article.id and story.has_key('images'):
                    img_count = 0
                    for photo_id, photo in story['images'].items():
                        dupe = False
                        filename = photo['source_url'].rsplit('/', 1)[1]
                        path_str = get_image_path(filename, pub_date)
                        shortname = path_str.split('.')[0] # get file name before the first period. Ex: /img/articles/mypic
                        #print shortname
                        #if shortname in current_images:
                        #   print 'found dupe'
                        #   dupe = True
                        #   status += "found match for %s in current_images: %s, skipping<br>" % (shortname, current_images)
                        #   break
                        for i, s in enumerate(current_images):