October 29, 2020

What Is the Difference Between Docker Create, Docker Start and Docker Run

In order to be able to answer this question, you have to know that there are Docker images Docker containers Docker images are blueprints or templates. Docker containers are the instances, created from the images. docker create creates a container from an image docker start starts a container docker run creates a container and starts it note Trying to use the run command twice results in something like… docker: Error response from daemon: Conflict....

October 28, 2020

How to Update All Zope Repositories at Once

Most or even all zopefoundation repositories use Travis for CI (As of May 2021, this is no longer true: we use GitHub Actions now). While Travis offered Python 3.9 as a dev version (3.9-dev) for quite some time, support for 3.9 final took a while. That’s why we decided to run Travis with Python 3.9-dev. Meanwhile Travis finally offers support for Python 3.9 final, so we have to update all repositories, which would be super tedious by hand....

October 9, 2020

How to Access via WebDav

WebDav is a protocol, based on top of HTTP, that allows clients remote content authoring, such as creating, editing and deleting content. The protocol itself is pretty old, dating back to the late 90ies. While not really popular, even modern systems like NextCloud, OwnCloud, and also the widely-used NAS systems by Synology do support this standard - and also Zope! How to activate WebDav support in Zope? The WebDav support in Zope had been temporarily removed, as Zope switched from the legacy ZServer to the standard WSGI approach, and WebDav was coupled to the ZServer, for no obvious reasons....

October 5, 2020

How to Develop Dependencies With Buildout

Given you have a decent sized project, with some dependencies… How can you develop and test a dependency against your main project, when it is not yet published on PyPi? Well, until recently, I relied on a strong test suite and mostly developed “blindly”. When I wanted to see the result, I used Vim to directly edit the dependency in my virtual env. There must be a better way And actually, there is and has been for more than a decade....

September 29, 2020

How to Setup Zope in Dev Mode

How to setup Zope in development mode? git clone git@github.com:zopefoundation/Zope.git cd Zope python3.8 -m venv .venv . .venv/bin/activate pip install -U pip pip install -e .[wsgi] -c https://zopefoundation.github.io/Zope/releases/master/constraints.txt … where -e means editable, ie. developer mode the dot in .[wsgi] means here (similar to cd .. in bash) and [wsgi] means install the wsgi extras, which turns out to be Paste -c adds a constraints file, ie the versions of dependencies get pinned there After the installation, you need to configure Zope before you can run it, cf https://zope....

September 28, 2020

How to Run a Single Test

While this seems to be no Zope specific question, as we all know how to narrow down the test selection with pytest (e.g. pytest -k pattern), Zope does not use pytest, but zope.testrunner. Similar to pytest, also zope.testrunner offers some command line options, see https://zopetestrunner.readthedocs.io/en/latest/getting-started.html#some-useful-command-line-options-to-get-you-started This means, in order to run a specific test, you can use the -t flag, which takes one or more regex expressions as input, e.g. -t some_test....

September 7, 2020

How to Use the Output of One Bash Command as the Argument of Another

TIL my TIL is not secure There is a security issue with the following description - at least when you handle sensitive data. see here https://github.com/jugmac00/til/commit/7ea93202cecf97070c8931bbe5a1f64c78d41dcb#commitcomment-42050997 Thanks to Anthony Sottile for reporting! Please see https://unix.stackexchange.com/questions/205180/how-to-pass-password-to-mysql-command-line for a better way to create a login one-liner. How do you use the output of one bash command as an argument of another command? For the virtual machines at my web hosting company, the mysql root password is stored in a config file....

September 4, 2020

How Long Does Flask Keep User Generated Data

Easy! Either Flask persists the data into a database or a file, or it does not. Wait, not so fast. There is also session scoped data (e.g. storing data in a cookie or similar) app scoped data (e.g. store data on the app object) The caveats session scoped data is only available for one client, and as long the session lasts app scoped data is only available within a single app - usually, e....

August 25, 2020

How to Sort Files and Folders in Nautilus So Folders Are Shown First

update settings gsettings set org.gtk.Settings.FileChooser sort-directories-first true check settings gsettings get org.gtk.Settings.FileChooser sort-directories-first via https://askubuntu.com/questions/1064482/

August 14, 2020

How Can You Translate the Login Message of Flask-Login

When you use Flask-Login, the default login message comes from the plugin. This means - you do no set it, you cannot translate it. solution Set the very same (or a different) message! login = LoginManager(app) login.login_view = 'login' login.login_message = _l('Please log in to access this page.') via https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xiii-i18n-and-l10n