Sie sind auf Seite 1von 51

tion of a collaborative client/server Tic-Tac-Toe game in which two clients play

Tic-TacToe by interacting with a multithreaded server that maintains the state


of the game. As part of the exercises, readers will write programs that send and
receive messages and files. We ask the reader to modify the Tic-Tac-Toe game to
determine when a player wins the game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQtion of a collaborative client/s
erver Tic-Tac-Toe game in which two clients play Tic-TacToe by interacting with
a multithreaded server that maintains the state of the game. As part of the exer
cises, readers will write programs that send and receive messages and files. We
ask the reader to modify the Tic-Tac-Toe game to determine when a player wins th
e game.
Chapter 21 Security This chapter discusses Web programming security issues. Web pr
ogramming allows the rapid creation of powerful applications, but it also expose
s computers to outside attack. We focus on defensive programming techniques that
help the programmer prevent security problems by using certain techniques and t
ools. One of those tools is encryption. We provide an example of encryption and
decryption with module rotor, which acts as a substitution cipher. Another tool
is module sha, which is used to hash values. A third tool is Python s restricted-a
ccess (rexec) module, which creates a restricted environment in which untrusted
code can execute without damaging the local computer. This chapter examines tech
nologies, such as Public Key Cryptography, Secure Socket Layer (SSL), digital si
gnatures, digital certificates, digital steganography and biometrics, which prov
ide network security. Other types of network security, such as firewalls and ant
ivirus programs, are also covered, and common security threats including cryptan
alytic attacks, viruses, worms and Trojan horses are discussed.
Chapter 22 Data Structures Chapter 22 explores the techniques used to create and m
anipulate standard data structures in Python. Although high-level data types are
built into Python, we believe the reader will benefit from this conceptual and
programmatic examination of common data structures. The chapter begins with a di
scussion of self-referential structures and proceeds with a discussion of how to
create and maintain various data structures, including linked lists, queues (or
waiting lines), stacks and binary trees. We reuse the linked-list class to impl
ement queues and stacks, so that the code for the inherited class is minimized a
nd emphasis is placed on code reuse. The binary tree class contains methods for
pre-, in- and post-order traversals. For each type of data structure, we present
complete, working programs and show sample outputs.
Chapter 23 Case Study: Multi-Tier Online Bookstore This chapter implements an onli
ne bookstore that uses MySQL, XML and XSLT to send Web pages to different client
s. We begin the chapter with an introduction to an HTTP-session framework that m
aintains client information over several pages. The client information is pickled
(serialized) on the server s computer, to be used by the server at a later time. W
e then discuss WML, a markup language used by wireless clients to pass documents
over the Web. Although we demonstrate the application with XHTML, XHTML Basic a
nd WML clients, we designed the bookstore to be extensible, so new client types
can be added easily. The Python CGI programs do not change, but the programmer c
an modify the bookstore to service new clients by simply creating new XML and XS
LT documents for those clients. The bookstore program determines the client type
and sends the appropriate data to the client. This chapter encompasses many top
ics from the previous chapters in the book and illustrates a major strength of P
ython its ability to integrate several technologies quickly and easily. The topics
covered include file processing, serialization (module cPickle), CGI form proce
ssing (module cgi), database access (module MySQ

Das könnte Ihnen auch gefallen