Hi Steven,

you have these possibilities, assuming you are using HTML5 by placing
<!doctype html> at the top of your document:

    <h1 onclick="alert('&quot; &quot;')">escaped</h1>
    <h1 onclick=alert('"')>no spaces</h1>
    <h1 onclick=alert('"&#32;"')>space escaped</h1>

Depending if you need spaces, quotes or both you will need to escape
*something*. HTML5 allows attributes without quotations around them, however
then the attribute will end on the next space character. &#32; is one
possibility to escape the space character.

In general, if you separate javascript from HTML, you avoid all kinds of 
problems:

    <h1 id="element">however i want it</h1>
    <script type="text/javascript">
        document.getElementById('element').addEventListener('click',
            function(){
                alert('"\'');
            }
        );
    </script>

Inside a <script> you can use \ to escape magic characters.

Bests,
Dragan

Am 08.08.2013 17:33, schrieb Steven Brown:
> Ok, those are fair points.  Any insight into my original question, about 
> quotes
> being escaped when I don't want them to be?
> 
> On 08/07/2013 07:58 AM, Dragan Espenschied wrote:
>> If you are not planning to do database operations on the contents of file 
>> (like
>> indexing, joining, ordering, etc), the file contents will just clog up you
>> database instead of your file system.
>>
>> Also, letting the web server component of webpy (or a webserver like apache 
>> or
>> lighttpd) serve up your static content will free your head from a lot of 
>> things,
>> like generating the correct HTTP headers, caching etc.
>>
>> Am 07.08.2013 10:15, schrieb Steven Brown:
>>> Yes, I've been using $: for this.
>>>
>>> Another question; I want to be able to upload a file and store it in my
>>> database, I'm assuming with the bytea type, and then be able to serve up 
>>> that
>>> file later.  I haven't found any examples of how to do this, examples all 
>>> seem
>>> to just store files on the filesystem, generate a unique filename, and then 
>>> put
>>> that filename in the database.  I feel like I would like to avoid having a 
>>> bunch
>>> of files cluttering up my drive; am I misguided in this?  Is there an 
>>> inherent
>>> disadvantage to storing files in the database?
>>>
>>> On 08/07/2013 12:46 AM, Ruben Maher wrote:
>>>> Hi Steven,
>>>>
>>>> Have you tried disabling the websafe filter with a colon before the
>>>> $:function() name?
>>>>
>>>> Take a look here:
>>>>
>>>>
>>>>       By default, Templetor uses web.websafe filter to do HTML-encoding.
>>>>
>>>>       >>> render.hello("1 < 2")
>>>>       "Hello 1 &lt; 2"
>>>>
>>>>       To turnoff filter use : after $. For example:
>>>>            The following will not be html escaped.
>>>>       $:form.render()
>>>>
>>>>       http://webpy.org/docs/0.3/templetor#filtering
>>>>       Kind regards,
>>>>
>>>> Ruben
>>>>
> 

-- 
http://1x-upon.com/~despens/ >NEW!<
http://noobz.cc/
http://contemporary-home-computing.org/1tb/

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to