Python
共 50 篇文章
Trac Data Models and Schema
The main models that developers might be interested in are Ticket and WikiPage. The constructors each take the environment as the first parameter, and the ticket id or wiki page name next. Ticket Data Model - trac.ticket.model.Ticket from trac.env import Environment from trac.ticket.model import T…
2010-09-15 10:56 · Python
在Mac OS上运行wxPython
如果在一个64位的Mac上跑wxPython, 将会出现以下错误: ImportError: /usr/local/lib/wxPython-unicode-2.8.10.1/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/_core_.so: no appropriate 64-bit architecture (see "man python" for running in 32-bit mode) 原因是现在wxPython需要在本机上以32位python运行. 解决方案如下: 在当前用户的HOME目录的.profile文件中添加如下…
2010-09-14 15:42 · Python
Trac SQL Database API
Trac SQL Database API Trac uses a very thin layer on top of the standard Python Database API 2.0 for interfacing with supported relational database systems such as SQLite or PostgreSQL. Note that Trac prior to version 0.9 used the PySQLite APIs directly, and has no support for other database system…
2010-09-14 13:41 · Python
Trac系统相关文档
Trac组件架构 http://trac.edgewall.org/wiki/TracDev/ComponentArchitecture 编写Trac插件 http://trac.edgewall.org/wiki/TracDev/PluginDevelopment
2010-02-01 12:53 · Python
Django上传文件
之前写了一个上传文件模块,但是当文件很大时就会挂掉,分析了一下,原来是我将文件所有数据先读到内存,然后再写入文件,这样极大占用了CPU资源。现改进了下: def upload_file(request): file_obj = request.FILES.get('file', None) if file_obj: str_time = time.strftime('%Y-%m-%d_%H:%M:%S',time.localtime(time.time())) fname = file_obj.name; fname = str_time + fname[fname.rfind('.'):]…
2009-11-26 18:06 · Python
50个Python重要模块
原文地址: http://www.cnblogs.com/yd1227/archive/2009/10/18/1585487.html Graphical interface wxPython http://wxpython.org Graphical interface pyGtk http://www.pygtk.org Graphical interface pyQT http://www.riverbankcomputing.co.uk/pyqt/ Graphical interface Pmw http://pmw.sourceforge.net/ Graphical interf…
2009-10-20 09:32 · Python
Trac系统的双重认证
首先,需要导入urllib2及cookielib。 然后,关键部分代码: cj = cookielib.LWPCookieJar() ah = urllib2.HTTPDigestAuthHandler() ah.add_password(realm, login_addr, username, password) ch = urllib2.HTTPCookieProcessor(cj) opener2 = urllib2.build_opener(ah, ch) urllib2.install_opener(opener2) 其他的就是常规的登录操作了。
2009-10-20 09:27 · Python
分享一个图表制作库
该包名为ChartDirector,可以从其官方主页 http://www.advsofteng.com/ 下载库及其说明文档,并且有支持不同语言的库下载。最近正在研究这个。。。 另外,还有一个不错的图表库可以使用 python google chart: http://pygooglechart.slowchop.com/
2009-06-18 15:15 · Python
django newforms的更改
Django升级之后,有一些应用包的名称也相应发生了变化,比如newforms包,现在已经更改为forms. 在django的安装目录下可以看到,在此做下记录。
2009-06-16 13:34 · Python
Python版支付宝集成插件源代码
之前在做一项目的时候需要集成支付宝功能,网站是用python做的,参照支付宝的官方文档,写了以下代码(调试通过,能正常工作): # -*- coding: utf-8 -*- #!/usr/bin/env python # author: Robin Huang # time : 2009-03-30 import md5 class Alipay(object): def __init__(self): self.params = {} # 支付宝gateway self.pay_gate_way = 'https://www.alipay.com/cooperate/gateway.do…
2009-05-08 15:34 · Python
Django多语言问题
最近多Django比较感兴趣,打算用它来做一个网站,看了官方关于多语言配置的文档( http://docs.djangoproject.com/en/dev/topics/i18n/?from=olddocs ),Demo程序配置成功,有兴趣的朋友不妨看看这份文档。
2009-05-06 17:22 · Python
Installing Satchmo on Webfaction
link: http://brianmckinney.net/blog/2007/aug/22/installing-satchmo-webfaction/ Wednesday, August 22, 2007 For a project I am working on, I had to figure out a quality shopping cart app to use. I tried a couple mainstream solutions and then I found out about Satchmo, a Django-based shopping cart. Th…
2009-04-29 15:39 · Python
Satchmo配置注意事项
Satchmo在同步数据库之后,在操作后台管理页面过程中,一直出现"No Shop config found"出错提示。Google了下,原来是需要在admin中的shop configuration中设置一个默认的shop属性,问题就解决了。
2009-04-25 16:10 · Python
Yaml与python类型的对照表
因为常用yaml作为python程序的配置文件,特将其与python类型参照表在此贴出,以供温故之用。 YAML tag Python type Standard YAML tags !!null None !!bool bool !!int int !!float float !!binary str !!timestamp datetime.datetime !!omap !!pairs list of pairs !!set set !!str str !!seq list !!map dict Python-specific tags !!python/none None !!pyt…
2009-04-22 23:03 · Python
satchmo汉化
转载: http://blog.csdn.net/huliuhe/archive/2008/09/25/2980580.aspx 注:本文的有些步骤,是基于个人的安装配置。具体使用时候可能要针对个人配置专门设置。 satchmo 是建立在 django 之上。 django 的 i18n 机制对satchmo 也适用,原始版本已有多种语言,但是简体,繁体中文目前都没有,需要自己动手。 本文说明satchmo的i18n步骤。 一:下载 gettext-0.14.4-bin.zip 里面包括xgettext.exe 等几个工具,用于导出字符串。另外还须下载2个dll。 二:生成po文件 在sat…
2009-04-21 15:21 · Python
Read Excel files from Python
本文转至: http://scienceoss.com Use the excellent xlrd package, which works on any platform. That means you can read Excel files from Python in Linux! Example usage: Open the workbook import xlrd wb = xlrd.open_workbook('myworkbook.xls') Check the sheet names wb.sheet_names() Get the first sheet either…
2009-02-27 20:06 · Python
linux下python默认版本的选择
当你在linux系统下安装了不同版本的python, 怎样设定默认的版本的?其实很简单,下面的命令就能搞定: sudo ln -sf /usr/bin/python2.5 /usr/bin/python
2009-01-21 01:14 · Python
DFW Pythoneers, 2nd Sat: Topics We Covered
DFW Pythoneers, 2nd Sat: Topics We Covered Here in Dallas we had our 2nd Saturday (April 12th) meeting at the Nerdbooks.com store. We covered a diverse set of topics, as follows: the Texas Python Community and regional conference planning the Pasta Theory of Software what is so bad about Potato Pro…
2009-01-19 11:00 · Python
Ubuntu中安装pgasync的问题
从http://jamwt.com/pgasync/下载该包,安装其安装的教程执行命令:sudo python setup.py install 然而,出现一下问题: ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- running install running build running build_p…
2008-12-22 02:29 · Python
Reactor在twisted中的作用
首先,引用官方文档中的解释: The reactor is Twisted's main event loop. There is exactly one reactor in any running Twisted application. Once started it loops over and over again, responding to network events, and making scheduled calls to code. 也就是说reactor是twisted中主要的事件循环。每个twisted应用都必须要使用一个reactor,当它启动之后就会不停地进行…
2008-11-14 17:02 · Python