ngi644の日記

備忘録も兼ねています。

makeできないとき。

without comments

make したとき、
err:wineconsole:WCUSER_SetFont wrong font
err:wineconsole:WINECON_Fatal Couldn't find a decent font, aborting

といったエラーが出るときは、Wineの問題がある。

export LANG=C

とすればOK

Written by ngi644

1月 27th, 2012 at 4:43 pm

Posted in LEGO nxt

Tagged with

Ploneのコンテンツを公開したときTwitterにツイートする.

without comments

Plone4アドベントカレンダー2011の21日目です.

ワークフローの状態が変わったらTwitterにツイートするサンプルを作成しました.
ngi.site.notificationです.

このサンプルでEventHandlerとRegistryの使い方,コントロールパネルの作成方法がわかります.

確実にエラーが出ると思います.出たら教えてください.

インストール方法

  • buildout.cfgに以下を追加
    extends =
    
    http://good-py.appspot.com/release/dexterity/1.1?plone=4.1.3
    
    eggs =
        ngi.site.notification
  • ./bin/buildout を実行します.
  • サイト設定のアドオンからNotificationをインストールします.

使い方

インストールが終わったら,サイト設定のNotification settingsを表示します.

設定画面

Action:ワークフローのアクションのidを記入します.デフォルトでpublishが入っています.

comment:ツイートする際のコメントを記入します.

Consumer key,Consumer secret,Access token,Access token secretはhttps://dev.twitter.com/でapplication登録した際のOAuth設定情報を入力します.

設定は以上です.

試してみる

公開を選択

ツイートされた

 

Written by ngi644

12月 21st, 2011 at 11:59 pm

Posted in Zope/Plone

オープンソースOCWのeduCommons

without comments

みなさん、こんにちは。 本日は、私がPlone4 アドベントカレンダー2011の担当します。

オープンコースウェア

オープンコースウェア(OCW)を皆さんご存知でしょうか? これは、大学の講義をインターネットを使って無償で提供するという活動です。 代表例は、MITOCWサイトでしょう。私もたまに利用しています。

eduCommons

eduCommonsは、教育機関がOCWを簡単に導入するためのアプリケーションです。OCWの担当者は、一番重要な、コンテンツに集中することができます。このeduCommonsは、Ploneをベースに作られています。今年、Plone4をベースとしたeduCommons4がリリースされました。ベースのPlone4のパフォーマンスが上がっているので、eduCommons4の性能も上がっていることが期待できます。

