Elements of a web site
Beetlebrow client feedback
Testimonial

"When I set up my business I decided to use Beetlebrow as I liked what they did and the way they did it.

"I didn't want an off-the-shelf product – I needed a custom built site that functioned in a user friendly way and created the right impression. To achieve this, more than technical expertise is required – the designers have to interpret what a "non-techie" wants and create something from scratch.

"The service I get from Beetlebrow is excellent. They are also jolly nice chaps."

Richard Max
Partner
Richard Max & Co

More from this site »
Testimonial

"Beetlebrow provided us with a responsive service and a first class web site. They took care of all our requests and were helpful and knowledgeable to talk to. I'd recommend them to anyone."

Jeremy Balcombe
Managing Director
Ozone Clean Ltd

More from this site »
Testimonial

"Well done! I would like to thank you all for making this happen. You have been a pleasure to work with and I am delighted with the end result and I am really happy that we have made the 1 September date.

Jeremy Carr-Smith
Director
Moving Office

More from this site »
Testimonial

Beetlebrow understood the brief perfectly and produced exactly the web site we wanted.

Since launch, they have provided great support and make changes promptly and efficiently. I'm very pleased to be working with them.

Jeremy Balcombe
Managing Director
Springdene Care Homes Group

More from this site »
Testimonial

I am pleased to confirm how delighted I have been with beetlebrow services.

Their design, set up and continued maintenance has been excellent and continues to bring in a good and regular response.

Nigel Graves
Owner
Chelsea Harbour Dental Practice

More from this site »
Testimonial

"Beetlebrow are a huge asset to LessBounce.

Their response time is impressive - amends are made almost instantaneously.

I don't know where we would be without them!"

Selaine Saxby
Proprietor
LessBounce.com

Testimonial

"The best and most original web design company I've come across. They understood my requirements and fulfilled them in every department."

John Davies
Managing Director
Charity Supply Company

 

More from this site »
Testimonial

I selected Beetlebrow to create our website from a shortlist of 10 possible providers. I was greatly impressed with the time and attention they gave to the school pre-contract, with their most senior staff attending a meeting with the school to gain a sense of its ethos and expectations for its website.

Our demands were fairly exacting and at no point did they attempt to steer us in a direct that ultimately would have made their lives simpler.

They produced a website which has received praise from the school community and many others. It has also attracted the kind of teachers we are looking for; in that respect it hit the nail on the head.

Post publication the service provided by Beetlebrow and its individual team members, with no exceptions, has been outstanding; I use that word as an educator and in its truest and most literal sense.

We continue to enjoy a client sensitive, truly professional service. I look forward to the planned refresh of our site shortly.

David Chappell
Associate Head
Holland Park School

More from this site »
Testimonial

"We've found Beetlebrow professional, responsive, and incredibly creative."

"When we asked them for a design, they immediately understood our brief and came back with an idea which reflected our business perfectly."

"Sales inquiries have quadrupled since the new site went up, with many new clients commenting specifically that they came to us because they were so impressed by it."

Stephen Arkell
Managing Director
Retina Productions Ltd.

 

More from this site »
 

Running Zope/Plone scripts from the command line

You need a whole special load of stuff to run Plone or Zope scripts for the command line. These centre around getting hold of the portal object from which everything else is available, setting a fake request object so you can traverse around the site and setting a user so you have permission to do whatever it is you want to do. Then at the end you have to commit your transaction and sync the zeoclients.

Command line scripts get the global variable app from which you can get your portal which you use in place of self and context in scripts e.g.

app.mysite

But there is perhaps a more elegant way to do this, which we can combine with other bits we need to do, so keep reading.

 

Give your script a user

Command line scripts don't have a user, so if you need more than you can do as anonymous, then so this:

from AccessControl.SecurityManagement import newSecurityManager

# Use Zope application server user database (not plone site)
admin=app.acl_users.getUserById("admin")
newSecurityManager(None, admin)

Replace "admin" with the user you need.

 

Create a fake HTTP request

