# Path: common/models.py
# PRIVACY_PRIVATE = 1
# PRIVACY_CONTACTS = 2
# PRIVACY_PUBLIC = 3
# ACTOR_ALLOWED_EXTRA = ('contact_count', 
#                        'follower_count', 
#                        'icon', 
#                        'description',
#                        'member_count', 
#                        'admin_count', 
#                        'given_name', 
#                        'family_name'
#                        )
# ACTOR_LIMITED_EXTRA = ('icon', 
#                        'description',
#                        'given_name', 
#                        'family_name'
#                        )
# def _get_actor_type_from_nick(nick):
# def _get_actor_urlnick_from_nick(nick):
# def _to_api(v):
#   def to_api(self):
#   def __init__(self, parent=None, key_name=None, _app=None, **kw):
#   def key_from(cls, **kw):
#   def _remove_from_cache(self):
#   def put(self):
#   def save(self):
#   def delete(self):
#   def get_by_key_name(cls, key_names, parent=None):
#   def db_get_count(cls):
#   def reset_cache(cls):
#   def enable_cache(cls, enabled = True):
#   def reset_get_count(cls):
#   def gql(cls, *args, **kw):
#   def Query(cls):
#   def mark_as_deleted(self):
#   def is_deleted(self):
# def actor_url(nick, actor_type, path='', request=None, mobile=False):
#   def url(self, path="", request=None, mobile=False):
#   def shortnick(self):
#   def display_nick(self):
#   def to_api(self):
#   def to_api_limited(self):
#   def is_channel(self):
#   def is_public(self):
#   def is_restricted(self):
#   def __repr__(self):
#   def stream_entry_keyname(self):
#   def to_string(self):
#   def url(self):
#   def to_string(self):
#   def is_public(self):
#   def is_restricted(self):
#   def keyname(self):
#   def url(self, with_anchor=True, request=None, mobile=False):
#   def keyname(self):
#   def title(self):
#   def is_comment(self):
#   def is_channel(self):
#   def entry_actor(self):
#   def is_subscribed(self):
# class ApiMixinModel(aed_models.BaseModel):
# class CachingModel(ApiMixinModel):
# class DeletedMarkerModel(CachingModel):
# class AbuseReport(CachingModel):
# class Activation(CachingModel):
# class Actor(DeletedMarkerModel):
# class Image(CachingModel):
# class InboxEntry(CachingModel):
# class Invite(CachingModel):
# class KeyValue(CachingModel):
# class OAuthAccessToken(CachingModel):
# class OAuthConsumer(CachingModel):
# class OAuthNonce(CachingModel):
# class OAuthRequestToken(CachingModel):
# class Presence(CachingModel):
# class Task(CachingModel):
# class Relation(CachingModel):
# class Stream(DeletedMarkerModel):
# class StreamEntry(DeletedMarkerModel):
# class Subscription(CachingModel):


import datetime
import re
from markdown import markdown2
from django import template
from django.conf import settings
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from django.utils.html import escape
from django.utils.timesince import timesince
from common.util import create_nonce, safe, display_nick, url_nick
from common import clean
from common import models
    title = escape(truncate(value.extra['title'].replace('\n', ' '), max_len))

  return '<a href="%s">%s</a>' % (value.url(), title)

@register.filter(name="stream_icon")
@safe
def stream_icon(value, arg=None):
  return '<img src="/themes/%s/icons/favku.gif" class="icon" />' % settings.DEFAULT_THEME
  if type(value) is type(1):
    return '<!-- TODO entry icon goes here -->'
  return '<!-- TODO entry icon goes here -->'

@register.filter(name="je_timesince")
@safe
def je_timesince(value, arg=None):
  d = value
  if (datetime.datetime.now() - d) < datetime.timedelta(0,60,0):
    return "a moment"
  else:
    return timesince(d)

@register.filter
@safe
def entry_actor_link(value, request=None):
  """
  Returns an actor html link.

  value     an entry_actor object.
  request   a HttpRequest (optional).
  """

