Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 60 lines (44 sloc) 1.468 kb
1b3cd6f @jogo Clean up and make HACKING.rst point to openstack-dev/hacking
jogo authored
1 Nova Client Style Commandments
2 ==============================
3
4 - Step 1: Read the OpenStack Style Commandments
c7e62d4 @emonty Clean up a little cruft
emonty authored
5 http://docs.openstack.org/developer/hacking
1b3cd6f @jogo Clean up and make HACKING.rst point to openstack-dev/hacking
jogo authored
6 - Step 2: Read on
7
8
9 Nova Client Specific Commandments
10 ---------------------------------
11 None so far
12
13 Text encoding
14 -------------
15 - All text within python code should be of type 'unicode'.
16
17 WRONG:
18
19 >>> s = 'foo'
20 >>> s
21 'foo'
22 >>> type(s)
23 <type 'str'>
24
25 RIGHT:
26
27 >>> u = u'foo'
28 >>> u
29 u'foo'
30 >>> type(u)
31 <type 'unicode'>
32
33 - Transitions between internal unicode and external strings should always
34 be immediately and explicitly encoded or decoded.
35
36 - All external text that is not explicitly encoded (database storage,
37 commandline arguments, etc.) should be presumed to be encoded as utf-8.
38
39 WRONG:
40
41 mystring = infile.readline()
42 myreturnstring = do_some_magic_with(mystring)
43 outfile.write(myreturnstring)
44
45 RIGHT:
46
47 mystring = infile.readline()
48 mytext = s.decode('utf-8')
49 returntext = do_some_magic_with(mytext)
50 returnstring = returntext.encode('utf-8')
51 outfile.write(returnstring)
52
53 Running Tests
54 -------------
55 The testing system is based on a combination of tox and testr. If you just
56 want to run the whole suite, run `tox` and all will be fine. However, if
57 you'd like to dig in a bit more, you might want to learn some things about
58 testr itself. A basic walkthrough for OpenStack can be found at
59 http://wiki.openstack.org/testr
Something went wrong with that request. Please try again.