Download Python

Document related concepts
no text concepts found
Transcript
Python
A Comprehensive
Programming Language
胡崇偉
[email protected]
Open Source Software Foundry
自由軟體鑄造場
• 營運網站以提供自由軟體專案進駐開發
• 提供系統技術與工具以協助軟體開發
• 研究開放源碼軟體授權條款與法律政策
議題並提供諮詢
• 媒合促成以自由軟體為基礎的本地成功
案例
• 報導國內外產業及社群新聞
• 進行人才培育及國際交流活動
Service and Resource
專案管理
Service and Resource
共同筆記
版本管理
檔案下載
專案管理
通信論壇
待辦事項
統計資訊
Service and Resource
資源目錄
共同筆記
版本管理
檔案下載
授權條款
精靈
專案管理
通信論壇
研究報告
教學文件
人才資料
電子報
待辦事項
統計資訊
推廣光碟
Python ?
Python is a
Dynamic
Object-Oriented
Programming Language
Run-Time Typing
• Python's run time must work harder than Java's.
• a+b=?
– inspect the objects a and b to find out their type,
which is not known at compile time.
– 7 + 11.0
– ‘Hello’ + ‘world’
– (1, 2, 3) + (4, 5, 6)
Interactive with Interpreter
Edit
Debug
Compile
Wait
Deploy
Read
Print
Eval
Read-Eval-Print Loop
>>> 是提示符號
Built-in DataTypes
•
•
•
•
•
Number
String
List
Tuple
Dictionary
7, 11.0
elements
elements
‘Hello World’
[7, 11, ‘store’]
(7, 11, ‘shop’)
{‘name’:’marr’, ‘home’:’taipei’}
MIT to Try Python in CS Courses
Other Features
•
•
•
•
•
Cross Platform and Porting
Excellent Modules
Small
Efficient
Popular
Nokia PyS60
Indexing and Slicing
[
0
1
↓
↓
I
•
•
•
•
2
7
-6
↓
↓
L o
v
e
]
-2 -1
↓ ↓
P y
myString = “I Love Python”
myString[0] == “I”
myString[-1] == “n”
myString[7:-2] == “Pyth”
t
h
o
n
Code Indenting
• No explicit begin or end
• No curly braces
if age > 18:
print “You are old enough.”
else:
print “You are too young.”
Function Example
def myFunc(score):
“””
document strings
“””
import math
math.sqrt(score) * 10
File Handling
fileobj = open(“myfile”, “r”)
lines = fileobj.readlines()
for line in lines:
print line
Socket Creation
import socket
s = socket.socket(
socket.AF_INET,
socket.SOCK_STREAM)
s.connect(
("www.mysite.com", 80))
Python Package Index
RestructuredText
• http://docutils.sourceforge.net/
• Support Formats: HTML,XML,S5,LaTeX
• rst2html < myRST.txt > myRST.html
Version Control
• Mercurial
GUI Library and Toolkit
Wingware IDE
PyGame
PyGame
Blender
Elephants Dream
SQLAlchemy
Web Frameworks
Python Hosting
Plone …
a CMS
Built on Zope
Written in Python
Blog (CoreBlog)
Portal (CIA, USA)
Portal (NASA, USA)
Network Management (ZenOSS)
Issue Tracker (Poi)
Download Installer
• http://plone.org/products/plone
Windows Installer
Windows Installer
Windows Installer
Plone Controller
Filesystem Listing
•
•
•
•
•
•
Python
Zope
Plone
Packages/Products
Software Home
Instance Home
One Database, Many Instances
HTTP Requests and Responses
port 8080
ZEO Client #1
Instance #1
ZEO Client #2
Instance #2
port 8081
Data.fs
Front Page
Zope Management Interface (ZMI)
Site Setup
Guest View
Authenticated View
Different Browsers
for
Different Users/Roles
Tip for Trying Out
One for Admin, Another for Regular User
Usecase #1
Create
a New User
Views Available After Login
• Personal Bar
• Content Views
Usecase #2
Create
New Contents
(Page)
Default Content Types
Page
Image
News Item
File
Event
Link
Title to ID (Part of the URL)
↓
Visual Editor
Content States
Default State and Workflow
Roles and Permissions
View
Add
Edit
Review
Manager
✔
✔
✔
✔
Reviewer
✔
✔
✔
Member
✔
Non-Login
?
✔
✔
Core Security Mapping
Transaction and Undo
Usecase #3
Manage
Portlets
Usecase #4
Enable
OpenID Support
Usecase #5
Change Theme
(to NuPlone)
Free Themes
Better and Super Plone ?
Want More ?
Join the Community
and Develop !
Starting Points
• http://plone.org/documentation
• http://marrtw.blogspot.com/2009/04/plone3-books.html
SQL Database Connection
Z SQL
Method
Z SQL
Method
Z SQL
Method
MySQL
Database
Connection
PgSQL
Database
Connection
Z SQL
Method
ODBC
Database
Connection
Z SQL
Method
Z SQL
Method
Database Components
HTML
WYSWYG Editor
DTML
Page Template
Search Interface
Script
Plone
Site
Development
and
Management
Z SQL Method
Zope
MySQLDA PsycopgDA ODBCDA
Gadfly
MySQL PostgreSQL MSSQL
Database
Connection
Database
Adapter
Designer Friendly Templates
• Work with WYSIWYG editors
• Zope Page Template (ZPT)
– Template Attribute Language (TAL)
– Macro Expansion Tag Attribute Language (METAL)
XML Namespace
TAL statement
name
body
Attribute
Name
Attribute
Value
Element
Content
<title tal:content="here/title">Page Title</title>
Theme Designers ?
•
•
•
•
AJAX / jQuery Support
KSS = Kinetic Style Sheets
Deliverance
Must Read
– Plone 3 Theming
Repeatable Development
editing
running with
buildout.cfg
bin/buildout
installed as
product/
package
downloading
checking into
*.egg
Python
Package
Index
*.tar.gz
Build Your Own Project
cd c:\
C:\plone\python\Scripts\paster
create plone3_buildout
MyBuildout
cd MyBuildout
vim buildout.cfg
bin\buildout.exe
buildout.cfg Sample
[buildout]
http-address = 8080
eggs =
Plone
my.package
zcml =
my.package
debug-mode = on
Summary
A Comprehensive CMS ?
通用型的內容管理系統
The Web CMS Report
Ideaware Report
Web CMS 2007
Technology
Standards
Development
Access Control
Templating
Page Rendering
Usability
Internationalization

Content Production Services
Authoring & Transformation
Aggregation
Repository Services
Metadata/Taxonomy Management
Globalization
Promotion Path
System Reporting

Content Delivery Services Vendor Intangibles
Personalization
Site Search
Scaling & Performance
Multichannel & Syndication
Content Retention
User-Generated Content
Micro-Applications
Site Analytics

Maintenance & Support
Integration & Tech Partnerships
Active User Groups
Services & Channel
Product QA
Strategy & Roadmap
Good Value

Active Community
Multilingual Support
Open Source Projects
OpenPlans
ArgoUML
SchoolTool
Alternative Theming - Deliverance
Developer Baby Steps
• Python Script + External Method
Plone Hosting
Thank You !
Question?
Email to [email protected]
Related documents