This short recipe demonstrates how to create Wagtail pages programmatically. It may also be useful for testing Wagtail development against a reasonable volume of page data (about 35,000 film plots, from English Wikipedia).
In a virtualenv:
| #!python3.5 | |
| # Prerequisites : | |
| # 1.SetUp dropbox sdk to be able to use Dropbox Api's | |
| # $ sudo pip install dropbox | |
| # By default python dropbox sdk is based upon the python 3.5 | |
| # | |
| # 2. Create an App on dropbox console (https://www.dropbox.com/developers/apps) which will be used and validated to do | |
| # the file upload and restore using dropbox api. Mostly you need an access token to connect to Dropbox before actual file/folder operations. | |
| # |
| // encode(decode) html text into html entity | |
| var decodeHtmlEntity = function(str) { | |
| return str.replace(/&#(\d+);/g, function(match, dec) { | |
| return String.fromCharCode(dec); | |
| }); | |
| }; | |
| var encodeHtmlEntity = function(str) { | |
| var buf = []; | |
| for (var i=str.length-1;i>=0;i--) { |
| _complete_ssh_hosts () | |
| { | |
| COMPREPLY=() | |
| cur="${COMP_WORDS[COMP_CWORD]}" | |
| comp_ssh_hosts=`cat ~/.ssh/known_hosts | \ | |
| cut -f 1 -d ' ' | \ | |
| sed -e s/,.*//g | \ | |
| grep -v ^# | \ | |
| uniq | \ | |
| grep -v "\[" ; |