12 Feb 2016

feedPlanet Plone

David "Pigeonflight" Bain: Using Requirejs to load Jquery UI from a CDN

This post discusses how to use Require.js to load an external library.

One big benefit of Require.js is that it allows a developer to reliably load javascript modules without introducing dependency related conflicts. I needed to include Jquery UI into Plone 5 (which now manages the loading of javascript modules and dependencies using Require.js). If you're curious you can read more about use of Require.js in Plone.

In Plone 4.x you basically use the plain old javascript approach (with a bit of jquery magic) to load and run your scripts. Loading and using the Jquery UI datepicker might look like this:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script>
$(document).ready(function(){
$(function() {
$( ".my-calendar-box" ).datepicker(
{ dateFormat: "dd/mm/yy" }
);
});

});
</script>


With the introduction of Require.js in Plone 5 the code above would now look something like this:

<script>
require.config({
"paths": {
"jquery-ui": "//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min"
}
});
require([ "jquery", "jquery-ui" ], function( $ ) {
$(".my-calendar-box").datepicker(
{
dateFormat: "dd/mm/yy"
}
);
});
</script>


Note that when we define the path to "jquery-ui" the ".js" is removed from the end of the path. We can now call our newly defined "jquery-ui" module by using a require() call.
Plone 5 ships with some common modules such as jquery so we only need to require "jquery".

If you want to get a list of all the javascript modules that Require.js has already loaded, run the following command on the javascript console of your Require.js powered app:

require.s.contexts._.defined


It is more common to put all your require.js related code in a separate ".js" file and then load that file. I have notes on doing something like that with SemanticUI.

12 Feb 2016 8:47am GMT

Plumi: Debian Jessie Compatibility

Core Plumi maintainers are still working towards compatibility with latest Debian release.

Assistance welcome! :)

12 Feb 2016 5:52am GMT

11 Feb 2016

feedPlanet Plone

eGenix: Python Meeting Düsseldorf - 22 New Videos Online

The following text is in German, since we're announcing videos available from a regional user group meeting in Düsseldorf, Germany.

Was ist das Python Meeting Düsseldorf ?

Das Python Meeting Düsseldorf ist eine Veranstaltung, die alle drei Monate in Düsseldorf stattfindet und sich an Python Begeisterte aus der Region wendet.

Bei jedem Treffen werden Vorträge gehalten und anschließend in Diskussionen vertieft. Die Meetings dauern üblicherweise ca. 2 Stunden und münden anschließend in eine Restaurant-Session.

Teilnehmer kommen aus ganz Nordrhein-Westfalen, hauptsächlich allerdings aus der näheren Umgebung.

Neue Videos

Um die Vorträge auch für andere Python Enthusiasten zugänglich zu machen, nehmen wir die Vorträge auf, produzieren daraus Videos und laden diese auf unseren PyDDF YouTube Channel hoch.

In den letzten Wochen haben wir die Videos der letzten Treffen aufgearbeitet. Insgesamt sind 22 neue Videos dazugekommen. Viel Spaß damit:

Python Meeting Düsseldorf 2016-01-19

Python Meeting Düsseldorf 2015-10-21

Python Meeting Düsseldorf 2015-07-29

Python Meeting Düsseldorf 2015-04-29


Die vollständige Liste aller mehr als 90 Python Meeting Videos ist über unsere Video Liste verfügbar.

Weitere Informationen

Weitere Informationen und Termine rund um das Python Meeting Düsseldorf stehen auf unserer Webseite:

http://pyddf.de/

Viel Spaß !

Marc-Andre Lemburg, eGenix.com

11 Feb 2016 9:00am GMT

10 Feb 2016

feedPlanet Plone

Reinout van Rees: Just one comma

In Django, if you say managed = False in a model's Meta, you tell Django not to touch the database table. So: no automatic database migrations, for instance.

Now, what is the problem if you have managed = False, and Django does do migrations?

Some of you will have seen the error already.

The comma after False is the problem:

>>> a = False,
>>> a
(False,)
>>> bool(a)
True

The comma turns it into a tuple. And a non-empty tuple evaluates to True!

I found it quite funny. My colleague was torn between "extremely relieved" and "extremely annoyed" :-)

10 Feb 2016 11:28am GMT

05 Feb 2016

