ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pythoncard
pythoncard
[Pythoncard-users] my pythoncard app: posterchild available for download
by David Primmer other posts by this author
Jul 9 2002 5:02PM messages near this date
[Pythoncard-users] flatfileDatabase changes checked in | [Pythoncard-users] The Power of flatfileDatabase.py
http://primco.org/miscfiles/posterchild.0.6.zip


I've been working on this blogging app for about 4 months and got about
1500 lines of PythonCard code for people to take a look at if
interested. It has some more requirements than the usual sample but if
you have an interest in standalone zodb you should take a look at it. 

Some of the more interesting things I've implemented are using the
multicolumn list, the calendar control, xml import and export, zodb, MS
Word and IE automation, custom dialogs, config file, Unicode support and
... well a whole lot of stuff.

This is my first programming project ever so the code is probably not
very elegant but I've thrown a bunch of stuff in there and Kevin says it
works on his system.... 

I don't think anyone has tried to make it work on Unix or MAC yet and a
test of that would be interesting but I'm primarily building an app to
suit my own picky needs and not to take over the world or be sold or
anything. 

This is the README.TXT
**********************

Posterchild version 0.6
Over Halfway to the release version.

What's new:
Not that anyone would notice but I've changed the schema format and xml
import and export. I also made exporting and publishing on a per-blog
basis.

The app is not done. It is a curiosity at this point. I don't even use
it. It is not 100% functional. What I have now is an XML Blog
composition tool. The functionality is similar to blogger but when you
hit publish, it dumps an xml file of the blog- not very useful. It is a
standalone tool that uses a hard drive and it's never been meant to work
on the internet or be a server. Publishing to the internet can and will
be added later.

I'll consider it ready for release when it writes xml files for every
post and then runs some XSLT transformations to build a bunch of HTML
that can be variously sorted, paginated and grouped by category. That is
a lot of XSLT work and it means that I'll probably be doing less
PythonCard from now on. I'll primarily be using Pyana to drive
transformations and extend XSLT. 

There's a chance that unless you're very careful, you're going to create
non-valid xml with this tool. I've wrapped the body text in CDATA
sections so that it will be ignored by an XML processor. It's just too
easy to trick it right now and I'm not doing any Tidy'ing or validation.
I'll make the app stricter and more xml compliant as I implement more of
the publishing system.
 
Basic blogging functionally:
posts that are dated and have an ID, author, title and summary
posts can be marked as draft or 'do not publish'
posts can be categorized
Edit in plaintext with custom HTML markup tags
Edit in Word and import them into the blog
Preview post with Internet explorer
Multiple blogs
Blog posts sorted by date, ID or title
Calendar function to select posts on certain days
Database dump to single xml file
Publishing to xml (eventually all the way to HTML)
Importing entries from xml


Requirements:

This is designed to be a Windows app but it may be useable on mac and
unix.

I built this program with the primary goal of using Word for the editing
of posts. Along the way, I decided to make it possible to edit in plain
text as well, and then I tried to make using Word an option. I don't
know how successful I was on the last thing. I haven't tested it on mac
or unix or on a windows box with a lower version of word than 10.0.
Specifically, I rely on saving in Word as Filtered HTML which is new in
Office XP and an add-on but not the same in Office 2000. XP is required.

The program also uses Internet Explorer for a preview window. I tried to
make it fail gracefully but this is untested as well.

I don't know if it requires the latest CVS of PythonCard. I use
multicolumn listbox and you might need the latest version for that.

Standalone ZODB
http://www.zope.org/Products/StandaloneZODB

StandaloneZODB is only available for Windows users in source form. I
think the best way to install it is to use the ActiveState Python and
run their package manager. If you have another python distribution, you
have to compile it or get it from the file Neil compiled:

http://pythoncard.sourceforge.net/StandaloneZODB-1.0.win32-py2.2.exe


egenix-mx-base
http://www.egenix.com/files/python
You can get this from the ActiveState package manager also.

Currently, to use the word editing feature you must have Office XP.
posterchild will look for Word 2002 and if it's not present, that
feature will be disabled.



Using the damn thing:
Run posterchild.py

