Closed framazz closed 9 years ago
@framazz i'm currently traveling but you can temporarily disable compressor and use github master which supports django v1.5. pypi version w/ django v1.5 is not released but will be soon.
With compressor disabled and the modifications I made, I'm already ok for now. Waiting for the compressor to work. Thanks Francesca
The only thing is to change {% url tinymce-compressor %}
with {% url "tinymce-compressor" %}
it is already in the trunk. @aljosa please take the time to make a release :)
https://github.com/aljosa/django-tinymce/blob/master/tinymce/templates/tinymce/tiny_mce_gzip.js#L15
@framazz i've just pushed new version on pypi, please check if it works for you when you find time
I upgraded django-tinymce with pip. Compressor still not working Francesca
@framazz could you try again w/ github version? i've just pushed a possible fix for this issue
Sure, I'll give it a try and let you know
It works! Many thanks! Francesca
Hello, after getting the latest from Git, I get this error message:
ReferenceError: tinyMCE_GZ is not defined
Am I missing something?
@houmie could you post your settings?
@aljosa sure. I just tested it on a different PC. It shows the same problem on this line:
<script type="text/javascript">tinyMCE_GZ.init({"themes": "advanced", "languages": "en", "debug": false, "diskcache": true, "plugins": "media,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave"})</script>
Settings:
TINYMCE_COMPRESSOR = True
TINYMCE_DEFAULT_CONFIG = {
# General options
'mode' : "textareas",
'theme' : "advanced",
'plugins' : "media,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
'theme_advanced_buttons1_add' : "media",
'theme_advanced_buttons2_add' : "advimage",
# Theme options
'theme_advanced_buttons1' : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontselect,fontsizeselect,",
'theme_advanced_buttons2' : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,|,forecolor,backcolor",
'theme_advanced_toolbar_location' : "top",
'theme_advanced_toolbar_align' : "left",
'theme_advanced_statusbar_location' : "bottom",
'theme_advanced_resizing' : 'true',
#Example content CSS (should be your site CSS)
#content_css : "/css/style.css",
'template_external_list_url' : "lists/template_list.js",
'external_link_list_url' : "lists/link_list.js",
'external_image_list_url' : "lists/image_list.js",
'media_external_list_url' : "lists/media_list.js",
# Style formats
'style_formats' : [
{'title' : 'Bold text', 'inline' : 'strong'},
{'title' : 'Red text', 'inline' : 'span', 'styles' : {'color' : '#ff0000'}},
{'title' : 'Help', 'inline' : 'strong', 'classes' : 'help'},
{'title' : 'Table styles'},
{'title' : 'Table row 1', 'selector' : 'tr', 'classes' : 'tablerow'}
],
'width': '700',
'height': '400'
}
@houmie i'll try to find time to figure out why is this happening w/ different settings. please use previous commit if it worked for your use case
@houmie i'm trying to reproduce your problem but can't. is this what you expect to see?
could you provide more info, like python and django version?
@aljosa Thanks for getting back to that.
I can reproduce that on my local machine as described above
ReferenceError: tinyMCE_GZ is not defined
However on my production - I just realized - I don't get that. https://duelify.com/topics/add/
Would you be so kind and sign up there and F12 (Firebug) on that form and see if the compressor is truly working? I am new to your mod and not sure how I can check if the compressor is truly activated.
If it truly works on production, it means that it only doesn't work on runserver in dev environment.... as strangely as it may sound.
@houmie i think you have different settings on production. could you post info about software versions you're using: 1) output of "$ python --version" 2) django version 3) ouput of "$ pip freeze"
I tried using the source repo with Python 3.3 and pre-1.5.2 Django source. I got the following exception:
Traceback (most recent call last):
File "/Users/travis/src/uln/dependencies/django/django/core/handlers/base.py", line 115, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/Users/travis/src/uln/dependencies/django-tinymce/tinymce/views.py", line 109, in compressor
return gzip_compressor(request)
File "/Users/travis/src/uln/dependencies/django-tinymce/tinymce/compressor.py", line 124, in gzip_compressor
content = compress_string(''.join(content))
File "/Users/travis/src/uln/dependencies/django/django/utils/text.py", line 287, in compress_string
zfile.write(s)
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/gzip.py", line 339, in write
self.crc = zlib.crc32(data, self.crc) & 0xffffffff
TypeError: 'str' does not support the buffer interface
It seems to be happy if I don't enable compression.
I spend two hours on that bug again. Each time I want to use django-tinymce
it is a pain.
Same message as before, I configure it as simple as possible :
pip install django-tinymce
then
INSTALLED_APPS = (
...
'tinymce',
...
)
then
TINYMCE_COMPRESSOR = True
And in my form I use:
class Comment(models.Model):
message = models.CharField('message', max_length=100)
----
class CommentForm(forms.ModelForm):
class Meta:
model = Comment
widgets = {
'message': TinyMCE(attrs={'cols': 80, 'rows': 15}),
}
On my form.media I have:
<script type="text/javascript" src="/_tinymce/compressor/"></script>
<script type="text/javascript" src="/_tinymce/filebrowser/"></script>
But then in firebug I have an error : tinyMCE is not defined
I don't know what to do.
DJANGO = 1.5.2 PYTHON = 2.7.1
Btw it is not for a form displayed in the administration.
i'm currently not home, should be back before weekend and i'll try to provide something useful then
@Natim could you post your TINYMCE_DEFAULT_CONFIG?
This is it:
TINYMCE_DEFAULT_CONFIG = {
'plugins': "table,spellchecker,paste,searchreplace",
'theme': "advanced",
'theme_advanced_buttons1' : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontsizeselect,|,forecolor,backcolor,|,bullist,numlist,|,outdent,indent,|,sub,sup,|,charmap,emotions,separator,forecolor,backcolor",
'theme_advanced_buttons2' : "pastetext,pasteword,selectall,|,undo,redo,|,link,unlink,anchor,image,code,|,tablecontrols,|,fullscreen",
'theme_advanced_buttons3' : "",
'relative_urls': False
}
TINYMCE_COMPRESSOR = True
@Natim check https://github.com/aljosa/tinymce-example if it matches your code and this code deployed to heroku: http://tinymce-example.herokuapp.com/
also try your code with django-tinymce master on github
Related to #50
I installed django-tinymce with pip, as suggested, so I have version 1.5.1b4 I'm using Django 1.5.
My settings.py contains: INSTALLED_APPS = ( [omissis] 'django.contrib.staticfiles', 'tinymce', ) TINYMCE_JS_URL = os.path.join(STATIC_URL, "tiny_mce/tiny_mce_src.js") TINYMCE_JS_ROOT = os.path.join(STATIC_ROOT, "tiny_mce") TINYMCE_DEFAULT_CONFIG = { 'cleanup_on_startup': True, 'custom_undo_redo_levels':20, }
TINYMCE_COMPRESSOR = True
My urls.py includes url(r'^tinymce/', include('tinymce.urls')),
If i leave the TINYMCE_COMPRESSOR = True commented out, it works and I see the WYSIWYG tool, if I uncomment it, there is a simple textbox.
I modified templates/tinymce/tiny_mce_gzip.js adding {% load url from future %} and modified {% url tinimce-compressor %} to {% url "tinimce-compressor" %}
otherwise Django was complaining that it "Could not parse the remainder: '-compressor' from 'tinymce-compressor'."