- ๐ Iโm currently working on technology stuff with Xplor
- ๐ฑ Iโm currently learning corporate finance ๐
- ๐ Pronouns: he/him
I enjoy Python and have published some packages on PyPI
Easy administration of /.well-known/ resources, robots.txt, and crossdomain.xml
License: BSD 3-Clause "New" or "Revised" License
I enjoy Python and have published some packages on PyPI
First of all, thanks for writing python-xrd and django-wellknown and making them available. Saved me a huge amount of time / effort.
Steps to reproduce:
Example output:
HTTP/1.0 200 OK
Date: Sat, 14 Aug 2010 03:27:58 GMT
Server: WSGIServer/0.1 Python/2.6.5
Content-Type: application/xrd+xml
<xml.dom.minidom.Document instance at 0x2a6e6c8>
Expected:
HTTP/1.0 200 OK
Date: Sat, 14 Aug 2010 03:51:25 GMT
Server: WSGIServer/0.1 Python/2.6.5
Content-Type: application/xrd+xml
<?xml version="1.0" ?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:hm="http://host-meta.net/ns/1.0">
<hm:Host>example.com</hm:Host>
</XRD>
I didn't know whether to create this issue against python-xrd or django-wellknown, so bear with me. The core issue is that the default handler for the host-meta resource, wellknown.resources.HostMeta
returns an xml.dom.minidom.Document
instance instead of the XML that the DOM represents as a string. This is because the __call__
method returns the result of XRD.to_xml
which in turn returns an xml.dom.minidom.Document
instance.
So, depending on what you see as the source of the problem, there are a few different ways to fix this specific problem:
_render_xml
function in xrd.py of python-xrd to return XML instead of an xml.dom.minidom.Document
instance:def _render_xml(xrd):
...
return doc.toxml()
to_xml
method of the XRD
class in xrd.py to return XML:def to_xml(self):
doc = _render_xml(self)
return doc.toxml()
__call__
method in the HostMeta
class in resources.py to do the call:def __call__(self, *args, **kwargs):
doc = self.to_xml()
return doc.toxml()
to reproduce I start with no db in my django app.
I have wellknown as an app directory.
I add wellkown to my settings.py installed_apps
I add wellkown urls.py to my main urls.py
I run python manage.py syncdb
I get an error:
django.db.utils.DatabaseError: no such table: django_site
the stack includes:
File "/home/mattkatz/Projects/django-federation/wellknown/models.py", line 11, in
wellknown.register('host-meta', handler=HostMeta(), content_type='application/xrd+xml')
File "/home/mattkatz/Projects/django-federation/wellknown/resources.py", line 16, in init
hosts = getattr(settings, "WELLKNOWN_HOSTMETA_HOSTS", (Site.objects.get_current().domain,))
commenting out
from resources import HostMeta
register('host-meta', handler=HostMeta(), content_type='application/xrd+xml')
fixes this error
commenting out
for res in Resource.objects.all():
wellknown.register(res.path, content=res.content, content_type=res.content_type)
fixes the following error when running syncdb:
django.db.utils.DatabaseError: no such table: wellknown_resource
django 1.2 python 2.6
See http://github.com/jcarbaugh/django-wellknown/blob/master/wellknown/resources.py#L21
Looks like a line that was supposed to be deleted in 7b7bbd6. It references self._hosts which doesn't exist anymore. Removing the line fixes the problem.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.