Start it up and specify an ID and name for your blog. The id should be a
single unique word. Name can be a little longer.

The list of entries will be blank. Click on the 'new entry' button and
Word should eventually pop up after some internal python churning.
Depending on wxWindows versions, the focus to the Word app may not come
forward so you have to click in it to start typing. Once you're done
typing, close the Word window (don't bother saving, it will
automagically) and choose 'Import' or 'Discard' from the app. You must
close Word for these buttons to work. The app should be frozen until
then. After an import your text should appear in the textediting window
under bodytext. In addition, if you've checked 'View> Show Preview
Browser', you'll see your entry in a window rendered with Internet
Explorer.

You can continue to modify this entry by typing in the textediting
window. The IE preview doesn't update unless you use Word to edit.

If you can't get Word to work or don't like it, you can disable it by
unchecking 'Options> Enable Word for Editing'. Then when you hit 'New
Entry' it will just add another to the list and you can modify it with
the textediting window.

If you've enabled Word, you can edit an entry's bodytext by hitting the
'Edit in Word' button in the textediting window or by doubleclicking the
entry in the list.

Sort the list by clicking on the column headers.

Modify the categories by selecting an entry and clicking the
'Categories' button. You can create modify or delete blog-wide
categories and then check them for the current entry.

The calendar will highlight with a grey box dates that have entries. If
you click on the calendar it will show only entries for that day. You
can display all the entries by using the 'Display' drop-down box to
select which entries to display.

You can set custom HTML tags to mark up text in the bodytext editing
window. Select text and use the button to tag it.
 

A note on the schema for the blog data:

I've chosen a pretty simple schema that doesn't support comments.
Changing this schema in a major way is not really an option at this
point but I do continually refine it. A Blog has multiple entries and
entries have titles, summary and bodytext. Blogs also have a master
category list and each entry has its own categories. Title is a few
words. Summary can be a couple of sentences (with no " or < > 
characters) I would like bodytext to contain basic XHTML but right now I
CDATA the raw HTML

Unfortunately, validation of input is non-existent at this point. The
intention of using Word is only for composition of writing. Not design.
It should do bold and italics and hyperlinks but not much else. Th

This is the basic format of the xml file:

<blog id="" name="" summary="" lastpublish=""> 
<category/> 

<entry entryid="" utc_datetime="" utc_datetime_modified="" publish=""
draft="" author=""> 
<category/> 
<title/> 
<summary/> 
<bodytext> 
<rawhtml> <![CDATA[]]></rawhtml>
</bodytext> 
</blog> 

Importing data:
I've successfully exported XML from my blogger account and imported it
into posterchild. You can import a blog in the following format:

<blog name=""> 
<entry entryid="" utc_datetime=""> 
<bodytext> 
<rawhtml> <![CDATA[
]]> </rawhtml>
</bodytext> 
</entry> 
</blog> 


File structure:
Expanding the zipfile should create the necessary folders.

the main application folder has:
	configfile.py
	generate_page.py
	pcdlgBlogName.py
	pcdlgBlogName.rsrc.py
	pcdlgCategories.py
	pcdlgCategories.rsrc.py
	pcdlgPublish.py
	pcdlgPublish.rsrc.py
	pcSchema.py
	pcTextEditing.py
	pcTextEditing.rsrc.py
	posterchild.ini
	posterchild.py
	posterchild.rsrc.py

after publishing or importing it also might contain 
	blogname.xml
	blogname_dump.xml
	import.log

other folders:

\dtd 
contains
	blog.dtd


\database 
contains zodb data files
you can use different data files if you change the setting in
posterchild.ini

\temphtml 
contains the temporary files that the word editing function use. These
can be deleted as you see fit.


Here's some more background from the PythonCard list:
http://aspn.activestate.com/ASPN/Mail/Message/1090989
http://aspn.activestate.com/ASPN/Mail/Message/1043560

davep
7-8-02





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Stuff, things, and much much more.
http://thinkgeek.com/sf
_______________________________________________
Pythoncard-users mailing list
Pythoncard-users@[...].net
https://lists.sourceforge.net/lists/listinfo/pythoncard-users

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved