nodeattr: fix up comment style

And use nodeattr.Title in twitter.
This commit is contained in:
Brad Fitzpatrick 2014-07-25 13:16:10 -07:00
parent bc2b485656
commit f2b9657be6
2 changed files with 7 additions and 5 deletions

View File

@ -40,6 +40,7 @@ import (
"camlistore.org/pkg/httputil"
"camlistore.org/pkg/importer"
"camlistore.org/pkg/schema"
"camlistore.org/pkg/schema/nodeattr"
"camlistore.org/pkg/syncutil"
"camlistore.org/third_party/github.com/garyburd/go-oauth/oauth"
)
@ -187,9 +188,9 @@ func (im *imp) Run(ctx *importer.RunContext) error {
}
rootNode := r.RootNode()
if rootNode.Attr("title") == "" {
if rootNode.Attr(nodeattr.Title) == "" {
screenName := acctNode.Attr(importer.AcctAttrUserName)
rootNode.SetAttr("title", fmt.Sprintf("%s's Tweets", screenName))
rootNode.SetAttr(nodeattr.Title, fmt.Sprintf("%s's Tweets", screenName))
}
userID := acctNode.Attr(importer.AcctAttrUserID)
@ -612,7 +613,7 @@ func (im *imp) ServeCallback(w http.ResponseWriter, r *http.Request, ctx *import
importer.AcctAttrUserID, u.ID,
importer.AcctAttrName, u.Name,
importer.AcctAttrUserName, u.ScreenName,
"title", fmt.Sprintf("%s's Twitter Account", u.ScreenName),
nodeattr.Title, fmt.Sprintf("%s's Twitter Account", u.ScreenName),
); err != nil {
httputil.ServeError(w, r, fmt.Errorf("Error setting attribute: %v", err))
return

View File

@ -24,9 +24,10 @@ const (
// unknown timezone).
DateCreated = "dateCreated"
// http://schema.org/title
// Title is http://schema.org/title
Title = "title"
// http://schema.org/description
// Description is http://schema.org/description
// Value is plain text, no HTML, newlines are newlines.
Description = "description"
)