kyu999
11/20/2014 - 3:32 AM

backup

backup

"""
    def swap_iterate(self, cursor):
      if(not cursor.alive):
        return "Finish"

      data = cursor.next()

      swapped_date = self.swap_date(data.get("date"))
      data["date"] = swapped_date
      self.coll.save(data)
      return self.swap_iterate(cursor) 

    def swap_all_date(self):
      return self.swap_iterate(self.coll.find())
    """

    """
    def replace_today(self):
      cursor = self.coll.find({"date" : "Today"})
      while(cursor.alive):
        manga = cursor.next()
        manga["date"] = "2014-11-18"
        self.coll.save(manga)

    """

    def to_int_views(self, start, end):
      cursor = self.coll.find()[start:end]
      while(cursor.alive):
        try:
          content = cursor.next()
          str_views = content["views"]
          int_views = int(str_views)
          content["views"] = int(str_views)
          print(int_views)
          self.coll.save(content)
        except:
          print("cannot convert to int")