m***@acrisius.ca
2015-07-29 23:37:53 UTC
Hi,
My name's Mishra and I just started using Web2Py. I have some basic
knowledge in coding (HTML, PHP, CSS and Python.) I don't usually write on
forum as answers for most questions are already somewhere on the net, but I
don't figure the solution for this problem despite of my efforts.
I know there have been many questions on many forum created around these
topics, but I'm yet to find what I am looking for.
Thanks by advance for any help or comment.
*This is my goal: *
My goal is to make a very basic wiki with a rich text editor in it.
Everything works until the point where the program shows the content of the
page. Instead of showing the intended format, it shows the HTML tags. For
what I understand, it is suppose to do so to assure security.
I will be the sole user of this wiki, so I don't care much about injection.
I found the HTML helpers, particularly the XML() which looks to be the
solution to my problem.
*There is the problem: *
I can't seem to figure out where to put the XML() tag that will make the
HTML code works.
*There are the steps I took so far: *
I reinstalled Web2Py (it's not an installation, but you see what I mean.)
I created a new application which I named ''wikidemo.''
I used the wiki coming with Web2Py. So I modified the index of
''default.py'' controller, following the Wiki section of the Overview of
the Documentation for Web2Py (
http://www.web2py.com/book/default/chapter/03#The-built-in-web2py-wiki):
*def index(): return auth.wiki() *
For the rich text editor, I decided to use CKEditor.
I downloaded CKEditor through the plugin repository. (
http://127.0.0.1:8000/admin/default/plugins/wikidemo)
Following that, I added to my model ''db.py'':
*from plugin_ckeditor import CKEditor ckeditor = CKEditor(db)
ckeditor.define_tables() *
As it was written on the package page of CKEditor (
http://www.web2pyslices.com/slice/show/1952/)
I wasn't sure what I was suppose to make of the ''Basic Usage'' section.
Looking over the internet, I found that adding the following to my
''db.py'':
*auth.wiki(resolve=False) db.wiki_page.body.widget = ckeditor.widget *
Made that CKEditor was showing in the body section of the form used to
create new slug and that it added the right html tags for what I wanted to
do in the source code.
Once created, however, the page shows the html tags instead of showing the
intended format.
There are the steps I took to settle the problem:
My first thought was to put the XML() it in the ''default/index.html''
view. In the middle of the document there is this part:
*{{elif 'content' in globals():}} {{=content}} *
I thought changing this for
*{{elif 'content' in globals():}} {{=XML(content, sanitize=False)}} *
But it didn't work. As in, it showed the same thing as if I hadn't add
anything.
I also though using TAG on the ''content'' variable, but it didn't work
either (probably because the variable is not a string.)
My next thought was to find where is the ''content'' variable is created (I
understand that it is a variable, if it is not, please tell me) and to add
the XML() around the variables taken from my database to create the pages,
so the content created would be formatted the right way.
Except I don't know where or how the content of ''content'' is created, nor
if it is the right way to do what I intend to do (, nor if it is even
possible to do that kind of thing...)
Another solution might be to parse the text so that the HTML tags are
replaced by XML tags... Even then, I am not sure if it would work.
Thanks by advance for any help/comment and for the time you took to read
all this,
Mishra.
P.S.: I don't see how it could be related, but I use a Ubuntu installed on
an USB key for this project.
P.P.S: Web2Py is an incredible program and the community seems to be very
helpful (it's already been a lot for me.) Thank a lot to everyone.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
My name's Mishra and I just started using Web2Py. I have some basic
knowledge in coding (HTML, PHP, CSS and Python.) I don't usually write on
forum as answers for most questions are already somewhere on the net, but I
don't figure the solution for this problem despite of my efforts.
I know there have been many questions on many forum created around these
topics, but I'm yet to find what I am looking for.
Thanks by advance for any help or comment.
*This is my goal: *
My goal is to make a very basic wiki with a rich text editor in it.
Everything works until the point where the program shows the content of the
page. Instead of showing the intended format, it shows the HTML tags. For
what I understand, it is suppose to do so to assure security.
I will be the sole user of this wiki, so I don't care much about injection.
I found the HTML helpers, particularly the XML() which looks to be the
solution to my problem.
*There is the problem: *
I can't seem to figure out where to put the XML() tag that will make the
HTML code works.
*There are the steps I took so far: *
I reinstalled Web2Py (it's not an installation, but you see what I mean.)
I created a new application which I named ''wikidemo.''
I used the wiki coming with Web2Py. So I modified the index of
''default.py'' controller, following the Wiki section of the Overview of
the Documentation for Web2Py (
http://www.web2py.com/book/default/chapter/03#The-built-in-web2py-wiki):
*def index(): return auth.wiki() *
For the rich text editor, I decided to use CKEditor.
I downloaded CKEditor through the plugin repository. (
http://127.0.0.1:8000/admin/default/plugins/wikidemo)
Following that, I added to my model ''db.py'':
*from plugin_ckeditor import CKEditor ckeditor = CKEditor(db)
ckeditor.define_tables() *
As it was written on the package page of CKEditor (
http://www.web2pyslices.com/slice/show/1952/)
I wasn't sure what I was suppose to make of the ''Basic Usage'' section.
Looking over the internet, I found that adding the following to my
''db.py'':
*auth.wiki(resolve=False) db.wiki_page.body.widget = ckeditor.widget *
Made that CKEditor was showing in the body section of the form used to
create new slug and that it added the right html tags for what I wanted to
do in the source code.
Once created, however, the page shows the html tags instead of showing the
intended format.
There are the steps I took to settle the problem:
My first thought was to put the XML() it in the ''default/index.html''
view. In the middle of the document there is this part:
*{{elif 'content' in globals():}} {{=content}} *
I thought changing this for
*{{elif 'content' in globals():}} {{=XML(content, sanitize=False)}} *
But it didn't work. As in, it showed the same thing as if I hadn't add
anything.
I also though using TAG on the ''content'' variable, but it didn't work
either (probably because the variable is not a string.)
My next thought was to find where is the ''content'' variable is created (I
understand that it is a variable, if it is not, please tell me) and to add
the XML() around the variables taken from my database to create the pages,
so the content created would be formatted the right way.
Except I don't know where or how the content of ''content'' is created, nor
if it is the right way to do what I intend to do (, nor if it is even
possible to do that kind of thing...)
Another solution might be to parse the text so that the HTML tags are
replaced by XML tags... Even then, I am not sure if it would work.
Thanks by advance for any help/comment and for the time you took to read
all this,
Mishra.
P.S.: I don't see how it could be related, but I use a Ubuntu installed on
an USB key for this project.
P.P.S: Web2Py is an incredible program and the community seems to be very
helpful (it's already been a lot for me.) Thank a lot to everyone.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.