# Path: common/models.py
# PRIVACY_PRIVATE = 1
# PRIVACY_CONTACTS = 2
# PRIVACY_PUBLIC = 3
# ACTOR_ALLOWED_EXTRA = ('contact_count', 
#                        'follower_count', 
#                        'icon', 
#                        'description',
#                        'member_count', 
#                        'admin_count', 
#                        'given_name', 
#                        'family_name'
#                        )
# ACTOR_LIMITED_EXTRA = ('icon', 
#                        'description',
#                        'given_name', 
#                        'family_name'
#                        )
# def _get_actor_type_from_nick(nick):
# def _get_actor_urlnick_from_nick(nick):
# def _to_api(v):
#   def to_api(self):
#   def __init__(self, parent=None, key_name=None, _app=None, **kw):
#   def key_from(cls, **kw):
#   def _remove_from_cache(self):
#   def put(self):
#   def save(self):
#   def delete(self):
#   def get_by_key_name(cls, key_names, parent=None):
#   def db_get_count(cls):
#   def reset_cache(cls):
#   def enable_cache(cls, enabled = True):
#   def reset_get_count(cls):
#   def gql(cls, *args, **kw):
#   def Query(cls):
#   def mark_as_deleted(self):
#   def is_deleted(self):
# def actor_url(nick, actor_type, path='', request=None, mobile=False):
#   def url(self, path="", request=None, mobile=False):
#   def shortnick(self):
#   def display_nick(self):
#   def to_api(self):
#   def to_api_limited(self):
#   def is_channel(self):
#   def is_public(self):
#   def is_restricted(self):
#   def __repr__(self):
#   def stream_entry_keyname(self):
#   def to_string(self):
#   def url(self):
#   def to_string(self):
#   def is_public(self):
#   def is_restricted(self):
#   def keyname(self):
#   def url(self, with_anchor=True, request=None, mobile=False):
#   def keyname(self):
#   def title(self):
#   def is_comment(self):
#   def is_channel(self):
#   def entry_actor(self):
#   def is_subscribed(self):
# class ApiMixinModel(aed_models.BaseModel):
# class CachingModel(ApiMixinModel):
# class DeletedMarkerModel(CachingModel):
# class AbuseReport(CachingModel):
# class Activation(CachingModel):
# class Actor(DeletedMarkerModel):
# class Image(CachingModel):
# class InboxEntry(CachingModel):
# class Invite(CachingModel):
# class KeyValue(CachingModel):
# class OAuthAccessToken(CachingModel):
# class OAuthConsumer(CachingModel):
# class OAuthNonce(CachingModel):
# class OAuthRequestToken(CachingModel):
# class Presence(CachingModel):
# class Task(CachingModel):
# class Relation(CachingModel):
# class Stream(DeletedMarkerModel):
# class StreamEntry(DeletedMarkerModel):
# class Subscription(CachingModel):


# Path: common/templatetags/format.py
import datetime
import re
from markdown import markdown2
from django import template
from django.conf import settings
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from django.utils.html import escape
from django.utils.timesince import timesince
from common.util import create_nonce, safe, display_nick, url_nick
from common import clean
from common import models

    title = escape(truncate(value.extra['title'].replace('\n', ' '), max_len))

  return '<a href="%s">%s</a>' % (value.url(), title)

@register.filter(name="stream_icon")
@safe
def stream_icon(value, arg=None):
  return '<img src="/themes/%s/icons/favku.gif" class="icon" />' % settings.DEFAULT_THEME
  if type(value) is type(1):
    return '<!-- TODO entry icon goes here -->'
  return '<!-- TODO entry icon goes here -->'

@register.filter(name="je_timesince")
@safe
def je_timesince(value, arg=None):
  d = value
  if (datetime.datetime.now() - d) < datetime.timedelta(0,60,0):
    return "a moment"
  else:
    return timesince(d)

@register.filter
@safe
def entry_actor_link(value, request=None):
  """
  Returns an actor html link.

  value     an entry_actor object.
  request   a HttpRequest (optional).
  """

  return '<a href="%s">%s</a>' % (models.actor_url(url_nick(value),