feedPlanet Plone

Gil Forcada: Make code analysis cleanups brainless

I wrote a small guide with a step by step instructions on how to cleanup a package code so that it follows our Plone style guide.

To add sugar on top, the packages that are already monitored for it, point you to that same guide, see it in action.

Enjoy!

05 Feb 2016 12:56am GMT

03 Feb 2016

feedPlanet Plone

Paul Everitt: Making the material for the Polyglot webinar

Tomorrow we do Part 2 of our "Polyglot Python with PyCharm" webinar, talking again about modern web frontend development, from a Python perspective, within PyCharm. We put a lot of work into writing materials for this. Why, and what's next?

In the first webinar, I spent a lot of advance time breaking down the session into a series of steps, building a ToDoMVC-style application with a Flask-Restless backend. I wrote the code, then near the end, found a fatal flaw in the "pedagogy" of the sequence, and had to rewrite it. Only to find another, repeat.

Near the deadline, I decided to put everything in a publicly-visible repo, so webinar viewers could follow along. At the very last second, I put the notes I was using to guide my progression, into the repo as well.

Two unexpected outcomes…first, I ran out of time. In fact, I ran out of time at the point where I was showing the really cool part that everything had led up to. Next, the feedback showed that registrants really wanted the material, with explanations, in advance.

I had been planning for a while to write a series for this. This crazy frontend world is hard to decipher for Python folks, but we know we need to jump in. I wanted to be a guide, explaining this world in Python terms, and showing how to couple it to Python-based backends. Also, if you get fully into that world, you're better off with IDE help, and PyCharm is *very* unique in that regard: first-class Python and first-class JS/HTML/CSS support. In fact, many of my Python friends didn't know PyCharm could do what WebStorm does.

So I used this second part of the webinar to write up all the story for this "Polyglot Python with PyCharm". It is a series of articles on each part of the equation, followed by a start-to-finish ToDoMVC application. For those familiar with my "Quick Tutorials" for Pyramid, it's that kind of approach. Individual slices, with a lot about the "why", plus working code.

Here's the (current) table of contents. For the material, register for the webinar and you'll get the link, or wait until next week:

  • NodeJS for Python and PyCharm Developers
  • JavaScript Packaging with package.json
  • Linting with ESLint
  • Automation with npm run Scripts
  • Modules with CommonJS
  • Browser Bundling with Webpack
  • Browser Debugging from PyCharm
  • TDD with Mocha
  • ES6 Imports with Babel
  • Pythonic JavaScript with ES2015
  • DOM TDD with JSDOM
  • Initial ToDoMVC
  • Frontend Tooling for ToDoMVC
  • Moving the Frontend Out of the Backend
  • Bundling ToDoMVC with WebPack
  • ES6 Imports for ToDoMVC
  • Pythonic JavaScript for ToDoMVC
  • TDD for ToDoMVC

I still have more to do to finish this after this week: fill in the missing writeup on the ToDo app, do a tenth-round of rewriting, and make a screencast video for each article. Also, it's tied to a new blog for me which isn't yet really official.

But in general, we think PyCharm has fantastic story for Python-backed frontend development, and this series is a commitment to being your guide. Hope to see you tomorrow in the webinar.


03 Feb 2016 4:05pm GMT

30 Jan 2016

feedPlanet Plone

Florian Schulze: Let’s Encrypt certificates for private servers

At the end of January 2016 Let's Encrypt fixed the last bug which prevented letsencrypt-remote from authenticating via DNS.

It is now possible to generate TLS certificates for private servers if you can delegate name resolution via your DNS provider.

Let's say you want to generate a certificate for use on your Laptop. You first need to create a subdomain pointing to 127.0.0.1. Something like this in your zone for localhost.example.com:

localhost  IN A  127.0.0.1

Additionally you need to delegate _acme-challenge.localhost.example.com to an IP which is reachable by the Let's Encrypt servers and where you can access DNS port 53. For example your web server if you have one:

_acme-challenge.localhost  IN NS  www

If you use your web server, you could use ssh to forward the port 8053 to your laptop:

$ ssh root@example.com -R 8053:localhost:8053

You then need to use something to forward remote UDP packets from port 53 of the server to the forwarded TCP port 8053, for example socat:

