Skip to content

Commit 7902c87

Browse files
committed
new theme and example docs added
1 parent ffe1a84 commit 7902c87

30 files changed

+1769
-278
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
==============
2+
How To Install
3+
==============
4+
5+
Install in Sphinx
6+
-----------------
7+
8+
Copy this directory into the ``sphinx/templates`` directory where Shpinx is installed. For example, a standard install of sphinx on Mac OS X is at ``/Library/Python/2.6/site-packages/Sphinx-0.6.3-py2.6.egg/``
9+
10+
Install Somewhere Else
11+
----------------------
12+
13+
If you want to install this theme somewhere else, you will have to modify the ``conf.py`` file. ::
14+
15+
templates_path = ['/absolute/path/to/dir/','relative/path/']
16+
17+
Making Sphinx Use the Theme
18+
---------------------------
19+
20+
Edit the ``conf.py`` file and make the following setting: ::
21+
22+
html_theme = 'ADCtheme'
23+
24+
Screen Shots
25+
------------
26+
27+
.. image:: http://github.com/coordt/ADCtheme/raw/master/static/scrn1.png
28+
29+
.. image:: http://github.com/coordt/ADCtheme/raw/master/static/scrn2.png
30+
31+
To Do
32+
-----
33+
34+
* Gotta get the javascript working so the Table of Contents is hide-able.
35+
* Probably lots of css cleanup.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
==============
2+
How To Install
3+
==============
4+
5+
Install in Sphinx
6+
-----------------
7+
8+
Copy this directory into the ``sphinx/templates`` directory where Shpinx is installed. For example, a standard install of sphinx on Mac OS X is at ``/Library/Python/2.6/site-packages/Sphinx-0.6.3-py2.6.egg/``
9+
10+
Install Somewhere Else
11+
----------------------
12+
13+
If you want to install this theme somewhere else, you will have to modify the ``conf.py`` file. ::
14+
15+
templates_path = ['/absolute/path/to/dir/','relative/path/']
16+
17+
Making Sphinx Use the Theme
18+
---------------------------
19+
20+
Edit the ``conf.py`` file and make the following setting: ::
21+
22+
html_theme = 'ADCtheme'
23+
24+
Screen Shots
25+
------------
26+
27+
.. image:: http://github.com/coordt/ADCtheme/raw/master/static/scrn1.png
28+
29+
.. image:: http://github.com/coordt/ADCtheme/raw/master/static/scrn2.png
30+
31+
To Do
32+
-----
33+
34+
* Gotta get the javascript working so the Table of Contents is hide-able.
35+
* Probably lots of css cleanup.

_sources/example.txt

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,47 @@
1-
More coming up
1+
=========
2+
EXAMPLE
3+
=========
4+
5+
Let's take a real wold example of a blog where comments need to be checked for
6+
spam check. When the comment is saved in the database, we create a job in the
7+
queue with comment data. Let's take a django model in this case.::
8+
9+
class Comment(models.Model):
10+
name = Model.CharField()
11+
email = Model.EmailField()
12+
body = Model.TextField()
13+
spam = Model.BooleanField()
14+
queue = "Spam"
15+
16+
@staticmethod
17+
def perform(comment_id):
18+
comment = Comment.objects.get(pk=comment_id)
19+
params = {"comment_author_email": comment.user.email,
20+
"comment_content": comment.body,
21+
"comment_author_name": comment.user.name,
22+
"request_ip": comment.author_ip}
23+
x = urllib.urlopen("http://apikey.rest.akismet.com/1.1/comment-check", params)
24+
if x == "true":
25+
comment.spam = True
26+
else:
27+
comment.spam = False
28+
comment.save()
29+
30+
You can convert your existing class to be compatible with Pyres. All you need
31+
to do is add a @queue@ variable and define a @perform@ method on the class.
32+
33+
To insert a job into the queue you need to do something like this:::
34+
35+
from pyres import ResQ
36+
r = Resq()
37+
r.enqueue(Spam, 23) # Passing the comment id 23
38+
39+
This puts a job into the queue **Spam**. Now we need to fire off our workers.
40+
In the **scripts** folder there is an executable::
41+
42+
$ ./pyres_worker Spam
43+
44+
45+
Just pass a comma seperated list of queues the worker should poll.
46+
47+

0 commit comments

Comments
 (0)