There was once a plone site I help to manage got a corrupted database. Although there was a lot of data already in it as it has been a couple of days of data entry, I still didn't imlement a daily back-up and one day it got corrupted (Data that was supposed to be there is not there anymore. Nothing is listed in the undo list that could help). So how did we finally fix it:
1) Copy the file lib/python/ZODB/fsrecover.py into bin/fsrecover.py
2) We copied the top part from bin/fsdump.py to set the enviroment needed
3) We ran the file bin/fsrecover.py till it came close to the time before the data dissapeard (we actually just stopped it with Ctrl-c)
4) We used that recoved data on another temporary plone site and exported the lost data
5) We imported the data back into the production server and all was well again
But all said and done, best practice is still to just do get the back up running straight away.
Monday, May 26, 2008
Advanced zope db recovery
Posted by
Abdullah Zainul Abidin
at
3:28 AM
0
comments
Labels: data recovery, plone cms, zodb, zope
Saturday, May 24, 2008
Experiment with archgenxml
Archgenxml makes a very potent weapon in deploying plone products fast. But what are all the options for the fields available? So I did a little experiment. I made a product with a class that has one attribute for each type available through archgenxml_profile.xmi. I didn't configure anything else and so some of the type broke the product and I had to remove them. In the end the ones that worked out of the box are:
- boolean : Output a check box for the user
- computed: Does not have a form output but I guess should be available in the view. But after trying to save it fails to display (presumably because I didn't calculate the value it should display) so finally had to take out this field.
- date: Output a date with time series of drop down
- file: Output a file upload button. After saving it would display the name of the file as a link which you can download the file.
- fixedpoint: Output a "money" field
- float: It would only accept a float. But it doesn't gracefully tells the user of it's limitation. Instead it just fails to save and the error log says that because it is not a decimal
- image: Upload an image button. After saving it won't display the file name nor display the file. Rather it displays a link to 'Current image' which would display the file uploaded.
- int: Same as float with the error checking only this time it is an int
- lines: Outputs a multiline text field. The actual output displayed retains it's multiline.
- multiselection: Outputs a list (in this case an empty list) selection
- photo: Have option of 'keep existing image', 'delete current image','replace with new image'. The default controller automatically displays the image uploaded and also has a link to 'Current image' just like an image controller.
- richtext: Outputs the kupu editor
- selection: doesn't seem to output anything (presumably because the selection is empty. I think maybe it'd output a radio button)
- string: output a short single line string input
- text: output a multi line text input much like lines. Surprisingly saving a multi line text does not automatically render it in multi line. But re-editing the field shows that the line breaks do exists only the are probably not translated into html.
Posted by
Abdullah Zainul Abidin
at
5:33 PM
0
comments
Labels: archgenxml, data types, plone cms
Friday, May 23, 2008
First step in learning plone skinning
Go to
http://plone.org/documentation/tutorial/where-is-what/tutorial-all-pages
and learn where to edit all the stuff. Short summary for plone 3.
The logo
- Image:
logo.jpg
- Located:
[site]/portal_skins/plone_images
- Located:
- Template:
- Located:
[site]/portal_view_customizations
- Located:
- CSS:
#portal-logoand#portal-logo a
- Located:
[site]/portal_skins/plone_styles/public.css
- Located:
The search box
- Template:
plone.searchbox
- Located:
[site]/portal_view_customizations
- Located:
- CSS:
#portal-searchboxand
input.searchButton
- Located:
[site]/portal_skins/plone_styles/public.css
- Located:
The navigation tab
- Template:
navigation.pt
- Located:
[site]/portal_view_customizations
- Located:
- CSS:
#portal-globalnav,#portal-globalnav,
li#portal-globalnav li a,
#portal-globalnav li.selected a, and
#portal-globalnav li a:hover
- Located:
[site]/portal_skins/plone_styles/public.css
- Located:
The personal bar
- Template:
plone.personal_bar
- Located:
[site]/portal_view_customizations
- Located:
- CSS:
#portal-personaltools,
#portal-personaltools .portalUser,
#portal-personaltools .portalNotLoggedIn,
#portal-personaltools li, and
#portal-personaltools li a
- Located:
[site]/portal_skins/plone_styles/public.css
- Located:
The path bar
- Template:
plone.path_bar
- Located:
[site]/portal_view_customizations
- Located:
- CSS:
#portal-breadcrumbs
- Located:
[site]/portal_skins/plone_styles/public.css
- Located:
The middle
- Template:
main_template
- Located:
[site]/portal_skins/plone_templates
(tabled skin)
- Located:
- CSS:
ploneColumns.css
- Located:
[site]/plone_skins/plone_styles(tabled
skin)
- Located:
Portlets
Portlets are the parts of the page that get displayed in the
left (left_slot) and right (right_slot) columns. Each portlet has
its own template.
- Templates:
portlet_calendar,
portlet_events,portlet_favorites,
portlet_login,portlet_navigation,
portlet_news,portlet_recent,
portlet_related, andportlet_review
- Located:
[site]/portal_skins/plone_portlets
- Located:
- CSS:
.portlet,.portlet b,
.portlet h5,.portlet h6,
.portletBody,.portletDetails,
.portletMore,.portletContent,
.portletClose,.portlet .even,
.portlet .odd,.portlet input,
.portlet ul, and.portlet li
- Located:
[site]/portal_skins/plone_styles/plone.css
- Located:
- Note:
- The Calendar slot has additional CSS
- CSS:
.dayPopup,.date,
.ploneCalendar,.ploneCalendar a,
.ploneCalendar a:hover,.ploneCalendar,
th.ploneCalendar td,.ploneCalendar,
.weekdays td.ploneCalendar .event,
.ploneCalendar .todayevent, and.ploneCalendar
.todaynoevent
- Located:
[site]/portal_skins/plone_styles/plone.css
- Located:
- CSS:
Document Actions
- Images:
extedit_icon.gif,
mail_icon.gif,print_icon.gif,
site_icon.gif, andrss.gif
- Located:
[site]/portal_skins/plone_images
- Located:
- Template: see: "http://plone.org/documentation/manual/upgrade-guide/version/2.5-3.0/products/document-actions-now-use-zope-3-viewlets">
Document Actions Now Use Zope 3 Viewlets - CSS:
.documentActions,.documentActions ul,, and
.documentActions li.documentActions a
- Located:
[site]/portal_skins/plone_styles/public.css
- Located:
Content Tabs
- Template:
plone.contentviews
- Located:
[site]/portal_view_customizations
- Located:
- CSS:
.contentViews,.contentViews li,
.contentViews li a,.contentViews .selected,
a.contentViews li a:hover, and
.actionItems li
- Located:
[site]/portal_skins/plone_styles/authoring.css
- Located:
Content Menu
- Template:
plone.contentactions
- Located:
[site]/portal_view_customizations
- Located:
- CSS:
.contentActions,.contentActions,
ul.contentActions li,.contentActions,
ul.contentActions li,
.menuPosition,.actionMenu li,
.actionMenu li a,.actionMenu li a:hover,
.actionMenu,.actionSeperator a,
.actionSingular, and.actionItems li
- Located:
[site]/portal_skins/plone_styles/authoring.css
- Located:
The Footer
- Template:
plone.footer
- Located:
[site]/portal_view_customizations
- Located:
- CSS:
#portal-footer
- Located:
[site]/portal_skins/plone_styles/public.css
- Located:
The Colophone
- Template:
plone.colophon
- Located:
[site]/portal_view_customizations
- Located:
- CSS:
#portal-colophon,#portal-colophon,
ul#portal-colophon ul li,
#portal-colophon ul li a, and#portal-colophon
ul li
- Located:
[site]/portal_skins/plone_styles/public.css
- Located:
The Header
- Template:
plone.header - Located:
[site]/portal_view_customizations
Posted by
Abdullah Zainul Abidin
at
4:45 PM
0
comments
Sunday, May 18, 2008
Templates in Django
For a more comprehensive explanation about the templates system in django, please refer to: http://www.djangobook.com/en/beta/chapter04/. You'll be able to see the whole picture there. But just a quickie of how to do it, here's one way:
- Create the templates directory under your project directory
- Change settings.py to have that directory in the TEMPLATE_DIRS tupple. There are a few things to watch out for. First you have to put in the absolute path and not a relative path. If you want it to be more flexible than just add `import os.path` at the top and use `os.path.join(os.path.dirname(__file__),'templates'),` for the TEMPLATE_DIRS tupple. Second is that TEMPLATE_DIRS is supposed to be a tupple and so you have to add a comma at the end of the element even if there is only 1 element.
- Then in your view file add `from django.template.loader import get_template` and `from django.tempate import Context` at the top of the file.
- In the function you want to display the template first load it up `t = get_template('index.html')` and then set the context you want to use for it `html = t.render(Context({'name':'abdullah','age':16}))` and then just spit it out `return HttpResponse(html)`
- And in the templates directory you created just now add the file `index.html`. Create any kind of html you want in it. You could probably even design it in some WYSIWYG editor. Use {{name}} and {{age}} to display the variables we've set in the context.
Posted by
Abdullah Zainul Abidin
at
8:18 AM
0
comments
Labels: django, templating
