# Path: remo/base/utils.py
# def absolutify(url):
# def get_object_or_none(model_class, **kwargs):
# def get_or_create_instance(model_class, **kwargs):
# def go_back_n_months(date, n=1, first_day=False):
# def go_fwd_n_months(date, n=1, first_day=False):
# def latest_object_or_none(model_class, field_name=None):
# def month2number(month):
# def number2month(month, full_name=True):
# def add_permissions_to_groups(app, permissions):
# def validate_datetime(data, **kwargs):
# def get_date(days=0, weeks=0):
# def daterange(start_date, end_date):
# def get_quarter(date=None):


import re
import time
import urllib
import urlparse
import jinja2
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.staticfiles.storage import staticfiles_storage
from django.core.urlresolvers import reverse
from django.template import defaultfilters
from django.template.loader import render_to_string
from django.utils.encoding import smart_str
from django.utils.html import strip_tags
from markdown import markdown as python_markdown
from django_jinja import library
from product_details import product_details
from remo.base import utils
def ical_format_lines(text):
    """Make a string folded as defined in RFC5545.

    Original code from https://github.com/collective/icalendar
    Altered by John Giannelos <jgiannelos@mozilla.com>

    """

    ret_line = u''
    byte_count = 0
    for char in text:
        char_byte_len = len(char.encode('utf-8'))
        byte_count += char_byte_len
        if byte_count >= LINE_LIMIT:
            ret_line += FOLD_SEP
            byte_count = char_byte_len
        ret_line += char

    return ret_line


@library.global_function
def get_attr(obj, value, default):
    """Add a gettatr helper in templates."""
    return getattr(obj, value, default)


@library.filter
def absolutify(url):
    """Prepend the SITE_URL to the url."""

# Path: remo/base/utils.py
# def absolutify(url):
# def get_object_or_none(model_class, **kwargs):
# def get_or_create_instance(model_class, **kwargs):
# def go_back_n_months(date, n=1, first_day=False):
# def go_fwd_n_months(date, n=1, first_day=False):
# def latest_object_or_none(model_class, field_name=None):
# def month2number(month):
# def number2month(month, full_name=True):
# def add_permissions_to_groups(app, permissions):
# def validate_datetime(data, **kwargs):
# def get_date(days=0, weeks=0):
# def daterange(start_date, end_date):
# def get_quarter(date=None):


# Path: remo/base/templatetags/helpers.py
import re
import time
import urllib
import urlparse
import jinja2
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.staticfiles.storage import staticfiles_storage
from django.core.urlresolvers import reverse
from django.template import defaultfilters
from django.template.loader import render_to_string
from django.utils.encoding import smart_str
from django.utils.html import strip_tags
from markdown import markdown as python_markdown
from django_jinja import library
from product_details import product_details
from remo.base import utils

def ical_format_lines(text):
    """Make a string folded as defined in RFC5545.

    Original code from https://github.com/collective/icalendar
    Altered by John Giannelos <jgiannelos@mozilla.com>

    """

    ret_line = u''
    byte_count = 0
    for char in text:
        char_byte_len = len(char.encode('utf-8'))
        byte_count += char_byte_len
        if byte_count >= LINE_LIMIT:
            ret_line += FOLD_SEP
            byte_count = char_byte_len
        ret_line += char

    return ret_line


@library.global_function
def get_attr(obj, value, default):
    """Add a gettatr helper in templates."""
    return getattr(obj, value, default)


@library.filter
def absolutify(url):
    """Prepend the SITE_URL to the url."""

    return utils.absolutify(url)