# socat -T15 udp4-recvfrom:53,reuseaddr,fork tcp:localhost:8053

Now on your laptop you can use letsencrypt-remote to create a certificate using DNS:

% letsencrypt-remote --dns localhost.example.com

If everything worked correctly:

This also works for other private ip ranges like 10.0.0.0/8 or 192.168.1.0/24.

30 Jan 2016 10:38am GMT

Gil Forcada: Towards more maintainable code

On my talk at the Plone Conference 2015 (slides, talk notes from Maurits) one of my points was that a written style guide is worth nothing if you can not check/enforce it.

Who cares what a style guide says regarding indentation, dependencies, string quoting, docstrings, handling i18n, etc etc if then one can freely commit changes that go against the said style guide?

Fortunately in Python we already have pep8 (the tool) and flake8 (with its great plugin ecosystem). To top it off, on Plone we already have plone.recipie.codeanalysis. We have the tools.

Talk is cheap

I've been putting as much effort and free time as I could to make that happen.

plone.recipe.codeanalysis has been improved1, flake8 plugins have been written, and finally during this last Alpine City Strategic Sprint 2016 I could implement the missing piece: report back to the users (see an example)!

The script is fairly simple:

#!/usr/bin/env bash
wget https://raw.githubusercontent.com/plone/buildout.coredev/5.0/bootstrap.py -O bootstrap.py
wget https://raw.githubusercontent.com/plone/buildout.coredev/5.0/experimental/qa.cfg -O qa.cfg
wget https://raw.githubusercontent.com/plone/plone.recipe.codeanalysis/master/.isort.cfg -O .isort.cfg
python bootstrap.py -c qa.cfg
bin/buildout -c qa.cfg
bin/code-analysis

Run the above on any Plone distribution and see the output collected on parts/code-analysis/flake8.log

Currently only a few packages are checked, but cleanup tasks can start on any Plone package as of now. Be sure to ask for a job that will check that the package remains clean as soon as your cleanup changes are merged!

Keep on!

  1. and by no means only by me

30 Jan 2016 12:53am GMT

Gil Forcada: Alpine City Strategic Sprint 2016 – personal report

This past five days I had the pleasure the be part on the last Plone sprint: Alpine City Strategic Sprint 2016, what a blast!

In the following days, the amazing never running out of steam, Jens will report back to the community. A partial/preview report already exists for the impatient ones (disclaimer: I made it, so there's probably quite a few things missing).

Below I will make a summary of what I achieved thanks to being part of the sprint.

Work done

Jenkins/CI

collective.indexing

Fortunately all the above took less than one or two hours, my main task during the sprint was, together with Maik, bring collective.indexing in Plone core without having to add yet another package2. Please read the PLIP description, linked above, to know the scope of it.

As of now we are down to one single test failure! We are highly appreciated on creative ways to solve that last one…

Not only work

A sprint is way more than just sitting in front of a laptop and coding!

Lots of interesting discussions where held, we had lots of fun, we did some sightseeing and enjoyed being together.

And after that I can only say that Plone's future is brighter than ever has been!

As a personal pet peeve, we finally agreed (?) on how to sort imports! :-)

Last words go to Jens and Christine for taking so much care on preparing everything and being so open and helpful at any time, thanks!

  1. thanks to jenkins-job-builder
  2. which our release manager will probably welcome for a change

30 Jan 2016 12:08am GMT

27 Jan 2016

feedPlanet Plone

Benoît Suttor: How I made my wedding site

So I'll getting maried !

I decide to make a website for my wedding with a list of gift, my honneymoon, presentation of my witnesses and so on.

