Snippet List
Example Usage in the template:
<p>{{ email|hide_email }}<br />
{{ email|hide_email:"Contact Me" }}<br />
{% hide_email "[email protected]" %}<br />
{% hide_email "[email protected]" "John Smith" %}</p>
{{ text_block|hide_all_emails|safe }}
All hidden emails are rendered as a hyperlink that is protected by
javascript and an email and name that are encoded randomly using a
hex digit or a decimal digit for each character.
Example of how a protected email is rendered:
<noscript>(Javascript must be enabled to see this e-mail address)</noscript>
<script type="text/javascript">// <![CDATA[
document.write('<a href="mai'+'lto:john@example.com">John Smith</a>')
// ]]></script>
This script can be useful if you want to obfuscate your django project sources.
I use the [pyobfuscate](http://freshmeat.net/projects/pyobfuscate/) tool, a little bit patched, the patch you can get [here](http://farid.adigamov.com/files/pyobfuscate.patch). The patch switchs off the classes and methods obfuscation as they could be imported from other files.
The **pyobfuscate** util can obfuscate only one file at once. This script can obfuscate all .py files from the specified path (src_dir), at the end of the obfuscation it compiles them using **compileall** module.
Set the **src_dir** and the **dst_dir** variables.
Note: remove original **settings.py** and **urls.py** from the **src_dir** cause **pyobfuscate** util raises an error trying to encode them.
The decorators are not handled correctly by pyobfuscate tool. I'm using django for about year and i didn't use the decorators except the '@transaction' decorators.
I replace them from the sources at the beginning of the obfuscation and put them at their places in encoded file.
In case of using other decorators you should make some changes in code ( line # 64 ).
- obfuscate
- sources
- hide
- obfuscator
4 snippets posted so far.