Skip to content

Commit

Permalink
Fixed bug where we were actually over-escaping. Not sure what the rig…
Browse files Browse the repository at this point in the history
…ht thing to do is there. Also, fixed bug where it would never actually hit the database.
  • Loading branch information
ericflo committed May 26, 2008
1 parent 71b975b commit c5d71b2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions oembed/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
from django.utils import simplejson
from django.conf import settings
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
#from django.utils.html import conditional_escape
from oembed.models import ProviderRule, StoredOEmbed

conditional_escape = lambda x: x

END_OVERRIDES = (')', ',', '.', '>', ']', ';')
MAX_WIDTH = getattr(settings, "OEMBED_MAX_WIDTH", 320)
MAX_HEIGHT = getattr(settings, "OEMBED_MAX_HEIGHT", 240)
Expand Down Expand Up @@ -106,13 +108,15 @@ def replace(text, max_width=MAX_WIDTH, max_height=MAX_HEIGHT):
to_append += part[-1]
part = part[:-1]
indices.append(index)
urls.update(part)
urls.add(part)
indices_rules.append(i)
parts.append(part)
print part
index += 1
if to_append:
parts.append(to_append)
index += 1
print urls
for stored_embed in StoredOEmbed.objects.filter(match__in=urls, max_width=max_width, max_height = max_height):
stored[stored_embed.match] = stored_embed
for i, id_to_replace in enumerate(indices):
Expand Down

0 comments on commit c5d71b2

Please sign in to comment.