I was looking for a litlle CMS with a "list of gift" (an online shopping) which can be installed on cheap and reliable hosting (An it's when I loose Plone)

Pyramid vs Django

I started looking on Pyramid (because I'm a Plone/Zope dev). I thought Kotti, but I didn't find a way to make easily gift, and I thougt project looks cool, but it'was maybe a little young for my kind of requirements. I didn't find good solution on pyramid for a wedding list.

Such as I have some exprience in Django, And in my daily work, we started intereset on Geonode for GIS project.

-> I started looking on Django !

Django CMS vs Mezzanine

Django CMS and Django CMS e-commerce plugin. But it seems this project is a almost dead ? Last commit on github make me septic.

With little search, I found Mezzanine and Cartridge. I try it and It seems perfect for my porject, So I choose it !

Hosting

My first choose was OVH, because it's very cheap (5€ / month). But with little search, it is almost impossible to create a complex Django site (by complex, I mean a "Mezzanine" Django site, and it's not very complex). I pursued my searching... And I found Webfaction. They have local pythons, postgres, 600Go data for 10 € / month. It looks perfect for me, except they do not manage domain name directly. So I host my wedding site on webfaction and my domain name on OVH.

Maybe I could made an heroku Django website, but I was little affraid about complexity.

Next step is to create an online shop with Kotti or with Pyramid !

27 Jan 2016 10:16am GMT

21 Jan 2016

feedPlanet Plone

David "Pigeonflight" Bain: From Zero to Plone - Towards faster on-boarding

About 4 months ago we took on a new developer and I started by explaining that it takes about 3 months to become confident with Plone. Being a confident developer he took this as a challenge, assuming that he would be over the learning curve within 3 weeks.

After 4 months plus of working with us I asked him to give me his feelings about my 3 month timeline. This was his response (with a few additions from me):

"I think I'm comfortable with it. However, it [depends on] the type of task you've given me... I might be uncomfortable with [doing a migration]. It's like giving a recently graduated doctor the task of performing a heart surgery as his first task at the hospital..."

So he's comfortable with some tasks but there are others that will require more experience.

I've actively been experimenting with ways of making Plone easier for at least 3 years (and less actively for longer than that). In that period I've come up with the idea of Plone Drills, created a Diazo Snippets Library and Chrome Plugin, worked out fast cloud based installation of Plone, done work on a Plone Newbie Developer Toolkit (Plone 4 only), contributed to Alex Clark's Plock Plone Installer project and spent a lot of time on a theming approach for Plone which "extends" Diazo called Gloss. I also created a short video series related to using Gloss with Webflow.

I'm still haunted by this problem space and the general idea of on-boarding web developers. It's led me to my latest side project, the aim being to provide a faster on-boarding experience for new Plone developers. I've been calling it a book but that might be a poor description since it will most likely involve more than just a text.

BTW... If you are interested in the fastest way to get going with Plone then I'd encourage you to sign up for my upcoming book/project/thing. You should see the option to sign up somewhere on this page.

21 Jan 2016 3:51pm GMT

20 Jan 2016

feedPlanet Plone

Affinitic: Automatically pack your Plone instances (without zeo)

At Affinitic, we have many Plone sites on our servers and we wanted to pack their ZODB automatically.

Our goal is of course to do it without any downtime. It's easy when you have a zeoserver, but you cannot use a packing script when there isn't :

zc.lockfile.LockError: Couldn't lock 'instance/var/filestorage/Data.fs.lock'

We decided to simply do a wget on the ZMI packing form.
Here is the command to pack your main database (7 days) :

wget --max-redirect 0 --post-data='submit=Pack&days:float=7.0' http://user:password@localhost:8080/Control_Panel/Database/main/manage_pack

We wrapped this in a script to get meaningful exit code and this is deployed via Puppet to have a cron for each and every Plone instances. Even the user that is used to access the instance is created via Puppet with :

bin/instance adduser user password

Alternative method, not used for deployment reasons and using a Python script : https://www.nathanvangheem.com/news/automatically-pack-the-zodb

If it can help anyone …

20 Jan 2016 9:35am GMT

18 Jan 2016

feedPlanet Plone

Florian Schulze: New statically generated website using Lektor

After several years and multiple attempts, I finally have a website again.

I tried quite a few static website generators, including starting my own, until I finally settled with the recently announced Lektor.

The main addition to Lektor is my reStructuredText plugin lektor-rst. I had all the old content in rst already and I favour it over markdown.

The source code for my website is available on GitHub at https://github.com/fschulze/florian-schulze.

18 Jan 2016 11:40am GMT

17 Jan 2016

feedPlanet Plone

Andreas Jung: print-css.rocks launched

A new website dedicated to PDF generation using the CSS Paged Media approach

17 Jan 2016 3:04pm GMT

13 Jan 2016

feedPlanet Plone

BlueDynamics Alliance: Watch all your repos

Keep yourself up to date with what's happening in GitHub organizations.

13 Jan 2016 7:02pm GMT