Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Add setHTML method to EtherpadLiteClient #3

merged 3 commits into from

2 participants


Following Pita/etherpad-lite#204 there's now a setHTML method available in the EtherpadLite API. This branch adds a method to call setHTML, and a unittest case to test the method.


Hi @devjones , any chance you could look into merging these changes?

@devjones devjones merged commit 7bc6448 into from

done. Thanks for the edits


Thanks again for the merge! I can foresee perhaps one more change before the client is compatible with the 1.1 spec. See Pita/etherpad-lite#103

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 24, 2011
  1. @timtebeek
  2. @timtebeek

    Add test case to call setHTML on a new pad, based on

    timtebeek authored
    Extract common code to setUp method
    Add some documentation
  3. @timtebeek
This page is out of date. Refresh to see the latest.
Showing with 29 additions and 4 deletions.
  1. +7 −0 src/
  2. +22 −4 src/test/
7 src/
@@ -187,6 +187,13 @@ def setText(self, padID, text):
"text": text
+ def setHtml(self, padID, html):
+ """sets the text of a pad from html"""
+ return"setHTML", {
+ "padID": padID,
+ "html": html
+ })
# Group pads are normal pads, but with the name schema
# GROUPID$PADNAME. A security manager controls access of them and its
26 src/test/
@@ -1,19 +1,37 @@
+#!/usr/bin/env python
+"""Module to test py_etherpad."""
import py_etherpad
import unittest
class TestEtherpadLiteClient(unittest.TestCase):
+ """Class to test EtherpadLiteClient."""
+ def setUp(self):
+ """Assign a shared EtherpadLiteClient instance to self."""
+ self.ep_client = py_etherpad.EtherpadLiteClient()
def testCreateLargePad(self):
+ """Initialize a pad with a large body of text, and remove the pad if that succeeds."""
with open('tell-tale.txt') as read_handle:
content =
- #Create client
- ep_client = py_etherpad.EtherpadLiteClient()
+ #Create and remove pad
+ print self.ep_client.createPad('telltale', content)
+ print self.ep_client.deletePad('telltale')
+ def testCreateHTMLPad(self):
+ """Create an initially empty pad, add a HTML text body and remove the pad if that succeeds."""
+ content = "<div><u>Underlined text</u><ul><li>this</li><li>is a</li><li><strong>unordered</strong></li>" + \
+ "<li>list</li></ul>after the list a newline is automatically <u>added</u>" + \
+ "<br>BR can also be used to force new <em>lines</em><p><strong>Or you can use paragraphs</strong></p></div>"
#Create and remove pad
- print ep_client.createPad('telltale', content)
- print ep_client.deletePad('telltale')
+ print self.ep_client.createPad('htmlpad')
+ print self.ep_client.setHtml('htmlpad', content)
+ print self.ep_client.getHtml('htmlpad')
+ print self.ep_client.deletePad('htmlpad')
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testCreateLargePad']
Something went wrong with that request. Please try again.