Then you need to spoof the HTTP request object so you can traverse around and grab parts of the site. I had thought this would be irrelevant, but when I tried the script without it, I got skinnable errors, so it is probably required to do pretty much anything to your site. By all means try without it though.

import zope
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
from Testing.makerequest import makerequest
from Products.CMFCore.tests.base.security import PermissiveSecurityPolicy, OmnipotentUser

def spoofRequest(app):
    """
    Make REQUEST variable to be available on the Zope application server.

    This allows acquisition to work properly
    """
    _policy=PermissiveSecurityPolicy()
    _oldpolicy=setSecurityPolicy(_policy)
    newSecurityManager(None, OmnipotentUser().__of__(app.acl_users))
    return makerequest(app)

# Enable Faux HTTP request object
app = spoofRequest(app)

# Get Plone site object from Zope application server root
site = app.unrestrictedTraverse("sitename")
site.setupCurrentSkin(app.REQUEST)
zope.app.component.hooks.setSite(site)

 

Add your code and commit any changes to the ZODB

Once you've done that, you're ready to put your code into the script. Create functions, like you would with an external method and pass site instead of self e.g.

def doMyThang(site):

If you make changes to the ZODB, you'll need to commit them manually as follows:

# Commit transaction
import transaction
transaction.commit()
# Perform ZEO client synchronization (if runnning in clustered mode)
app._p_jar.sync()

 

Put it all together

Putting all this together gives the following which can go at the top of your script, including the slightly more elegant way of getting the portal object

import zope
import transaction
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
from Testing.makerequest import makerequest
from Products.CMFCore.tests.base.security import PermissiveSecurityPolicy, OmnipotentUser

# Use Zope application server user database (not plone site)
admin=app.acl_users.getUserById("admin")
newSecurityManager(None, admin)

def spoofRequest(app):
    """
    Make REQUEST variable to be available on the Zope application server.

    This allows acquisition to work properly
    """
    _policy=PermissiveSecurityPolicy()
    _oldpolicy=setSecurityPolicy(_policy)
    newSecurityManager(None, OmnipotentUser().__of__(app.acl_users))
    return makerequest(app)

# Enable Faux HTTP request object
app= spoofRequest(app)

# Get Plone site object from Zope application server root
site = app.unrestrictedTraverse("mysite")
site.setupCurrentSkin(app.REQUEST)
zope.app.component.hooks.setSite(site)

# here's an example function

def doSomeStuff(site):
# go get something and change it, then...
	transaction.commit()
	app._p_jar.sync()

 

Run the script

Now you need the command to actually run the script. If the script is in Extensions, from inside the zeocluster that would be:

sudo ./bin/client2 run ./src/namespace.mypackage/namespace/mypackage/Extensions/script.py

And from cron this might be:

/usr/local/Plone-3.3.5/zeocluster/bin/client2 run /usr/local/Plone-3.3.5/zeocluster/src/namespace.mypackage/namespace/mypackage/Extensions/script.py 1>>/home/plone/sal_updates.log

This info came from the following page, where there also some extra stuff and also how to set up logging as well - http://collective-docs.plone.org/misc/commandline.html.

This no longer exists so try here http://readthedocs.org/docs/collective-docs/en/latest/misc/commandline.html

In the above the

import zope
...
zope.app.component.hooks.setSite(site)

 came from a similar error 

zope.component.interfaces.ComponentLookupError: (<InterfaceClass
Products.CMFCore.interfaces._content.ISiteRoot>, '')

to the one encountered and fixed here

http://plone.293351.n2.nabble.com/plone-scripting-td6341705.html

 

 

 

 

 

Document Actions

Branding and printing for Stratford School Academy Branding and printing for Stratford School Academy

Stratford School are to become an academy, and as part of the...

Funky site for Global Art Supplies Funky site for Global Art Supplies

Global Art Supplies needed a revamped web site in keeping with their...

Chancery Bar Association chooses Beetlebrow Chancery Bar Association chooses Beetlebrow

The Chancery Bar Association needed a new web site with improved content...
Beetlebrow web design news