This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NGINX CONFIG | |
upstream plone { | |
server cms:8080; | |
} | |
server { | |
listen 80; | |
server_name dev-backend.webcloud7.ch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Acquisition import aq_inner | |
from Acquisition import aq_parent | |
from bumblebee.file import _ | |
from bumblebee.file.utils import format_filesize | |
from collective.prettydate.interfaces import IPrettyDate | |
from ftw.bumblebee.mimetypes import get_mimetype_image_url | |
from ftw.bumblebee.mimetypes import get_mimetype_title | |
from ftw.bumblebee.mimetypes import is_mimetype_supported | |
from ftw.bumblebee.utils import get_fallback_url | |
from ftw.bumblebee.utils import get_representation_url_by_object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> plone = app.platform | |
>>> from zope.component.hooks import setSite | |
>>> setSite(plone) | |
>>> from plone import api | |
>>> import csv | |
>>> from StringIO import StringIO | |
>>> handler = open('user.csv', 'r') | |
>>> data = handler.read().decode("utf-8-sig").encode("utf-8") | |
>>> csv_data = csv.DictReader(StringIO(data), delimiter=';') | |
>>> for item in csv_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JPEG_START_BYTE = '\xff\xd8' | |
JPEG_END_BYTE = '\xff\xd9' | |
def get_jpeg(stream): | |
start_pos = None | |
end_pos = None | |
while True: | |
frame_bytes = stream.read(1024) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################## | |
# | |
# Copyright (c) 2001 Zope Foundation and Contributors. | |
# | |
# This software is subject to the provisions of the Zope Public License, | |
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | |
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | |
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS | |
# FOR A PARTICULAR PURPOSE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# | |
# fakemail (Python version) | |
# | |
# $Id: fakemail.py,v 1.1 2005/08/29 22:04:55 lastcraft Exp $ | |
# | |
# usage: fakemail --host=localhost --port=25 --path=./mails --background | |
import asyncore | |
import getopt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head><title></title></head> | |
<body> | |
<p tal:content="here/getBody_pre | nothing" /> | |
<table style="width:800px; border: 1px solid grey"> | |
<tr tal:repeat="field options/wrappedFields | nothing"> | |
<th tal:content="field/fgField/widget/label" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def uncatalog_by_rid(_catalog, rid): | |
data = _catalog.data | |
paths = _catalog.paths | |
indexes = _catalog.indexes.keys() | |
for name in indexes: | |
x = _catalog.getIndex(name) | |
if hasattr(x, 'unindex_object'): | |
x.unindex_object(rid) | |
del data[rid] | |
del paths[rid] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from AccessControl.SecurityManagement import newSecurityManager | |
from Acquisition import aq_inner | |
from Acquisition import aq_parent | |
from Products.CMFCore.utils import getToolByName | |
from Testing.makerequest import makerequest | |
from zope.component.hooks import setSite | |
import transaction | |
app = globals()['app'] | |
# we need to get a super user security and a request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from AccessControl.SecurityManagement import newSecurityManager | |
from Acquisition import aq_inner | |
from Acquisition import aq_parent | |
from Products.CMFCore.utils import getToolByName | |
from Testing.makerequest import makerequest | |
from zope.component.hooks import setSite | |
import transaction | |
app = globals()['app'] | |
# we need to get a super user security and a request |
NewerOlder