def handle(self, *args, **options):
        self.stdout.write('*****  Do not run this procedure frequently!  *****\n')


        self.stdout.write('\nGet mini details of each Researcher\'s Publications\n')
        # for researcher in Researcher.objects.filter(publishes=True).exclude(symplectic_int_id__isnull=True): # for int_id version


        # loop over all the Researchers
        for researcher in Researcher.objects.filter(
            publishes=True
            ).exclude(symplectic_id__isnull=True): # for guid version

            self.stdout.write('    %s\n' % str(researcher))

            #
            get_authoreds(researcher)

        #
        #     #
        #     # try:
        #     #     self.stdout.write('    %s\n' % str(researcher))
        #     # except (Exception,), err:
        #     #     self.stdout.write('Error with researcher: %s; %s\n' % (researcher.person.id, err))
        #     # try:
        #     #     get_authoreds(researcher)
        #     # except (Exception,), err:
        #     #     self.stdout.write('I ignored this researcher: %s; %s\n' % (researcher, err))


        # raise Exception

        self.stdout.write('\nGet full details of ALL Publications\n')
        for publication in Publication.objects.all():
            # self.stdout.write(str(publication) + "\n")
            update_publication(publication)


            # try:
            #     self.stdout.write(str(publication) + "\n")
            #     update_publication(publication)
            # except (Exception,), err:
            #     self.stdout.write('Issue with %s : %s\n' % (str(publication), err))


        self.stdout.write('Got all Publications\n')
    def handle(self, *args, **options):

        self.stdout.write("\nGet mini details of each Researcher`s Publications\n")
        # for researcher in Researcher.objects.filter(publishes=True).exclude(symplectic_int_id__isnull=True):  # for int_id version
        for researcher in Researcher.objects.filter(publishes=True).exclude(
            symplectic_id__isnull=True
        ):  # for guid version
            self.stdout.write("    %s %s\n" % (str(researcher), str(researcher.person_id)))

            get_authoreds(researcher)

            # try:
            #     self.stdout.write('    %s\n' % str(researcher))
            # except (Exception,), err:
            #     self.stdout.write('Error with researcher: %s; %s\n' % (researcher.person.id, err))
            # try:
            #     get_authoreds(researcher)
            # except (Exception,), err:
            #     self.stdout.write('I ignored this researcher: %s; %s\n' % (researcher, err))

        self.stdout.write("\nFlag Publications modified within last 2 days\n")
        twodaysago = datetime.date.today() - datetime.timedelta(5)
        since = str(twodaysago.year) + "-" + str(twodaysago.month) + "-" + str(twodaysago.day)
        self.stdout.write("since: %s\n" % since)
        mark_changed_publications(since)

        self.stdout.write("\nGet full details of flagged Publications\n")
        self.stdout.write(str(Publication.objects.filter(needs_refetch=True).count()) + "\n")
        for publication in Publication.objects.filter(needs_refetch=True):
            try:
                self.stdout.write(str(publication) + " " + str(publication.bibliographic_records.all()[0].title) + "\n")
            except UnicodeEncodeError:
                self.stdout.write(str(publication) + "Unicode error!" + "\n")

            update_publication(publication)

            # try:
            #     self.stdout.write(str(publication) + "\n")
            #     update_publication(publication)
            # except (Exception,), err:
            #     self.stdout.write('Issue with %s : %s\n' % (publication, err))

        self.stdout.write("\nGot Publications\n")