Skip to content

Instantly share code, notes, and snippets.

View thet's full-sized avatar

Johannes Raggam thet

View GitHub Profile
@thet
thet / instancebehaviors.py
Created November 1, 2012 00:04
plone/dexterity per-instance behaviors
"""Per instance behaviors for Plone's Dexterity.
<adapter
for=".interfaces.IBasetype"
factory=".instancebehaviors.DexterityInstanceBehaviorAssignable" />
Also see:
http://opkode.net/media/blog/plone-and-dexterity-enable-behaviors-per-content-type-instance
"""
@thet
thet / gist:7155911
Created October 25, 2013 14:51
g24 geojson , 200 items url: http://localhost:8080/Plone/places/geojson?b_size=200&b_start=10 after deployment, this should be available under: http://beta.g24.at/geosjon[?OPTIONAL&URL=PARAMETERS]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[buildout]
parts =
instance
zopepy
test
packages
extends =
https://raw.github.com/plone/buildout.coredev/5.0/sources.cfg
https://raw.github.com/plone/buildout.coredev/5.0/checkouts.cfg
@thet
thet / gist:11217449
Created April 23, 2014 14:29
plone.app.contenttypes migration helpers
def attr_migrator(old, new, old_name, new_name):
field = old.getField(old_name)
if not field:
return
val = field.get(old)
val_str = str(val)
if old_name == 'teacher':
if not isinstance(val, list):
val = []
teachers = []
@thet
thet / collective-repos.txt
Last active July 11, 2018 15:19
list of all plone collective repositories per 2018-07-11
actionbar.babble
actionbar.panel
alm.solrindex
anz.casclient
archetypes.clippingimage
archetypes.datetimewidget
archetypes.linguakeywordwidget
archetypes.pfgextender
archetypes.testcase
archetypes.uploadreferencewidget
[buildout]
parts = instance
extends = http://dist.plone.org/release/4-latest/versions.cfg
find-links = http://dist.repoze.org/
versions = versions
[instance]
recipe = plone.recipe.zope2instance
eggs =
Plone
### Keybase proof
I hereby claim:
* I am thet on github.
* I am thet (https://keybase.io/thet) on keybase.
* I have a public key whose fingerprint is 8667 B704 EBB4 8E94 447F 5EF6 5B89 8D31 0C43 8007
To claim this, I am signing this object:
from Products.Archetypes.Field import *
from Products.Archetypes.Storage import *
from Products.Archetypes.Widget import *
from Products.Archetypes.fieldproperty import ATDateTimeFieldProperty
from Products.Archetypes.fieldproperty import ATFieldProperty
from Products.Archetypes.athistoryaware import ATHistoryAwareMixin
from Products.Archetypes.fieldproperty import ATReferenceFieldProperty
from Products.Archetypes.annotations import AT_ANN_STORAGE
from Products.Archetypes.annotations import AT_FIELD_MD
from Products.Archetypes.ClassGen import AT_GENERATE_METHOD
@thet
thet / fix_image_scales.py
Created December 8, 2015 12:35
fix image scales from archetypes scales to dx scales, old scale names to new scale names
# -*- coding: utf-8 -*-
from Products.CMFCore.utils import getToolByName
from plone.app.textfield.value import RichTextValue
from zope.component.hooks import getSite
import logging
log = logging.getLogger(__name__)
"""Set all repositories of a given GitHub organization name for a given user
to watching.
"""
import argparse
import json
import requests
def get_repos(url, repo_list=[], auth=None):