def eval(self, platform, tag): warning = '' if not select(count(t) for t in Tag if t.platform == platform.lower())[:][0]: platforms = ', '.join(sorted(select(t.platform for t in Tag)[:])) warning = bold('WARNING: creating a new platform. Please check that the platform doesn\'t already ' 'exist by another name.\n') + 'Current platforms are ' + platforms + '\n' Tag.create_or_update(user=self.user, platform=platform.lower(), tag=tag) return "%s%s added as %s tag for %s" % (warning, tag, platform.title(), self.name)
def eval(self, name, platform, tag): user = self.from_name(name) if user is None: raise CommandFailure("User not found") warning = '' if not select(count(t) for t in Tag if t.platform == platform.lower())[:][0]: platforms = ', '.join(sorted(select(t.platform for t in Tag)[:])) warning = bold('WARNING: creating a new platform. Please check that the platform doesn\'t already ' 'exist by another name.\n') + 'Current platforms are ' + platforms + '\n' Tag.create_or_update(user=int(user.id), platform=platform.lower(), tag=tag) return "%s%s added as %s tag for %s" % (warning, tag, platform.title(), user.name)
def eval(self, platform, tag): Tag.create_or_update(user=self.user, platform=platform, tag=tag) return "%s added as %s tag for %s" % (tag, platform, self.name)