Tareq Alam

i have promises to keep and miles to go before i sleep – Robert Frost

ZopeSkel Archetypes HOWTO September 8, 2009

Filed under: 1 — tareqalam @ 5:38 am
Tags: , , , ,

This is amazing help. To create simple archtype based product in plone follow the steps in this link
http://lionfacelemonface.wordpress.com/tutorials/zopeskel-archetypes-howto/

 

pdflatex running silentmode June 24, 2009

Filed under: 1 — tareqalam @ 10:33 am
Tags: , , , , ,

run this command in terminal to create pdf from the tex file silently

pdflatex -interaction=batchmode texfilename.tex

 

PIL: IOError: encoder jpeg not available June 2, 2009

Filed under: 1 — tareqalam @ 7:07 am
Tags: , , , , ,

I have got this error while doing this
import tempfile
bg_new=Image.new(‘RGB’,(486,236), GREEN)
tmp = tempfile.mktemp(suffix=’.%s’ % ‘jpg’)
bg_new.save(tmp, “JPEG”, quality=95)

I was looking for solution and got this:

in setup.py in Imaging-1.1.6 that is PIL 1.1.6
set this
JPEG_ROOT = “/usr/lib64″, “/usr/include”
then in terminal
python setup.py build –force
this will include libjpeg in PIL. before you may need to install libjpeg in your linux system. I have tried this with python2.4 in ubuntu 8.10
hope this works

 

how to add external method while installing product in plone May 6, 2009

Filed under: 1 — tareqalam @ 11:27 am
Tags: , , , ,

in profiles/default create import_steps.xml

Import easysearch settings

in the product create setuphandlers.py file like this

# created by tareq alam
# tareq.mist@gmail.com
# www.commitmentsoft.com
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import safe_hasattr
from Products.Archetypes.public import listTypes

def importVarious(context):
"""
Final easysearch import steps.
"""

site = context.getSite()
invokeFactory = getToolByName(site, 'invokeFactory')
manage_delObjects = getToolByName(site, 'manage_delObjects')
#getattr = getToolByName(site, 'getattr')

try:
manage_delObjects("reportExternalMethods")
except:
pass
Newfolder = invokeFactory("Folder", id="reportExternalMethods", title="reportExternalMethods",path='/')
Newfolderobj = getattr(site, Newfolder, None)
manage_addProduct = getToolByName(Newfolderobj, 'manage_addProduct')

em = manage_addProduct['ExternalMethod']
manage_addExternalMethod = getToolByName(em, 'manage_addExternalMethod')
manage_addExternalMethod('imageexample', 'imageexample', 'easysearch.imageexample', 'imageexample')
manage_addExternalMethod('createResultPy', 'createResultPy', 'easysearch.createResultPy', 'createResultPy')

#em = context.manage_addProduct['ExternalMethod']

now restart and install product
this will create a folder reportExternalMethods in root .. and also create two external methods in that folder

 

sound prblem fix hp dv 7 laptop in ubuntu April 29, 2009

Filed under: 1 — tareqalam @ 5:32 am
Tags: , , , ,

thanks to this links creator
http://forum.notebookreview.com/showthread.php?t=331172

 

download xml of various settings of plone from zmi April 1, 2009

in zmi of plone click on portal_setup
click on export tab
click on export selected steps button and save in local
done
u can now use these xmls where u need them

 

add contents and publish in plone using python script March 30, 2009

add a external method
in the method’s python file

Newfolder = context.invokeFactory(“Folder”, id=”NEWFOLDERINPLONE”, title=”NEWFOLDERINPLONE”,path=’/’.join(context.getPhysicalPath()))
this will add a new folder in the contexts directory
To publish this folder automatically by code try this magic

Newfolderobj = getattr(context, Newfolder, None)
review_state = Newfolderobj.portal_workflow.getInfoFor(Newfolderobj, ‘review_state’, ”)
if not review_state == ‘published’:
Newfolderobj.portal_workflow.doActionFor(Newfolderobj,”publish”,comment=”publised programmatically”)

it will be published in site on the fly…

to add page template

