From 9b9589a54505e4ec0c2555c53b8e7980b6686daa Mon Sep 17 00:00:00 2001 From: yo mama Date: Sat, 3 Sep 2016 11:56:00 -0700 Subject: fixed rebus --- photoblaster/modules/pbgenerate/__init__.py | 3 +++ photoblaster/server.py | 30 +++++---------------- share/frontend/gallery-static/js/main.js | 41 ++++++++++++++++++----------- 3 files changed, 34 insertions(+), 40 deletions(-) diff --git a/photoblaster/modules/pbgenerate/__init__.py b/photoblaster/modules/pbgenerate/__init__.py index f08dd85..a549da2 100755 --- a/photoblaster/modules/pbgenerate/__init__.py +++ b/photoblaster/modules/pbgenerate/__init__.py @@ -147,6 +147,9 @@ class PbGenerate(ModuleBase): "-compose", self.params.compose, "-layers", "composite", self.get_output_file().get_filepath() ] + import sys + sys.stderr.write(' '.join([str(x) for x in cmd])) + sys.stderr.write("\n") self._call_cmd(cmd) diff --git a/photoblaster/server.py b/photoblaster/server.py index bff1b24..72769fc 100644 --- a/photoblaster/server.py +++ b/photoblaster/server.py @@ -71,7 +71,12 @@ class GunicornServer(gunicorn.app.base.BaseApplication): self.options = { 'bind': '%s:%s' % (host, port), 'workers': (multiprocessing.cpu_count() * 2) + 1, - 'loglevel': 'debug' + 'loglevel': 'debug', + 'timeout': 240, + 'limit_request_line': 0, + 'limit_request_fields': 32768, + 'limit_request_field_size': 0 + } self.application = app self.application.config['DEBUG'] = True @@ -310,29 +315,6 @@ class Server(object): # #**kwargs # ) - #so this is what I'm running on the server - #do you know what wsgi is? it's protocol like fastcgi - #ok so is that different from http? well they are similar in a way, same request-response thing - #do you have to tell nginx to translate incoming requests from http to wsgi? yeah nginx accept http requests and - #pass them to location {} blocks, and there you can put then to proxy or fastcgi or wsgi app. - #right so is nginx changing the data at all? and can you request wsgi directly from AJAX/javascript? - #nginx doesn't change data itself, just repack it into different format. as for ajax, i think only http requests allowed - #from browser, maybe websocket requests too, but not arbitrary protocols, so it won't be possible. - #so cgi is http - #fastcgi and wsgi are a little different? yes - #and why is that better to change it? what makes that more efficient? - #cgi is basically forks a new process for each request, and that is slow. fastcgi and wsgi work about same way, it has one or more - #processes and inside they can be multithreaded. so everything is already initialized and ready to process actual request, this - #way it can handle more requests. - #I get it - #so is this multithreaded? well don't see multithreading setting here, it may be enabled by default, but need to check with docs. - #I see so gunicorn and cherrypy are the same thing it looks like? yeah they are wrappers that host the app. - #so ultimately I don't need both, right? yeah you can have same on local and remote machines. - #and do you notice any difference between the two? - #https://www.digitalocean.com/community/tutorials/a-comparison-of-web-servers-for-python-based-web-applications - #well they are a bit different in features, may be some of them a little faster, but they all work in same principle, so - #it doesn't really matter, just pick whatever you like - #ok #FIXME choose one def run_wsgi(self, server_port=SERVER_PORT, host=SERVER_HOST): diff --git a/share/frontend/gallery-static/js/main.js b/share/frontend/gallery-static/js/main.js index 7d92b93..742a1df 100644 --- a/share/frontend/gallery-static/js/main.js +++ b/share/frontend/gallery-static/js/main.js @@ -31,40 +31,43 @@ $(function(){ //var clip = new ZeroClipboard.Client(); //clip.glue( 'd_clip_button' ); + var Dump = { + current_urls: [], pick: function () { Dump.pickUrl( $(this).attr("src") ) }, pickUrl: function (url) { - $("#rebus").append ($ ("").attr ("src", url)) - $("#rebus").show() - var theDump = $("#urlz").val() + " " + url - $("#urlz").val( theDump ) -// clip.setText( theDump ) - return false + Dump.current_urls.push(url) + Dump.load_rebus() }, clear: function () { $("#rebus").html("") $("#urlz").val("") + Dump.current_urls = [] // clip.setText("") }, + load_rebus: function(){ + var as_str = Dump.current_urls.join(" ") + window.localStorage.setItem('urls', as_str) + $("#rebus").html("") + Dump.current_urls.map(function(url){ $("#rebus").append($("").attr("src", url))}) + $("#rebus").show() + console.log(as_str) + $("#urlz").val( as_str ) + }, backspace: function () { - $("#rebus img:last").remove() - var urllist = $("#urlz").val().split(" ") - urllist.pop() - $("#urlz").val( urllist.join(" ") ) + Dump.current_urls.pop() + Dump.load_rebus() }, reverse: function () { - urllist = $("#urlz").val().split(" ") - Dump.clear() - for (i in urllist.reverse()) - if (urllist[i]) - Dump.pickUrl(urllist[i]) + Dump.current_urls.reverse() + Dump.load_rebus() }, showNewer: function() { @@ -140,6 +143,12 @@ var Main = }, init: function () { + //the rebus needs to preload dumps that are stored from localstorage + if (window.localStorage.getItem('urls')){ + Dump.current_urls = window.localStorage.getItem('urls').split(" ") + }else{ + Dump.current_urls = [] + } $(document).keydown(Main.kp) $("#urlz").focus(function(){ Main.editing = true }) $("#urlz").blur(function(){ Main.editing = false }) @@ -150,7 +159,7 @@ var Main = $(".tag-options").click(function(){document.location.href= applyTag(this.id)}); $(".tag-clear").click(function(){ document.location.href = document.URL.replace(/&?tag=[^&]*/ ,"").replace(/\?$/,"")}); $("div img").live("click", Dump.pick) - Dump.clear() +// Dump.clear() } } -- cgit v1.2.3-70-g09d2