まず、どんなものかを見てみたい人は、educomonns.comにデモサイト(http://demo.educommons.com/)があるので使ってみるといいでしょう。

http://demo.educommons.com/

日本にもeduCommonsを使って活動している大学を紹介します。どれも、貴重な講義が掲載されていて一見の価値があります。

おわりに

Plone4を使って作られた教育向けアプリケーションの紹介をしました。もう一回、担当があるので、次回は、Plone4を使った開発のことについて書きたいと思います。

リンク

 

 

Written by ngi644

12月 14th, 2011 at 7:58 pm

Posted in Zope/Plone

ErlangでOSコマンドの実行

without comments

cmd(コマンド)で結果が帰ってくる.
コマンドには,atomか文字列を渡す.
たとえば,os:cmd(ls). とか os:cmd(“ls -al”). である.

Written by ngi644

12月 8th, 2011 at 2:58 pm

Posted in 日常

Tagged with

上棟

without comments

地鎮祭から約一ヶ月,順調なペースでここまで来ました.

Written by ngi644

8月 2nd, 2011 at 9:15 am

Posted in Home,日常

かねてより進めていたプロジェクトが始まりました.

without comments

かねてより進めていたプロジェクトが始まりました.

今週は,基礎部分です.

Written by ngi644

6月 28th, 2011 at 7:47 pm

Posted in Home,日常

Polygonのこと

without comments

cPolygonが3点ないとエラーを出してしまう見たい.回避策として,1点の時は,その点を中心としたサークルに変換,2点の時は,2点を結ぶ線にオフセットする線を作成して,4点に変更する.

Written by ngi644

6月 6th, 2011 at 3:39 pm

Posted in Drawing,日常

SSO利用時のlogoutスクリプト

without comments

SSOのlogoutスクリプト
from Products.CMFCore.utils import getToolByName
try:
from Products.CMFPlone import transaction_note
except ImportError:
from Products.CMFPlone.utils import transaction_note

from Products.PluggableAuthService.PluggableAuthService import logger
logger.info("REQUEST.cookies = %r" % repr(context.REQUEST.cookies))
try:
context.acl_users.logout(context.REQUEST)
except:
pass
target_url = context.REQUEST.URL1.replace('$', '$$')
skinvar = context.portal_skins.getRequestVarname()
path = '/' + context.absolute_url(1)
if context.REQUEST.has_key(skinvar) and not context.portal_skins.getCookiePersistence():
#logger.info("expiring skin cookie")
context.REQUEST.RESPONSE.expireCookie(skinvar, path=path)
sdm = getToolByName(context, 'session_data_manager', None)
if sdm is not None:
#logger.info("got session_data_manager")
session = sdm.getSessionData(create=0)
if session is not None:
#logger.info("invalidating session")
session.invalidate()
if context.REQUEST.cookies.has_key('__ac'):
#logger.info("building local account logout URL")
transaction_note('Logged out')
target_url += '/logged_out'
context.REQUEST.RESPONSE.redirect(target_url)
else:
#logger.info("building shibboleth lazy logout URL")
config = context.acl_users.ShibbolethLogin.getConfig()
spliturl = target_url.split(':')
if config['http_logout_to_http']:
spliturl[0] = 'http'
try:
if config['http_login_url'][0][1][-1] == '=':
splitpath = spliturl[2].split('/')
port = str(config['http_login_to_port'])
if (spliturl[0] == 'https' and port == '443') or \
(spliturl[0] == 'http' and port == '80'):
# don't include default ports
del spliturl[0]
else:
splitpath[0] = port
if splitpath:
spliturl[2] = '/'.join(splitpath)
else:
del spliturl[2]
target_url = config['http_logout_url'] + ':'.join(spliturl) + '/logged_out'
else:
raise IndexError
except IndexError:
target_url = ':'.join(spliturl)
target_url = '%s/Shibboleth.sso/Logout?return=%s' % (target_url, target_url)
context.REQUEST.RESPONSE.redirect(target_url)
print 'This is the %s "%s" in %s' % (script.meta_type, script.getId(), context.absolute_url())
return printed

Written by ngi644

5月 31st, 2011 at 12:17 pm

Posted in Zope/Plone

Blobのファイルはどこに保存されている?

without comments

明けましておめでとうございます。と言っても1月ももう後半ですが。

Ploneを使っていて、ふと、Blobフィールドのファイルがどこに保存されているか知りたくなりました。

f = obj.getField('file')
blob = f.getUnwrapped(obj)
zodb_blob = blob.getBlob()
blob_file = zodb_blob.open()
blob_file.name

で、このnameがファイルシステムに保存されているファイルのフルパスになります。

なお、zodb_blob._p_oid を整形したものが Pathになっているぽい。

今年もよろしくお願いいたします。

Written by ngi644

1月 21st, 2011 at 6:36 pm

Posted in Zope/Plone

collective.xdv でコンテンツタイプごとのテーマテンプレート切り替え

without comments

collective.xdv

今まで、テーマテンプレートとルールを切り替えるのは、「コントロールパネルでできる、URLの正規表現マッチだけ。」と思っていた。

でも、こいつは、diazo(xdv)サーバーを使っている。だから、diazo(xdv)の書き方にそって、ルール内に<theme />タグで書いてあげれば、コンテンツタイプごとに切り替えだってできるのだ。

たとえば、ドキュメントコンテンツタイプでテンプレートを切り替えるには、 <theme href=”sample.html” css:if-content=”body.portaltype-document”/> てな感じで簡単に切り替えができる。

これができたので、ルールのネストなんかもできるに違いない!後日テストしよう。

Written by ngi644

11月 25th, 2010 at 6:01 pm

Posted in Python,Zope/Plone

ロゴとフッターを変えるプロダクト

without comments

Plone4のデザインは、素敵だけど、ロゴとフッターの変更が面倒だと常々感じる。TTTWで変更できるけど、ZMIにアクセスして、base_propertiesをいじったり、Page templateファイルをいじったりしないといけない。

Ploneには、サイト設定という場所がある。なぜ、ロゴとフッターを変更するというサイト作成において、重要なものがないのだろうか?と思っていた。

そこで、今回、さくっと作ってみた。Plone4でしかテストしていないけど、とりあえず、動いている感じ。

ngi.theme.simple

http://pypi.python.org/pypi/ngi.theme.simple/1.0b3

override.zcmlを使ったりとちょっと?というところもあるけど、それは、これから直していきます。

適用前

設定画面 フッターはHTMLタグも使えます。

適用後

Written by ngi644

10月 30th, 2010 at 8:36 pm

Posted in Python,Zope/Plone

Plone で動くBlogプロダクト

with 2 comments

Plone で動くBlogプロダクトで便利だなーと思うのは、collective.blogging。

これは、標準アイテムを拡張してBlogにしてしまうもの。PloneのUIにはマッチしたものだけど、単純に記事を書いて、公開したいというには、ちょっと面倒。

そこで、勉強がてらBlogを作ってみた。(まだ公開していないけど。)

以前、dexterityの勉強のために、
Products.ngiNikkiというのを作っていて(まだ作成中・・・。)、これをArchetypeベースにして、lightboxを同梱し、Plone3とPlone4両方で動くようにしたもの。

残すタスクは、ポートレット部分と国際対応、そして、すこしのテンプレート修正。あと、ドキュメントか。

プロダクト名は、ngi.site.blog となる予定。

今月末の公開を目指す。

なお、使ってもらっているサイトは、こちら↓↓
http://www.edu-con.jp/s-blog

Written by ngi644

8月 27th, 2010 at 11:54 am

Posted in Zope/Plone

Plone 4 dev用buildout

without comments

以下、最近利用する頻度が多くなってきたのでメモしておく。

Plone4 のbuildoutの場所

http://svn.plone.org/svn/plone/buildouts/plone-coredev/branches/4.0/

Written by ngi644

7月 21st, 2010 at 2:40 am

Posted in Zope/Plone

MeeGoでGAE SDK for Pythonで開発する時のポイント1

without comments

MeeGoは、Python2.6が標準で入っています。しかし、GAEは、Python2.5を必要とするため2.5を自前でインストールする必要があります。

Pythonをコンパイルする前に、「ソフトウェアの追加・削除」もしくはYumで下記のパッケージを導入します。

  • openssl-devel
  • sqlite-devel

これらを導入後、Pythonをコンパイルします。

Written by ngi644

7月 3rd, 2010 at 2:00 am

MeeGo に Plone4 をインストールするために必要な物

without comments

MeeGoというIntelとNokiaによるLinuxOSを使い始めた.このOSのUIはかわいくて使っていて楽しくなる.これを開発用にしようと思い,Plone4 Unifiedinstallerをインストールしてみた.インストールする為に必要なパッケージの一覧は下記である.

  • make
  • gcc-c++
  • zlib-devel
  • libjpeg-devel
  • readline-devel

これらをyumを使ってインストールする.これでPlone4をインストールして利用することが出来る.

PloneonMeeGo

Written by ngi644

7月 1st, 2010 at 12:09 am

Posted in Linux,MeeGo,Zope/Plone