django.utils.six.moves.builtins.str

Here are the examples of the python api django.utils.six.moves.builtins.str taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

12 Examples 7

Example 1

Project: django-scheduler
Source File: calendars.py
View license
    def get_or_create_calendar_for_object(self, obj, distinction=None, name=None):
        """
        >>> user = User(username="jeremy")
        >>> user.save()
        >>> calendar = Calendar.objects.get_or_create_calendar_for_object(user, name = "Jeremy's Calendar")
        >>> calendar.name
        "Jeremy's Calendar"
        """
        try:
            return self.get_calendar_for_object(obj, distinction)
        except Calendar.DoesNotExist:
            if name is None:
                calendar = Calendar(name=str(obj))
            else:
                calendar = Calendar(name=name)
            calendar.slug = slugify(calendar.name)
            calendar.save()
            calendar.create_relation(obj, distinction)
            return calendar

Example 2

Project: django-scheduler
Source File: calendars.py
View license
    def get_or_create_calendar_for_object(self, obj, distinction=None, name=None):
        """
        >>> user = User(username="jeremy")
        >>> user.save()
        >>> calendar = Calendar.objects.get_or_create_calendar_for_object(user, name = "Jeremy's Calendar")
        >>> calendar.name
        "Jeremy's Calendar"
        """
        try:
            return self.get_calendar_for_object(obj, distinction)
        except Calendar.DoesNotExist:
            if name is None:
                calendar = Calendar(name=str(obj))
            else:
                calendar = Calendar(name=name)
            calendar.slug = slugify(calendar.name)
            calendar.save()
            calendar.create_relation(obj, distinction)
            return calendar

Example 3

Project: django-scheduler
Source File: rules.py
View license
    def get_params(self):
        """
        >>> rule = Rule(params = "count:1;bysecond:1;byminute:1,2,4,5")
        >>> rule.get_params()
        {'count': 1, 'byminute': [1, 2, 4, 5], 'bysecond': 1}
        """
        if self.params is None:
            return {}
        params = self.params.split(';')
        param_dict = []
        for param in params:
            param = param.split(':')
            if len(param) == 2:
                param = (str(param[0]), [int(p) for p in param[1].split(',')])
                if len(param[1]) == 1:
                    param = (param[0], param[1][0])
                param_dict.append(param)
        return dict(param_dict)

Example 4

Project: django-scheduler
Source File: rules.py
View license
    def get_params(self):
        """
        >>> rule = Rule(params = "count:1;bysecond:1;byminute:1,2,4,5")
        >>> rule.get_params()
        {'count': 1, 'byminute': [1, 2, 4, 5], 'bysecond': 1}
        """
        if self.params is None:
            return {}
        params = self.params.split(';')
        param_dict = []
        for param in params:
            param = param.split(':')
            if len(param) == 2:
                param = (str(param[0]), [int(p) for p in param[1].split(',')])
                if len(param[1]) == 1:
                    param = (param[0], param[1][0])
                param_dict.append(param)
        return dict(param_dict)

Example 5

Project: django-scheduler
Source File: atom.py
View license
    def write_link_construct(self, handler, link):
        if 'length' in link:
            link['length'] = str(link['length'])
        handler.addQuickElement(u'link', None, link)

Example 6

Project: django-scheduler
Source File: ical.py
View license
    def item_summary(self, item):
        return str(item)

Example 7

Project: django-scheduler
Source File: __init__.py
View license
    def item_id(self, item):
        return str(item.id)

Example 8

Project: django-scheduler
Source File: __init__.py
View license
    def item_uid(self, item):
        return str(item.id)

Example 9

Project: django-scheduler
Source File: atom.py
View license
    def write_link_construct(self, handler, link):
        if 'length' in link:
            link['length'] = str(link['length'])
        handler.addQuickElement(u'link', None, link)

Example 10

Project: django-scheduler
Source File: ical.py
View license
    def item_summary(self, item):
        return str(item)

Example 11

Project: django-scheduler
Source File: __init__.py
View license
    def item_id(self, item):
        return str(item.id)

Example 12

Project: django-scheduler
Source File: __init__.py
View license
    def item_uid(self, item):
        return str(item.id)