Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* fixed youtube tag not encoding it's urls

  • Loading branch information...
commit f26a0ad163bc28d45f3cac79abf856efe5aa3189 1 parent 2a29f26
ojii authored
Showing with 11 additions and 10 deletions.
  1. +6 −5 __init__.py
  2. +5 −5 bbtags/web.py
View
11 __init__.py
@@ -28,10 +28,8 @@
try:
from django.utils.translation import ugettext as _
- from django.conf import settings
except ImportError:
_ = lambda x: x
- settings = {}
AUTODISCOVERED = False
@@ -197,7 +195,7 @@ def append(self, text):
"""
Adds a text node to the node
"""
- self.nodes.append(TextNode(text))
+ self.nodes.append(TextNode(self, text))
def push(self, nodeklass, match, fullcontent):
"""
@@ -265,8 +263,10 @@ def parse(self):
class TextNode(Node):
smilie_pattern = re.compile(':(?P<name>\w+):')
is_text_node = True
- def __init__(self, text):
+ def __init__(self, parent, text):
self.text = text
+ self.variables = parent.variables
+ self.parent = parent
self.raw_content = text
self.nodes = []
@@ -289,7 +289,7 @@ def parse(self):
"""
Return cgi-escaped content
"""
- return cgi.escape(self.text)
+ return cgi.escape(self.variables.resolve(self.text))
def __str__(self):
return 'TextNode: %r' % self.text
@@ -700,6 +700,7 @@ def validate(self, content, namespaces=None, auto_discover=False):
get_visual = lib.get_visual_parse_tree
def get_default_namespaces():
+ from django.conf import settings
if hasattr(settings, 'BBCODE_DEFAULT_NAMESPACES'):
return settings.BBCODE_DEFAULT_NAMESPACES
return ['__all__']
View
10 bbtags/web.py
@@ -147,11 +147,11 @@ def parse(self):
videoid = videoid[0]
return (
'<object width="560" height="340"><param name="movie" value="http:/'
- '/www.youtube.com/v/%s&hl=en&fs=1&"></param><param name="allowFullS'
- 'creen" value="true"></param><param name="allowscriptaccess" value='
- '"always"></param><embed src="http://www.youtube.com/v/%s&hl=en&fs='
- '1&" type="application/x-shockwave-flash" allowscriptaccess="always'
- '" allowfullscreen="true" width="560" heigh'
+ '/www.youtube.com/v/%s&amp;hl=en&amp;fs=1&amp;"></param><param name'
+ '="allowFullScreen" value="true"></param><param name="allowscriptac'
+ 'cess" value="always"></param><embed src="http://www.youtube.com/v/'
+ '%s&amp;hl=en&amp;fs=1&amp;" type="application/x-shockwave-flash" a'
+ 'llowscriptaccess="always" allowfullscreen="true" width="560" heigh'
)
Please sign in to comment.
Something went wrong with that request. Please try again.