idict = { ‘id’ : ’step1Page’
, ‘type’: ‘page template’
, ‘body’: page_template_body # variable can be a content of a pt file
, ‘workflow_action’: ‘publish’
, ‘workflow_comment’: ‘This item published programmatically’

}

Newfolderobj.manage_addProduct['PageTemplates'].manage_addPageTemplate(id=idict['id'])
oi = getattr(Newfolderobj,idict['id'])
oi.pt_edit(idict['body'],’text/html’)

this will add a page template in new folder
together


def main(self):

# Example code:

# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
context = self
try:
Newfolder = context.invokeFactory("Folder", id="NewFolderUnusedId", title="NewFolderUnusedId",path='/'.join(context.getPhysicalPath()))
except:
Newfolder = 'NewFolderUnusedId'

Newfolderobj = getattr(context, Newfolder, None)

review_state = Newfolderobj.portal_workflow.getInfoFor(Newfolderobj, 'review_state', '')
if not review_state == 'published':
Newfolderobj.portal_workflow.doActionFor(Newfolderobj,"publish",comment="publised programmatically")
f=open("somefile.pt","r")
page_template_body = f.read()
f.close()
idict = { 'id' : 'step1Page'
, 'type': 'page template'
, 'body': page_template_body
, 'workflow_action': 'publish'
, 'workflow_comment': 'This item published programmatically'

}

Newfolderobj.manage_addProduct['PageTemplates'].manage_addPageTemplate(id=idict['id'])
oi = getattr(Newfolderobj,idict['id'])
oi.pt_edit(idict['body'],'text/html')
return true

 

Add new widget in PloneFormGen March 30, 2009

PloneFormGen is a nice tool to add dynamic forms in plone
There are lot of different form fields in PloneFormGen
but I was in need of a new type of widget in my form
this is how i did that

first to learn how it works..
http://plone.org/products/pfgdatagrid
download this product and install it after installing DataGridWidget and PloneFormGen

now you can add datagrid widget directly in plone form folder

to use a new type of widget as like data grid widget you can do the following steps
1. copy the PFGDataGrid and paste with name as you like for example PFGNoneMultiSelectionWidget
2. inside the folder change in the following files
content
__init__.py will contain import nonemultiselectionff
rename the datagridff.py to nonemultiselectionff.py
in every file in every folder
also in nonemultiselectionff.py you have to define the schema and the function
for this you need to study and this is different for different widgets
you have to define functions so that you can take the widget from the products folder
follow example in datagridfield and in ploneFormGen fields.py for ideas
or call me ;)
change PFGDataGrid to PFGNoneMultiSelectionWidget
and change FormDataGridField to FormNoneMultiSelectionWidget

 

install python 2.4.3 in ubuntu 8.10 March 15, 2009

Filed under: Ubuntu, Zope, ploneCMS, python — tareqalam @ 2:14 pm
Tags: , ,

I have got error at first when i tried to install python 2.4.3 in ubuntu 8.10

error is something like this:

/usr/bin/install -c -m 644 ./LICENSE /usr/local/lib/python2.4/LICENSE.txt
PYTHONPATH=/usr/local/lib/python2.4   \
./python -Wi -tt /usr/local/lib/python2.4/compileall.py \
-d /usr/local/lib/python2.4 -f \
-x ‘badsyntax|site-packages’ /usr/local/lib/python2.4
*** buffer overflow detected ***: ./python terminated
then i searched the net for solution i got this

https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/286334

and the solution isgo inside the python 2.4.3 directory

$ ./configure CC=gcc-4.2 # works
$ ./configure OPT=”-g -O0″ # works

then

$ make

$sudo make install

then the python 2.4.3 will be installed

I need that version of python to run the bootstrap.py of plone svn

now I am happy that the buildout is running ..

Thanks

 

Box.net a nice place to share and store files December 31, 2008

Box.net to store, share, edit, access and collaborate on files worldwide. this helps anyone share and access their data anywhere.

it gives 1GB space free. So you can enjoy uploading and sharing.

i am not advertising .. i enjoyed the interface there and trying to let ppl know about good things ..

thanks

box.net